From bd99026f08786c62dd5dac92575f34ca1756cd89 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 18 Jun 2009 12:29:51 +0200 Subject: [PATCH] Fixes NB#123401, toolbar icons not dimmed when deleting a message in viewer view --- src/hildon2/modest-msg-view-window.c | 36 ++++++++++++---------------------- src/modest-ui-actions.c | 15 ++++---------- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index 1b2e790..9d751c6 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -202,7 +202,6 @@ static void set_progress_hint (ModestMsgViewWindow *self, static void update_window_title (ModestMsgViewWindow *window); -static gboolean set_toolbar_transfer_mode (ModestMsgViewWindow *self); static void init_window (ModestMsgViewWindow *obj); static gboolean msg_is_visible (TnyHeader *header, gboolean check_outbox); @@ -470,21 +469,6 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj) } - -static gboolean -set_toolbar_transfer_mode (ModestMsgViewWindow *self) -{ - ModestMsgViewWindowPrivate *priv = NULL; - - g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self), FALSE); - - priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self); - - set_progress_hint (self, TRUE); - - return FALSE; -} - static void update_progress_hint (ModestMsgViewWindow *self) { @@ -2470,8 +2454,10 @@ on_mail_operation_started (ModestMailOperation *mail_op, tmp = priv->progress_widgets; source = modest_mail_operation_get_source(mail_op); if (G_OBJECT (self) == source) { - if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE) { - set_toolbar_transfer_mode(self); + if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE || + op_type == MODEST_MAIL_OPERATION_TYPE_OPEN || + op_type == MODEST_MAIL_OPERATION_TYPE_DELETE) { + set_progress_hint (self, TRUE); while (tmp) { modest_progress_object_add_operation ( MODEST_PROGRESS_OBJECT (tmp->data), @@ -2481,9 +2467,12 @@ on_mail_operation_started (ModestMailOperation *mail_op, } } g_object_unref (source); + + /* Update dimming rules */ + check_dimming_rules_after_change (self); } -static void +static void on_mail_operation_finished (ModestMailOperation *mail_op, gpointer user_data) { @@ -2491,13 +2480,15 @@ on_mail_operation_finished (ModestMailOperation *mail_op, ModestMailOperationTypeOperation op_type; GSList *tmp; ModestMsgViewWindowPrivate *priv; - + self = MODEST_MSG_VIEW_WINDOW (user_data); priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self); op_type = modest_mail_operation_get_type_operation (mail_op); tmp = priv->progress_widgets; - - if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE) { + + if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE || + op_type == MODEST_MAIL_OPERATION_TYPE_OPEN || + op_type == MODEST_MAIL_OPERATION_TYPE_DELETE) { while (tmp) { modest_progress_object_remove_operation (MODEST_PROGRESS_OBJECT (tmp->data), mail_op); @@ -2516,7 +2507,6 @@ on_mail_operation_finished (ModestMailOperation *mail_op, won't let the user delete the message that has been readed for example */ check_dimming_rules_after_change (self); - } static void diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 1345da8..26effc7 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -521,7 +521,6 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win) if (response == GTK_RESPONSE_OK) { - ModestWindow *main_window = NULL; ModestWindowMgr *mgr = NULL; GtkTreeModel *model = NULL; GtkTreeSelection *sel = NULL; @@ -552,7 +551,7 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win) } /* Disable window dimming management */ - modest_window_disable_dimming (MODEST_WINDOW(win)); + modest_window_disable_dimming (win); /* Remove each header. If it's a view window header_view == NULL */ mail_op = modest_mail_operation_new ((GObject *) win); @@ -565,18 +564,14 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win) if (sel != NULL) { gtk_tree_selection_unselect_all (sel); } - modest_window_enable_dimming (MODEST_WINDOW(win)); + modest_window_enable_dimming (win); if (MODEST_IS_MSG_VIEW_WINDOW (win)) { modest_ui_actions_refresh_message_window_after_delete (MODEST_MSG_VIEW_WINDOW (win)); /* Get main window */ mgr = modest_runtime_get_window_mgr (); - main_window = modest_window_mgr_get_main_window (mgr, FALSE); /* don't create */ } else if (MODEST_IS_MAIN_WINDOW (win)) { - /* Move cursor to next row */ - main_window = win; - /* Select next or previous row */ if (gtk_tree_row_reference_valid (next_row_reference)) { gtk_tree_selection_select_path (sel, next_path); @@ -597,10 +592,8 @@ modest_ui_actions_on_edit_mode_delete_message (ModestWindow *win) } /* Update toolbar dimming state */ - if (main_window) { - modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window)); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window)); - } + modest_ui_actions_check_menu_dimming_rules (win); + modest_ui_actions_check_toolbar_dimming_rules (win); /* Free */ g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL); -- 1.7.9.5