X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-ui-dimming-rules.c;h=dbf42f74daa8726d63e40d0e694099bb71e2cfd2;hp=8faeed5acee48429175fe263d8d7d3c7773f8d16;hb=fea09605e381472af9e9f7b8608883de1a72da99;hpb=60e5848997afb38e747c6750f2fc0d6639adaef4 diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index 8faeed5..dbf42f7 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -947,11 +947,24 @@ gboolean modest_ui_dimming_rules_on_fetch_images (ModestWindow *win, gpointer user_data) { gboolean dimmed = FALSE; + ModestDimmingRule *rule = NULL; g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win), FALSE); + rule = MODEST_DIMMING_RULE (user_data); dimmed = !modest_msg_view_window_has_blocked_external_images (MODEST_MSG_VIEW_WINDOW (win)); + if (!dimmed) { + dimmed = _transfer_mode_enabled (win); + if (dimmed) + modest_dimming_rule_set_notification (rule, _("mail_ib_notavailable_downloading")); + } + if (!dimmed) { + dimmed = _msg_download_in_progress (win); + if (dimmed) + modest_dimming_rule_set_notification (rule, _("mcen_ib_unable_to_reply")); + } + return dimmed; } @@ -1193,14 +1206,34 @@ modest_ui_dimming_rules_on_main_window_move_to (ModestWindow *win, gpointer user static gboolean _forbid_outgoing_xfers (ModestWindow *window) { - const gchar *account_name; - TnyAccount *account; + const gchar *account_name = NULL; + TnyAccount *account = NULL; gboolean dimmed = FALSE; - account_name = modest_window_get_active_account (window); - account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store (), - account_name, - TNY_ACCOUNT_TYPE_STORE); +#ifdef MODEST_TOOLKIT_HILDON2 + /* We cannot just get the active account because the active + account of a header window that shows the headers of a + local account is the ID of the remote account */ + if (MODEST_IS_HEADER_WINDOW (window)) { + ModestHeaderView *header_view; + TnyFolder *folder; + + header_view = modest_header_window_get_header_view ((ModestHeaderWindow *) window); + folder = modest_header_view_get_folder (header_view); + + if (folder) { + account = modest_tny_folder_get_account (folder); + g_object_unref (folder); + } + } +#endif + + if (!account) { + account_name = modest_window_get_active_account (window); + account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store (), + account_name, + TNY_ACCOUNT_TYPE_STORE); + } if (account) { ModestProtocolType protocol_type; @@ -1856,7 +1889,7 @@ modest_ui_dimming_rules_on_editor_remove_attachment (ModestWindow *win, gpointer return dimmed; } -gboolean +gboolean modest_ui_dimming_rules_on_send (ModestWindow *win, gpointer user_data) { ModestDimmingRule *rule = NULL; @@ -1886,6 +1919,14 @@ modest_ui_dimming_rules_on_send (ModestWindow *win, gpointer user_data) dimmed = ((gtk_text_buffer_get_char_count (to_buffer) + gtk_text_buffer_get_char_count (cc_buffer) + gtk_text_buffer_get_char_count (bcc_buffer)) == 0); + + if (!dimmed) { + if (modest_text_utils_no_recipient (to_buffer) && + modest_text_utils_no_recipient (cc_buffer) && + modest_text_utils_no_recipient (bcc_buffer)) + dimmed = TRUE; + } + if (dimmed) modest_dimming_rule_set_notification (rule, _("mcen_ib_add_recipients_first")); } @@ -2073,7 +2114,7 @@ modest_ui_dimming_rules_on_send_receive_all (ModestWindow *win, gpointer user_da gboolean modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_data) { - GSList *recipients; + GSList *recipients = NULL; gboolean has_recipients_to_add; g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE); @@ -2098,19 +2139,8 @@ modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_dat g_object_unref (msg); } } else if (MODEST_IS_MSG_EDIT_WINDOW (win)) { - /* Get recipients */ - gchar *joined, *after_remove; - MsgData *data = modest_msg_edit_window_get_msg_data ((ModestMsgEditWindow *) win); - - /* We don't check the from */ - joined = modest_text_utils_join_addresses (NULL, data->to, data->cc, data->bcc); - after_remove = modest_text_utils_remove_duplicate_addresses (joined); - g_free (joined); - - recipients = modest_text_utils_split_addresses_list (after_remove); - g_free (after_remove); - - modest_msg_edit_window_free_msg_data ((ModestMsgEditWindow *) win, data); + /* Check if there are pending addresses to add */ + return !modest_msg_edit_window_has_pending_addresses ((ModestMsgEditWindow *) win); } has_recipients_to_add = FALSE; @@ -2118,9 +2148,12 @@ modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_dat if (recipients) { GSList *node; for (node = recipients; node != NULL; node = g_slist_next (node)) { - if (!modest_address_book_has_address ((const gchar *) node->data)) { - has_recipients_to_add = TRUE; - break; + const gchar *recipient = (const gchar *) node->data; + if (modest_text_utils_validate_recipient (recipient, NULL)) { + if (!modest_address_book_has_address (recipient)) { + has_recipients_to_add = TRUE; + break; + } } } g_slist_foreach (recipients, (GFunc) g_free, NULL);