/soc/2013/ankitkv/gobjectification: 9ed4700451cc: Refactored gtk...
Ankit Vani
a at nevitus.org
Wed Jun 19 10:58:20 EDT 2013
Changeset: 9ed4700451cce98967cfdce52966db3d93fc45f9
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-19 19:15 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/9ed4700451cc
Description:
Refactored gtkprivacy to use the new API. Added (moved) gtkprivacy's UI ops to gtkaccount's UI ops.
diffstat:
pidgin/gtkaccount.c | 13 ++++++++---
pidgin/gtkaccount.h | 2 +-
pidgin/gtkprivacy.c | 55 +++++++++++++++++++---------------------------------
pidgin/gtkprivacy.h | 9 +-------
4 files changed, 31 insertions(+), 48 deletions(-)
diffs (204 lines):
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -165,6 +165,10 @@ static void add_account_to_liststore(Pur
static void set_account(GtkListStore *store, GtkTreeIter *iter,
PurpleAccount *account, GdkPixbuf *global_buddyicon);
+/* privacy UI ops */
+void pidgin_permit_added_removed(PurpleAccount *account, const char *name);
+void pidgin_deny_added_removed(PurpleAccount *account, const char *name);
+
/**************************************************************************
* Add/Modify Account dialog
**************************************************************************/
@@ -2901,10 +2905,11 @@ static PurpleAccountUiOps ui_ops =
pidgin_accounts_request_add,
pidgin_accounts_request_authorization,
pidgin_accounts_request_close,
- NULL,
- NULL,
- NULL,
- NULL
+ pidgin_permit_added_removed,
+ pidgin_permit_added_removed,
+ pidgin_deny_added_removed,
+ pidgin_deny_added_removed,
+ NULL, NULL, NULL, NULL
};
PurpleAccountUiOps *
diff --git a/pidgin/gtkaccount.h b/pidgin/gtkaccount.h
--- a/pidgin/gtkaccount.h
+++ b/pidgin/gtkaccount.h
@@ -27,7 +27,7 @@
#ifndef _PIDGINACCOUNT_H_
#define _PIDGINACCOUNT_H_
-#include "account.h"
+#include "accounts.h"
typedef enum
{
diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c
--- a/pidgin/gtkprivacy.c
+++ b/pidgin/gtkprivacy.c
@@ -80,17 +80,20 @@ static struct
} const menu_entries[] =
{
- { N_("Allow all users to contact me"), PURPLE_PRIVACY_ALLOW_ALL },
- { N_("Allow only the users on my buddy list"), PURPLE_PRIVACY_ALLOW_BUDDYLIST },
- { N_("Allow only the users below"), PURPLE_PRIVACY_ALLOW_USERS },
- { N_("Block all users"), PURPLE_PRIVACY_DENY_ALL },
- { N_("Block only the users below"), PURPLE_PRIVACY_DENY_USERS }
+ { N_("Allow all users to contact me"), PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL },
+ { N_("Allow only the users on my buddy list"), PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST },
+ { N_("Allow only the users below"), PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS },
+ { N_("Block all users"), PURPLE_ACCOUNT_PRIVACY_DENY_ALL },
+ { N_("Block only the users below"), PURPLE_ACCOUNT_PRIVACY_DENY_USERS }
};
static const size_t menu_entry_count = sizeof(menu_entries) / sizeof(*menu_entries);
static PidginPrivacyDialog *privacy_dialog = NULL;
+void pidgin_permit_added_removed(PurpleAccount *account, const char *name);
+void pidgin_deny_added_removed(PurpleAccount *account, const char *name);
+
static void
rebuild_allow_list(PidginPrivacyDialog *dialog)
{
@@ -239,12 +242,12 @@ type_changed_cb(GtkComboBox *combo, Pidg
gtk_widget_hide(dialog->block_widget);
gtk_widget_hide(dialog->button_box);
- if (new_type == PURPLE_PRIVACY_ALLOW_USERS) {
+ if (new_type == PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS) {
gtk_widget_show(dialog->allow_widget);
gtk_widget_show_all(dialog->button_box);
dialog->in_allow_list = TRUE;
}
- else if (new_type == PURPLE_PRIVACY_DENY_USERS) {
+ else if (new_type == PURPLE_ACCOUNT_PRIVACY_DENY_USERS) {
gtk_widget_show(dialog->block_widget);
gtk_widget_show_all(dialog->button_box);
dialog->in_allow_list = FALSE;
@@ -295,9 +298,9 @@ remove_cb(GtkWidget *button, PidginPriva
return;
if (dialog->in_allow_list)
- purple_privacy_permit_remove(dialog->account, name, FALSE);
+ purple_account_privacy_permit_remove(dialog->account, name, FALSE);
else
- purple_privacy_deny_remove(dialog->account, name, FALSE);
+ purple_account_privacy_deny_remove(dialog->account, name, FALSE);
g_free(name);
}
@@ -315,9 +318,9 @@ removeall_cb(GtkWidget *button, PidginPr
user = l->data;
l = l->next;
if (dialog->in_allow_list)
- purple_privacy_permit_remove(dialog->account, user, FALSE);
+ purple_account_privacy_permit_remove(dialog->account, user, FALSE);
else
- purple_privacy_deny_remove(dialog->account, user, FALSE);
+ purple_account_privacy_deny_remove(dialog->account, user, FALSE);
}
}
@@ -413,12 +416,12 @@ privacy_dialog_new(void)
type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog);
#if 0
- if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_ALLOW_USERS) {
+ if (purple_account_get_privacy_type(dialog->account) == PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS) {
gtk_widget_show(dialog->allow_widget);
gtk_widget_show(dialog->button_box);
dialog->in_allow_list = TRUE;
}
- else if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_DENY_USERS) {
+ else if (purple_account_get_privacy_type(dialog->account) == PURPLE_ACCOUNT_PRIVACY_DENY_USERS) {
gtk_widget_show(dialog->block_widget);
gtk_widget_show(dialog->button_box);
dialog->in_allow_list = FALSE;
@@ -462,9 +465,9 @@ static void
confirm_permit_block_cb(PidginPrivacyRequestData *data, int option)
{
if (data->block)
- purple_privacy_deny(data->account, data->name, FALSE, FALSE);
+ purple_account_privacy_deny(data->account, data->name, FALSE, FALSE);
else
- purple_privacy_allow(data->account, data->name, FALSE, FALSE);
+ purple_account_privacy_allow(data->account, data->name, FALSE, FALSE);
destroy_request_data(data);
}
@@ -558,38 +561,20 @@ pidgin_request_add_block(PurpleAccount *
}
}
-static void
+void
pidgin_permit_added_removed(PurpleAccount *account, const char *name)
{
if (privacy_dialog != NULL)
rebuild_allow_list(privacy_dialog);
}
-static void
+void
pidgin_deny_added_removed(PurpleAccount *account, const char *name)
{
if (privacy_dialog != NULL)
rebuild_block_list(privacy_dialog);
}
-static PurplePrivacyUiOps privacy_ops =
-{
- pidgin_permit_added_removed,
- pidgin_permit_added_removed,
- pidgin_deny_added_removed,
- pidgin_deny_added_removed,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PurplePrivacyUiOps *
-pidgin_privacy_get_ui_ops(void)
-{
- return &privacy_ops;
-}
-
void
pidgin_privacy_init(void)
{
diff --git a/pidgin/gtkprivacy.h b/pidgin/gtkprivacy.h
--- a/pidgin/gtkprivacy.h
+++ b/pidgin/gtkprivacy.h
@@ -26,7 +26,7 @@
#ifndef _PIDGINPRIVACY_H_
#define _PIDGINPRIVACY_H_
-#include "privacy.h"
+#include "account.h"
G_BEGIN_DECLS
@@ -67,13 +67,6 @@ void pidgin_request_add_permit(PurpleAcc
*/
void pidgin_request_add_block(PurpleAccount *account, const char *name);
-/**
- * Returns the UI operations structure for the GTK+ privacy subsystem.
- *
- * @return The GTK+ UI privacy operations structure.
- */
-PurplePrivacyUiOps *pidgin_privacy_get_ui_ops(void);
-
G_END_DECLS
#endif /* _PIDGINPRIVACY_H_ */
More information about the Commits
mailing list