From: Jose Dapena Paz Date: Wed, 17 Dec 2008 15:21:31 +0000 (+0000) Subject: Send receive all dimming if send receive in progress X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=20a9f0a5f16f1b80c744641a84202f734a4fecf5 Send receive all dimming if send receive in progress pmo-drop-split-view-r6921 --- diff --git a/src/hildon2/modest-accounts-window.c b/src/hildon2/modest-accounts-window.c index 4166204..65c9eb7 100644 --- a/src/hildon2/modest-accounts-window.c +++ b/src/hildon2/modest-accounts-window.c @@ -370,7 +370,7 @@ static void setup_menu (ModestAccountsWindow *self, ModestDimmingRulesGroup *gro group, G_CALLBACK (modest_ui_dimming_rules_on_new_msg)); add_to_menu (self, HILDON_APP_MENU (priv->app_menu), _("mcen_me_inbox_sendandreceive"), G_CALLBACK (modest_ui_actions_on_send_receive), - group, G_CALLBACK (modest_ui_dimming_rules_on_send_receive)); + group, G_CALLBACK (modest_ui_dimming_rules_on_send_receive_all)); add_to_menu (self, HILDON_APP_MENU (priv->app_menu), _("mcen_me_outbox_cancelsend"), G_CALLBACK (modest_ui_actions_cancel_send), group, G_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all)); diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index 9261942..a30754a 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef MODEST_TOOLKIT_HILDON2 #include #endif @@ -78,6 +79,7 @@ static gboolean _invalid_folder_for_purge (ModestWindow *win, ModestDimmingRule static gboolean _transfer_mode_enabled (ModestWindow *win); static gboolean _selected_folder_has_subfolder_with_same_name (ModestWindow *win); static void fill_list_of_caches (gpointer key, gpointer value, gpointer userdata); +static gboolean _send_receive_in_progress (ModestWindow *win); static DimmedState * @@ -1883,7 +1885,9 @@ modest_ui_dimming_rules_on_send_receive_all (ModestWindow *win, gpointer user_da modest_account_mgr_free_account_names (account_names); - /* TODO: should dim if send receive is in progress */ + if (!dimmed) { + dimmed = _send_receive_in_progress (win); + } return dimmed; } @@ -2823,3 +2827,30 @@ modest_ui_dimming_rules_on_insert_image (ModestWindow *win, return (format != MODEST_MSG_EDIT_FORMAT_HTML); } + +static gboolean +_send_receive_in_progress (ModestWindow *win) +{ + ModestMailOperationQueue *queue; + GSList *op_list, *node; + gboolean found_send_receive; + + queue = modest_runtime_get_mail_operation_queue (); + op_list = modest_mail_operation_queue_get_by_source (queue, G_OBJECT (win)); + + found_send_receive = FALSE; + for (node = op_list; node != NULL; node = g_slist_next (node)) { + ModestMailOperation *op; + + op = (ModestMailOperation *) node->data; + if (modest_mail_operation_get_type_operation (op) == MODEST_MAIL_OPERATION_TYPE_SEND_AND_RECEIVE) { + found_send_receive = TRUE; + break; + } + } + + g_slist_foreach (op_list, (GFunc) g_object_unref, NULL); + g_slist_free (op_list); + + return found_send_receive; +}