gobjectification: fb55ef16: Update finch for GObjectified accounts.

sadrul at pidgin.im sadrul at pidgin.im
Sun Jun 22 14:42:23 EDT 2008


-----------------------------------------------------------------
Revision: fb55ef16a54e874acc44b76c764fbf6d181143e8
Ancestor: 32eec889940862dc6ebbcde55e58a39eea463a23
Author: sadrul at pidgin.im
Date: 2008-06-22T18:09:04
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/fb55ef16a54e874acc44b76c764fbf6d181143e8

Modified files:
        finch/gntaccount.c finch/gntconn.c

ChangeLog: 

Update finch for GObjectified accounts.

-------------- next part --------------
============================================================
--- finch/gntaccount.c	33a066d8b8ee2b25225c3fc18f8a5e017c34f066
+++ finch/gntaccount.c	fb448d711a805da85552a0e4e6a4748e441aa717
@@ -82,6 +82,12 @@ static void
 static GList *accountdialogs;
 
 static void
+account_abled_cb(PurpleAccount *account, GParamSpec *spec, gpointer tree)
+{
+	gnt_tree_set_choice(GNT_TREE(tree), account, purple_account_get_enabled(account));
+}
+
+static void
 account_add(PurpleAccount *account)
 {
 	gnt_tree_add_choice(GNT_TREE(accounts.tree), account,
@@ -90,7 +96,9 @@ account_add(PurpleAccount *account)
 				purple_account_get_protocol_name(account)),
 			NULL, NULL);
 	gnt_tree_set_choice(GNT_TREE(accounts.tree), account,
-			purple_account_get_enabled(account, FINCH_UI));
+			purple_account_get_enabled(account));
+	g_signal_connect_object(G_OBJECT(account), "notify::enabled",
+			G_CALLBACK(account_abled_cb), accounts.tree, 0);
 }
 
 static void
@@ -155,8 +163,10 @@ save_account_cb(AccountEditDialog *dialo
 	{
 		account = dialog->account;
 
-		/* Protocol */
+#warning We need to destroy the existing account and create a new one with the changed prpl
+#if 0
 		purple_account_set_protocol_id(account, purple_plugin_get_id(plugin));
+#endif
 		purple_account_set_username(account, username->str);
 	}
 	g_string_free(username, TRUE);
@@ -645,7 +655,7 @@ account_toggled(GntWidget *widget, void 
 {
 	PurpleAccount *account = key;
 
-	purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key));
+	purple_account_set_enabled(account, gnt_tree_get_choice(GNT_TREE(widget), key));
 }
 
 static void
@@ -748,15 +758,6 @@ account_removed_callback(PurpleAccount *
 	gnt_tree_remove(GNT_TREE(accounts.tree), account);
 }
 
-static void
-account_abled_cb(PurpleAccount *account, gpointer user_data)
-{
-	if (accounts.window == NULL)
-		return;
-	gnt_tree_set_choice(GNT_TREE(accounts.tree), account,
-			GPOINTER_TO_INT(user_data));
-}
-
 void finch_accounts_init()
 {
 	GList *iter;
@@ -767,17 +768,11 @@ void finch_accounts_init()
 	purple_signal_connect(purple_accounts_get_handle(), "account-removed",
 			finch_accounts_get_handle(), PURPLE_CALLBACK(account_removed_callback),
 			NULL);
-	purple_signal_connect(purple_accounts_get_handle(), "account-disabled",
-			finch_accounts_get_handle(),
-			PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(FALSE));
-	purple_signal_connect(purple_accounts_get_handle(), "account-enabled",
-			finch_accounts_get_handle(),
-			PURPLE_CALLBACK(account_abled_cb), GINT_TO_POINTER(TRUE));
 
 	iter = purple_accounts_get_all();
 	if (iter) {
 		for (; iter; iter = iter->next) {
-			if (purple_account_get_enabled(iter->data, FINCH_UI))
+			if (purple_account_get_enabled(iter->data))
 				break;
 		}
 		if (!iter)
============================================================
--- finch/gntconn.c	73ce18da86b2412b9315a83b05335f077eaab193
+++ finch/gntconn.c	934c7a2b81c73109f9aca6a5c8b8533ef2f9545f
@@ -97,7 +97,7 @@ ce_enable_account_cb(PurpleAccount *acco
 static void
 ce_enable_account_cb(PurpleAccount *account)
 {
-	purple_account_set_enabled(account, FINCH_UI, TRUE);
+	purple_account_set_enabled(account, TRUE);
 }
 
 static void
@@ -141,7 +141,7 @@ finch_connection_report_disconnect(Purpl
 		g_free(act);
 		g_free(primary);
 		g_free(secondary);
-		purple_account_set_enabled(account, FINCH_UI, FALSE);
+		purple_account_set_enabled(account, FALSE);
 	}
 
 	/* If we have any open chats, we probably want to rejoin when we get back online. */


More information about the Commits mailing list