gobjectification: 8068b2fe: Out go account-enabled/account-disabled ..

sadrul at pidgin.im sadrul at pidgin.im
Thu Jun 26 00:20:43 EDT 2008


-----------------------------------------------------------------
Revision: 8068b2fe3011282e04591941e291239ef4cfc7f9
Ancestor: bc36b4476fa34ad71049111027423b7988510af5
Author: sadrul at pidgin.im
Date: 2008-06-26T04:14:01
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/8068b2fe3011282e04591941e291239ef4cfc7f9

Modified files:
        libpurple/account.c pidgin/gtkblist.c pidgin/gtkstatusbox.c

ChangeLog: 

Out go account-enabled/account-disabled purple signals, in come
enable-changed::enabled/enable-changed::disabled gobject signals.

-------------- next part --------------
============================================================
--- libpurple/account.c	309149c2ceef3f443194bec2b953f0933eb9fee7
+++ libpurple/account.c	39db1423ca6bee3479f5c8408da7769af8ca951e
@@ -419,6 +419,7 @@ enum
 /* GObject Signal enums */
 enum
 {
+	SIG_ENABLE_CHANGED,
 	SIG_SETTING_INFO,
 	SIG_SETTINGS_CHANGED,
 	SIG_LAST
@@ -676,6 +677,12 @@ static void purple_account_class_init(Pu
 
 
 	/* Setup signals */
+	signals[SIG_ENABLE_CHANGED] =
+		g_signal_new("enable-changed", G_OBJECT_CLASS_TYPE(klass),
+				G_SIGNAL_ACTION | G_SIGNAL_DETAILED, 0, NULL, NULL,
+				g_cclosure_marshal_VOID__VOID,
+				G_TYPE_NONE, 0);
+
 	signals[SIG_SETTINGS_CHANGED] =
 		g_signal_new("settings-changed", G_OBJECT_CLASS_TYPE(klass),
 				G_SIGNAL_ACTION | G_SIGNAL_DETAILED, 0, NULL, NULL,
@@ -1373,17 +1380,14 @@ purple_account_set_enabled(PurpleAccount
 	PURPLE_ACCOUNT_GET_PRIVATE(account)->enabled = value;
 	g_object_notify(G_OBJECT(account), PROP_ENABLED_S);
 
+	g_signal_emit(G_OBJECT(account), signals[SIG_ENABLE_CHANGED],
+			g_quark_from_string(value ? "enabled" : "disabled"));
+
 	purple_account_set_ui_bool(account, purple_core_get_ui(),
 			"enabled", value);
 
 	gc = purple_account_get_connection(account);
 
-	/* XXX: I don't know where to move these signals. */
-	if(was_enabled && !value)
-		purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account);
-	else if(!was_enabled && value)
-		purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
-
 #warning Do something about wants-to-die. Perhaps check if current_error is fatal?
 #if 0
 	if ((gc != NULL) && (gc->wants_to_die == TRUE))
@@ -2606,16 +2610,6 @@ purple_accounts_init(void)
 						 purple_value_new(PURPLE_TYPE_SUBTYPE,
 										PURPLE_SUBTYPE_ACCOUNT));
 
-	purple_signal_register(handle, "account-disabled",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_ACCOUNT));
-
-	purple_signal_register(handle, "account-enabled",
-						 purple_marshal_VOID__POINTER, NULL, 1,
-						 purple_value_new(PURPLE_TYPE_SUBTYPE,
-										PURPLE_SUBTYPE_ACCOUNT));
-
 	purple_signal_register(handle, "account-setting-info",
 						 purple_marshal_VOID__POINTER_POINTER, NULL, 2,
 						 purple_value_new(PURPLE_TYPE_SUBTYPE,
============================================================
--- pidgin/gtkblist.c	3a9175e3bf86cdd57868c7a313419177aa35e763
+++ pidgin/gtkblist.c	660acf2c183d95d4708cdd88fc446b5a42c9df9c
@@ -5635,10 +5635,10 @@ static void pidgin_blist_show(PurpleBudd
 	/* Setup some purple signal handlers. */
 
 	handle = purple_accounts_get_handle();
-	purple_signal_connect(handle, "account-enabled", gtkblist,
-	                      PURPLE_CALLBACK(account_modified), gtkblist);
-	purple_signal_connect(handle, "account-disabled", gtkblist,
-	                      PURPLE_CALLBACK(account_modified), gtkblist);
+
+	purple_type_connect(PURPLE_TYPE_ACCOUNT, "enable-changed",
+			G_CALLBACK(account_modified), gtkblist);
+
 	purple_signal_connect(handle, "account-removed", gtkblist,
 	                      PURPLE_CALLBACK(account_modified), gtkblist);
 	purple_signal_connect(handle, "account-status-changed", gtkblist,
============================================================
--- pidgin/gtkstatusbox.c	071b9dfc88b4feda284929e6df9e6a11c1a65544
+++ pidgin/gtkstatusbox.c	7902672e88cabb21fff4a23bfc7605e8cf36c4af
@@ -1939,12 +1939,10 @@ pidgin_status_box_init (PidginStatusBox 
 	purple_signal_connect(purple_savedstatuses_get_handle(),
 			"savedstatus-modified", status_box,
 			PURPLE_CALLBACK(saved_status_updated_cb), status_box);
-	purple_signal_connect(purple_accounts_get_handle(), "account-enabled", status_box,
-						PURPLE_CALLBACK(account_enabled_cb),
-						status_box);
-	purple_signal_connect(purple_accounts_get_handle(), "account-disabled", status_box,
-						PURPLE_CALLBACK(account_enabled_cb),
-						status_box);
+
+	purple_type_connect(PURPLE_TYPE_ACCOUNT, "enable-changed",
+		G_CALLBACK(account_enabled_cb), status_box);
+
 	purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", status_box,
 						PURPLE_CALLBACK(account_status_changed_cb),
 						status_box);


More information about the Commits mailing list