X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-ui-dimming-rules.c;h=a3a6552b115f489b09c0dc75e96a219e6a93cd8e;hp=d859aa24a712b1418d9849e8f4fbc4cacf7bdfb0;hb=3a65c0163dc7290de04ecf59d6863eca4991ec3b;hpb=d12f48e69bc8b52fd77cee4ed0153f5bc08e7610 diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index d859aa2..a3a6552 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -34,6 +34,7 @@ #include #include "modest-ui-dimming-rules.h" #include "modest-ui-actions.h" +#include "modest-account-mgr-helpers.h" #include "modest-dimming-rule.h" #include "modest-debug.h" #include "modest-tny-folder.h" @@ -489,7 +490,8 @@ modest_ui_dimming_rules_on_delete (ModestWindow *win, gpointer user_data) header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (win))); folder = modest_header_view_get_folder (MODEST_HEADER_VIEW (header_view)); if (folder) { - dimmed = (tny_folder_get_all_count (TNY_FOLDER (folder)) == 0); + dimmed = (tny_folder_get_all_count (TNY_FOLDER (folder)) == 0) || + modest_header_view_is_empty (MODEST_HEADER_VIEW (header_view)); if (!dimmed && (tny_folder_get_folder_type (TNY_FOLDER (folder)) == TNY_FOLDER_TYPE_OUTBOX)) { @@ -618,11 +620,6 @@ modest_ui_dimming_rules_on_rename_folder (ModestWindow *win, gpointer user_data) if (dimmed) modest_dimming_rule_set_notification (rule, ""); } - if (!dimmed) { - dimmed = _transfer_mode_enabled (win); - if (dimmed) - modest_dimming_rule_set_notification (rule, ""); - } return dimmed; } @@ -932,19 +929,24 @@ modest_ui_dimming_rules_on_details (ModestWindow *win, gpointer user_data) if (MODEST_IS_MSG_VIEW_WINDOW (win)) dimmed = _msg_download_in_progress (win); if (dimmed) - modest_dimming_rule_set_notification (rule, ""); - if (!dimmed && MODEST_IS_MSG_VIEW_WINDOW (win)) { - if (!modest_msg_view_window_is_search_result (MODEST_MSG_VIEW_WINDOW(win))) { - dimmed = !modest_msg_view_window_has_headers_model (MODEST_MSG_VIEW_WINDOW (win)); - } - if (dimmed) - modest_dimming_rule_set_notification (rule, ""); - } + modest_dimming_rule_set_notification (rule, ""); } return dimmed; } +gboolean +modest_ui_dimming_rules_on_fetch_images (ModestWindow *win, gpointer user_data) +{ + gboolean dimmed = FALSE; + + g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win), FALSE); + + dimmed = !modest_msg_view_window_has_blocked_external_images (MODEST_MSG_VIEW_WINDOW (win)); + + return dimmed; +} + gboolean modest_ui_dimming_rules_on_mark_as_read_msg_in_view (ModestWindow *win, gpointer user_data) @@ -1891,20 +1893,52 @@ modest_ui_dimming_rules_on_view_next (ModestWindow *win, gpointer user_data) if (!dimmed) { dimmed = modest_msg_view_window_last_message_selected (MODEST_MSG_VIEW_WINDOW (win)); modest_dimming_rule_set_notification (rule, NULL); - } + } return dimmed; } -gboolean +gboolean modest_ui_dimming_rules_on_tools_smtp_servers (ModestWindow *win, gpointer user_data) { - return !modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), - TRUE); + gboolean dimmed; + ModestAccountMgr *mgr; + + mgr = modest_runtime_get_account_mgr(); + dimmed = !modest_account_mgr_has_accounts(mgr, TRUE); + + /* Dimm it if we only have metaaccounts */ + if (!dimmed) { + ModestProtocolRegistry *reg = modest_runtime_get_protocol_registry (); + GSList *account_names = modest_account_mgr_account_names (mgr, TRUE); + + if (account_names) { + ModestProtocolType store_protocol; + gboolean found = FALSE; + GSList *iter = account_names; + const gchar *tag = MODEST_PROTOCOL_REGISTRY_MULTI_MAILBOX_PROVIDER_PROTOCOLS; + + while (iter && !found) { + gchar* account_name; + + account_name = (gchar *) iter->data; + store_protocol = modest_account_mgr_get_store_protocol (mgr, account_name); + + if (!modest_protocol_registry_protocol_type_has_tag (reg, store_protocol, tag)) + found = TRUE; + else + iter = g_slist_next (iter); + } + modest_account_mgr_free_account_names (account_names); + dimmed = !found; + } + } + + return dimmed; } -gboolean +gboolean modest_ui_dimming_rules_on_cancel_sending (ModestWindow *win, gpointer user_data) { ModestDimmingRule *rule = NULL; @@ -2529,7 +2563,7 @@ _invalid_clipboard_selected (ModestWindow *win, result = !has_selection; } else if (MODEST_IS_MSG_VIEW_WINDOW (win)) { if (focused) { - MODEST_DEBUG_BLOCK (g_message ("FOCUSED %s", g_type_name (G_TYPE_FROM_INSTANCE (focused)));); + MODEST_DEBUG_BLOCK (g_debug ("FOCUSED %s", g_type_name (G_TYPE_FROM_INSTANCE (focused)));); if (GTK_IS_LABEL (focused) && !gtk_label_get_selection_bounds (GTK_LABEL (focused), NULL, NULL)) { result = TRUE; @@ -3075,7 +3109,8 @@ modest_ui_dimming_rules_on_header_window_move_to (ModestWindow *win, gpointer us header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (win))); folder = modest_header_view_get_folder (MODEST_HEADER_VIEW (header_view)); if (folder) { - dimmed = (tny_folder_get_all_count (TNY_FOLDER (folder)) == 0); + dimmed = (tny_folder_get_all_count (TNY_FOLDER (folder)) == 0) || + modest_header_view_is_empty (MODEST_HEADER_VIEW (header_view)); if (!dimmed && (tny_folder_get_folder_type (TNY_FOLDER (folder)) == TNY_FOLDER_TYPE_OUTBOX)) {