/soc/2013/ankitkv/gobjectification: a3bc28bb4ef5: Refactored pid...

Ankit Vani a at nevitus.org
Wed Jun 19 10:58:20 EDT 2013


Changeset: a3bc28bb4ef574839a86522fb34da20d9d528db1
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-19 19:56 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/a3bc28bb4ef5

Description:

Refactored pidgin to use the GObject-based PurpleAccount API

diffstat:

 pidgin/gtkblist.c                        |  12 ++++++------
 pidgin/gtkconv.c                         |   2 +-
 pidgin/gtkmain.c                         |   5 ++---
 pidgin/gtkprivacy.c                      |  13 ++++++-------
 pidgin/gtksession.c                      |   2 +-
 pidgin/plugins/gtk-signals-test.c        |   2 +-
 pidgin/plugins/perl/common/GtkAccount.xs |   2 +-
 7 files changed, 18 insertions(+), 20 deletions(-)

diffs (178 lines):

diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -1416,14 +1416,14 @@ toggle_privacy(GtkWidget *widget, Purple
 	account = purple_buddy_get_account(buddy);
 	name = purple_buddy_get_name(buddy);
 
-	permitted = purple_privacy_check(account, name);
+	permitted = purple_account_privacy_check(account, name);
 
 	/* XXX: Perhaps ask whether to restore the previous lists where appropirate? */
 
 	if (permitted)
-		purple_privacy_deny(account, name, FALSE, FALSE);
+		purple_account_privacy_deny(account, name);
 	else
-		purple_privacy_allow(account, name, FALSE, FALSE);
+		purple_account_privacy_allow(account, name);
 
 	pidgin_blist_update(purple_get_blist(), node);
 }
@@ -1435,7 +1435,7 @@ void pidgin_append_blist_node_privacy_me
 	gboolean permitted;
 
 	account = purple_buddy_get_account(buddy);
-	permitted = purple_privacy_check(account, purple_buddy_get_name(buddy));
+	permitted = purple_account_privacy_check(account, purple_buddy_get_name(buddy));
 
 	pidgin_new_item_from_stock(menu, permitted ? _("_Block") : _("Un_block"),
 						permitted ? PIDGIN_STOCK_TOOLBAR_BLOCK : PIDGIN_STOCK_TOOLBAR_UNBLOCK, G_CALLBACK(toggle_privacy),
@@ -4159,7 +4159,7 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	if (!purple_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) {
+	if (!purple_account_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) {
 		path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL);
 		return _pidgin_blist_get_cached_emblem(path);
 	}
@@ -6309,7 +6309,7 @@ static void pidgin_blist_show(PurpleBudd
 	purple_signal_connect(handle, "account-actions-changed", gtkblist,
 	                      PURPLE_CALLBACK(account_actions_changed), NULL);
 
-	handle = pidgin_account_get_handle();
+	handle = pidgin_accounts_get_handle();
 	purple_signal_connect(handle, "account-modified", gtkblist,
 	                      PURPLE_CALLBACK(account_modified), gtkblist);
 
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -7205,7 +7205,7 @@ gray_stuff_out(PidginConversation *gtkco
 		gtk_action_set_visible(win->menu.get_info, TRUE);
 		gtk_action_set_visible(win->menu.invite, FALSE);
 		gtk_action_set_visible(win->menu.alias, TRUE);
-		if (purple_privacy_check(account, purple_conversation_get_name(conv))) {
+		if (purple_account_privacy_check(account, purple_conversation_get_name(conv))) {
 			gtk_action_set_visible(win->menu.unblock, FALSE);
 			gtk_action_set_visible(win->menu.block, TRUE);
 		} else {
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -257,7 +257,6 @@ pidgin_ui_init(void)
 	purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops());
 	purple_blist_set_ui_ops(pidgin_blist_get_ui_ops());
 	purple_notify_set_ui_ops(pidgin_notify_get_ui_ops());
-	purple_privacy_set_ui_ops(pidgin_privacy_get_ui_ops());
 	purple_request_set_ui_ops(pidgin_request_get_ui_ops());
 	purple_sound_set_ui_ops(pidgin_sound_get_ui_ops());
 	purple_connections_set_ui_ops(pidgin_connections_get_ui_ops());
@@ -266,7 +265,7 @@ pidgin_ui_init(void)
 	purple_idle_set_ui_ops(pidgin_idle_get_ui_ops());
 #endif
 
-	pidgin_account_init();
+	pidgin_accounts_init();
 	pidgin_connection_init();
 	pidgin_blist_init();
 	pidgin_status_init();
@@ -302,7 +301,7 @@ pidgin_quit(void)
 	pidgin_docklet_uninit();
 	pidgin_blist_uninit();
 	pidgin_connection_uninit();
-	pidgin_account_uninit();
+	pidgin_accounts_uninit();
 	pidgin_xfers_uninit();
 	pidgin_debug_uninit();
 
diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c
--- a/pidgin/gtkprivacy.c
+++ b/pidgin/gtkprivacy.c
@@ -28,7 +28,6 @@
 
 #include "connection.h"
 #include "debug.h"
-#include "privacy.h"
 #include "request.h"
 #include "util.h"
 
@@ -102,7 +101,7 @@ rebuild_allow_list(PidginPrivacyDialog *
 
 	gtk_list_store_clear(dialog->allow_store);
 
-	for (l = dialog->account->permit; l != NULL; l = l->next) {
+	for (l = purple_account_privacy_get_permitted(dialog->account); l != NULL; l = l->next) {
 		gtk_list_store_append(dialog->allow_store, &iter);
 		gtk_list_store_set(dialog->allow_store, &iter, 0, l->data, -1);
 	}
@@ -116,7 +115,7 @@ rebuild_block_list(PidginPrivacyDialog *
 
 	gtk_list_store_clear(dialog->block_store);
 
-	for (l = dialog->account->deny; l != NULL; l = l->next) {
+	for (l = purple_account_privacy_get_denied(dialog->account); l != NULL; l = l->next) {
 		gtk_list_store_append(dialog->block_store, &iter);
 		gtk_list_store_set(dialog->block_store, &iter, 0, l->data, -1);
 	}
@@ -310,9 +309,9 @@ removeall_cb(GtkWidget *button, PidginPr
 {
 	GSList *l;
 	if (dialog->in_allow_list)
-		l = dialog->account->permit;
+		l = purple_account_privacy_get_permitted(dialog->account);
 	else
-		l = dialog->account->deny;
+		l = purple_account_privacy_get_denied(dialog->account);
 	while (l) {
 		char *user;
 		user = l->data;
@@ -465,9 +464,9 @@ static void
 confirm_permit_block_cb(PidginPrivacyRequestData *data, int option)
 {
 	if (data->block)
-		purple_account_privacy_deny(data->account, data->name, FALSE, FALSE);
+		purple_account_privacy_deny(data->account, data->name);
 	else
-		purple_account_privacy_allow(data->account, data->name, FALSE, FALSE);
+		purple_account_privacy_allow(data->account, data->name);
 
 	destroy_request_data(data);
 }
diff --git a/pidgin/gtksession.c b/pidgin/gtksession.c
--- a/pidgin/gtksession.c
+++ b/pidgin/gtksession.c
@@ -366,7 +366,7 @@ pidgin_session_init(gchar *argv0, gchar 
 	g_free(tmp);
 
 	session_set_gchar(session, SmRestartStyleHint, (gchar) SmRestartIfRunning);
-	session_set_string(session, SmProgram, g_get_prgname());
+	session_set_string(session, SmProgram, (gchar *) g_get_prgname());
 
 	myself = g_strdup(argv0);
 	purple_debug(PURPLE_DEBUG_MISC, "Session Management",
diff --git a/pidgin/plugins/gtk-signals-test.c b/pidgin/plugins/gtk-signals-test.c
--- a/pidgin/plugins/gtk-signals-test.c
+++ b/pidgin/plugins/gtk-signals-test.c
@@ -110,7 +110,7 @@ conversation_switched_cb(PurpleConversat
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-	void *accounts_handle = pidgin_account_get_handle();
+	void *accounts_handle = pidgin_accounts_get_handle();
 	void *blist_handle = pidgin_blist_get_handle();
 	void *conv_handle = pidgin_conversations_get_handle();
 
diff --git a/pidgin/plugins/perl/common/GtkAccount.xs b/pidgin/plugins/perl/common/GtkAccount.xs
--- a/pidgin/plugins/perl/common/GtkAccount.xs
+++ b/pidgin/plugins/perl/common/GtkAccount.xs
@@ -4,7 +4,7 @@ MODULE = Pidgin::Account  PACKAGE = Pidg
 PROTOTYPES: ENABLE
 
 Purple::Handle
-pidgin_account_get_handle()
+pidgin_accounts_get_handle()
 
 MODULE = Pidgin::Account  PACKAGE = Pidgin::Account::Dialog  PREFIX = pidgin_account_dialog_
 PROTOTYPES: ENABLE



More information about the Commits mailing list