[empathy] remove error infobars if account disabled/removed



commit 8a0d77c2ad1908136329d8ebe5348136e4e49387
Author: Felix Kaser <f kaser gmx net>
Date:   Tue Dec 8 22:43:39 2009 +0100

    remove error infobars if account disabled/removed
    
    fixes bug #601379

 src/empathy-main-window.c |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 2a316b9..f1b9f5f 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -304,8 +304,29 @@ main_window_row_activated_cb (EmpathyContactListView *view,
 }
 
 static void
+main_window_remove_error (EmpathyMainWindow *window,
+			  TpAccount *account)
+{
+	GtkWidget *error_widget;
+
+	error_widget = g_hash_table_lookup (window->errors, account);
+	if (error_widget != NULL) {
+		gtk_widget_destroy (error_widget);
+		g_hash_table_remove (window->errors, account);
+	}
+}
+
+static void
+main_window_account_disabled_cb (TpAccountManager *manager,
+				 TpAccount *account,
+				 EmpathyMainWindow *window)
+{
+	main_window_remove_error (window, account);
+}
+
+static void
 main_window_error_retry_clicked_cb (GtkButton *button,
-				   EmpathyMainWindow *window)
+				    EmpathyMainWindow *window)
 {
 	TpAccount *account;
 	GtkWidget *error_widget;
@@ -338,12 +359,9 @@ main_window_error_close_clicked_cb (GtkButton *button,
 				    EmpathyMainWindow *window)
 {
 	TpAccount *account;
-	GtkWidget *error_widget;
 
 	account = g_object_get_data (G_OBJECT (button), "account");
-	error_widget = g_hash_table_lookup (window->errors, account);
-	gtk_widget_destroy (error_widget);
-	g_hash_table_remove (window->errors, account);
+	main_window_remove_error (window, account);
 }
 
 static void
@@ -1109,6 +1127,9 @@ main_window_account_removed_cb (TpAccountManager  *manager,
 		g_list_length (a) > 0);
 
 	g_list_free (a);
+
+	/* remove errors if any */
+	main_window_remove_error (window, account);
 }
 
 static void
@@ -1364,6 +1385,9 @@ empathy_main_window_show (void)
 	g_signal_connect (window->account_manager, "account-removed",
 			  G_CALLBACK (main_window_account_removed_cb),
 			  window);
+	g_signal_connect (window->account_manager, "account-disabled",
+			  G_CALLBACK (main_window_account_disabled_cb),
+			  window);
 
 	l = empathy_event_manager_get_events (window->event_manager);
 	while (l) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]