* src/modest-ui-actions.c:
[modest] / src / modest-ui-dimming-rules.c
index d9819b7..82ad2de 100644 (file)
@@ -78,16 +78,16 @@ modest_ui_dimming_rules_on_new_folder (ModestWindow *win, gpointer user_data)
        if (!parent_folder)
                return TRUE;
        
-       /* If it's the local account do not dimm */
+       /* If it's the local account do not dim */
        if (modest_tny_folder_store_is_virtual_local_folders (parent_folder)) {
                return FALSE;
        } else if (TNY_IS_ACCOUNT (parent_folder)) {
-               /* If it's the MMC root folder then dimm it */
+               /* If it's the MMC root folder then dim it */
                if (!strcmp (tny_account_get_id (TNY_ACCOUNT (parent_folder)), MODEST_MMC_ACCOUNT_ID)) {
                        dimmed = TRUE;
                } else {
                        const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (parent_folder));
-                       /* If it's POP then dimm */
+                       /* If it's POP then dim */
                        dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
                                  MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
                }
@@ -207,16 +207,26 @@ modest_ui_dimming_rules_on_delete_msg (ModestWindow *win, gpointer user_data)
 }
 
 gboolean 
-modest_ui_dimming_rules_on_details_msg (ModestWindow *win, gpointer user_data)
+modest_ui_dimming_rules_on_details (ModestWindow *win, gpointer user_data)
 {
        gboolean dimmed = FALSE;
        
        /* main window dimming rules */
        if (MODEST_IS_MAIN_WINDOW(win)) {
-               
-               /* Check dimmed rule */ 
-               if (!dimmed)
-                       dimmed = _invalid_msg_selected (MODEST_MAIN_WINDOW(win), TRUE);
+               GtkWidget *header_view;
+
+               /* Check dimmed rule */
+               header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+                                                                  MODEST_WIDGET_TYPE_HEADER_VIEW);
+
+               /* If the header view does not have the focus then do
+                  not apply msg dimming rules because the action will
+                  show the folder details that have no dimming
+                  rule */
+               if (gtk_widget_is_focus (header_view)) {
+                       if (!dimmed)
+                               dimmed = _invalid_msg_selected (MODEST_MAIN_WINDOW(win), TRUE);
+               }
 
        /* msg view window dimming rules */
        } else {
@@ -534,9 +544,9 @@ _already_opened_msg (ModestWindow *win)
        /* Check dimmed rule (TODO: check focus on widgets */   
        mgr = modest_runtime_get_window_mgr ();
        iter = tny_list_create_iterator (selected_headers);
-       while (!tny_iterator_is_done (iter) && result) {        
+       while (!tny_iterator_is_done (iter) && result) {
                header = TNY_HEADER (tny_iterator_get_current (iter));
-               window = modest_window_mgr_find_window_by_msguid (mgr, tny_header_get_uid (header));
+               window = modest_window_mgr_find_window_by_header (mgr, header);
                result = result && (window != NULL);
                        
                g_object_unref (header);