changeset 14742:f453cc774882

[gaim-migrate @ 17499] Attach to the "account-status-changed" signal so that we can notice primitive status changes on the token account. This is based on stuff from Richard Nelson and and rewster. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 17 Oct 2006 19:01:38 +0000
parents fbb2e1657acb
children 01dcb6d7657d
files gtk/gtkstatusbox.c gtk/gtkstatusbox.h
diffstat 2 files changed, 10 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkstatusbox.c	Tue Oct 17 14:30:58 2006 +0000
+++ b/gtk/gtkstatusbox.c	Tue Oct 17 19:01:38 2006 +0000
@@ -71,6 +71,7 @@
 
 static void gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box);
 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box);
+static void status_menu_refresh_iter(GtkGaimStatusBox *status_box);
 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box);
 static void gtk_gaim_status_box_changed(GtkComboBox *box);
 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);
@@ -225,6 +226,11 @@
 {
 	if (status_box->account == account)
 		update_to_reflect_account_status(status_box, account, newstatus);
+	else if (status_box->token_status_account == account)
+	{
+		gtk_gaim_status_box_refresh(status_box);
+		status_menu_refresh_iter(status_box);
+	}
 }
 
 static gboolean
@@ -388,17 +394,6 @@
 	case PROP_ACCOUNT:
 		statusbox->account = g_value_get_pointer(value);
 
-		if (statusbox->status_changed_signal) {
-			gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed",
-			                        statusbox, GAIM_CALLBACK(account_status_changed_cb));
-			statusbox->status_changed_signal = 0;
-		}
-
-		if (statusbox->account) {
-			statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
-			                                                       statusbox, GAIM_CALLBACK(account_status_changed_cb),
-			                                                       statusbox);
-		}
 		gtk_gaim_status_box_regenerate(statusbox);
 
 		break;
@@ -413,11 +408,6 @@
 {
 	GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(obj);
 
-	if (statusbox->status_changed_signal) {
-		gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed",
-								statusbox, GAIM_CALLBACK(account_status_changed_cb));
-		statusbox->status_changed_signal = 0;
-	}
 	gaim_signals_disconnect_by_handle(statusbox);
 	gaim_prefs_disconnect_by_handle(statusbox);
 
@@ -1359,6 +1349,10 @@
 	gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled", status_box,
 						GAIM_CALLBACK(account_enabled_cb),
 						status_box);
+	gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", status_box,
+						GAIM_CALLBACK(account_status_changed_cb),
+						status_box);
+
 	gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons",
 								buddy_list_details_pref_changed_cb, status_box);
 	gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck",
--- a/gtk/gtkstatusbox.h	Tue Oct 17 14:30:58 2006 +0000
+++ b/gtk/gtkstatusbox.h	Tue Oct 17 19:01:38 2006 +0000
@@ -117,8 +117,6 @@
 	GtkTreeIter iter;
 	char *error;
 
-	gulong status_changed_signal;
-
 	/*
 	 * These widgets are made for renderin'
 	 * That's just what they'll do