From 8a0d77c2ad1908136329d8ebe5348136e4e49387 Mon Sep 17 00:00:00 2001 From: Felix Kaser Date: Tue, 8 Dec 2009 22:43:39 +0100 Subject: remove error infobars if account disabled/removed fixes bug #601379 --- src/empathy-main-window.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src/empathy-main-window.c') diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 2a316b99e..f1b9f5fa5 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -303,9 +303,30 @@ main_window_row_activated_cb (EmpathyContactListView *view, g_object_unref (contact); } +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) { -- cgit v1.2.3