changeset 21369:318b3f5d1516

Call pidgin_blist_update_account_error_state in response to account-error-changed rather than in various places in gtkconn.c.
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 27 Oct 2007 17:45:05 +0000
parents 089fc89b6996
children 0aa18e21a595 a41ac7fd19ab
files pidgin/gtkblist.c pidgin/gtkconn.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sat Oct 27 17:43:49 2007 +0000
+++ b/pidgin/gtkblist.c	Sat Oct 27 17:45:05 2007 +0000
@@ -4394,6 +4394,16 @@
 }
 
 void
+account_error_changed_cb(PurpleAccount *account,
+                         PurpleAccountCurrentError *err)
+{
+	if (err)
+		pidgin_blist_update_account_error_state(account, err->description);
+	else
+		pidgin_blist_update_account_error_state(account, NULL);
+}
+
+void
 pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text)
 {
 	GList *l;
@@ -4956,6 +4966,9 @@
 	purple_signal_connect(handle, "account-status-changed", gtkblist,
 	                      PURPLE_CALLBACK(account_status_changed),
 	                      gtkblist);
+	purple_signal_connect(handle, "account-error-changed", gtkblist,
+	                      PURPLE_CALLBACK(account_error_changed_cb),
+	                      gtkblist);
 
 	handle = pidgin_account_get_handle();
 	purple_signal_connect(handle, "account-modified", gtkblist,
--- a/pidgin/gtkconn.c	Sat Oct 27 17:43:49 2007 +0000
+++ b/pidgin/gtkconn.c	Sat Oct 27 17:45:05 2007 +0000
@@ -82,8 +82,6 @@
 					   (purple_connections_get_connecting() != NULL));
 
 	g_hash_table_remove(auto_reconns, account);
-
-	pidgin_blist_update_account_error_state(account, NULL);
 }
 
 static void
@@ -149,7 +147,6 @@
 	account = purple_connection_get_account(gc);
 	info = g_hash_table_lookup(auto_reconns, account);
 
-	pidgin_blist_update_account_error_state(account, text);
 	if (!purple_connection_error_is_fatal (reason)) {
 		if (info == NULL) {
 			info = g_new0(PidginAutoRecon, 1);
@@ -301,8 +298,6 @@
 account_removed_cb(PurpleAccount *account, gpointer user_data)
 {
 	g_hash_table_remove(auto_reconns, account);
-
-	pidgin_blist_update_account_error_state(account, NULL);
 }