Fix mail format setting storage in gtk
[modest] / src / modest-ui-dimming-rules.c
index 715e907..bddbace 100644 (file)
@@ -411,7 +411,7 @@ modest_ui_dimming_rules_on_delete_msg (ModestWindow *win, gpointer user_data)
                        if (state)
                                dimmed = state->sent_in_progress;
                        if (dimmed)
-                               modest_dimming_rule_set_notification (rule, _CS("ckct_ib_unable_to_delete"));
+                               modest_dimming_rule_set_notification (rule, _CS_UNABLE_TO_DELETE);
                }
 
                /* This could happen if we're viewing a message of the
@@ -427,7 +427,7 @@ modest_ui_dimming_rules_on_delete_msg (ModestWindow *win, gpointer user_data)
                        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, _CS("ckct_ib_unable_to_delete"));
+                                       modest_dimming_rule_set_notification (rule, _CS_UNABLE_TO_DELETE);
                                }
                        }
                }
@@ -567,14 +567,34 @@ modest_ui_dimming_rules_on_move_to (ModestWindow *win, gpointer user_data)
 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;
@@ -698,8 +718,7 @@ modest_ui_dimming_rules_on_select_all (ModestWindow *win, gpointer user_data)
        g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);
        rule = MODEST_DIMMING_RULE (user_data);
 
-       focused = gtk_window_get_focus (GTK_WINDOW (win));
-
+       focused = gtk_container_get_focus_child ((GtkContainer *) win);
 
        if (!dimmed && GTK_IS_ENTRY (focused)) {
                const gchar *current_text;
@@ -991,7 +1010,7 @@ modest_ui_dimming_rules_on_editor_paste (ModestWindow *win, gpointer user_data)
        g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (win), TRUE);
        rule = MODEST_DIMMING_RULE (user_data);
 
-       focused = gtk_window_get_focus (GTK_WINDOW (win));
+       focused = gtk_container_get_focus_child ((GtkContainer *) win);
 
        dimmed = MODEST_IS_ATTACHMENTS_VIEW (focused);
        
@@ -1310,7 +1329,7 @@ _invalid_clipboard_selected (ModestWindow *win,
        g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
 
        /* Get focuesed widget */
-       focused = gtk_window_get_focus (GTK_WINDOW (win));
+       focused = gtk_container_get_focus_child ((GtkContainer *) win);
 
        if (MODEST_IS_MSG_EDIT_WINDOW (win)) {
                gboolean has_selection = FALSE;