* Fixes NB#86592, dimm the sort button when the folder is empty
authorSergio Villar Senin <svillar@igalia.com>
Tue, 24 Jun 2008 16:23:33 +0000 (16:23 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 24 Jun 2008 16:23:33 +0000 (16:23 +0000)
pmo-trunk-r4763

src/modest-ui-actions.c
src/modest-ui-dimming-rules.c

index 9a56876..614ba87 100644 (file)
@@ -521,7 +521,6 @@ modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win)
 
                        /* Select next or previous row */
                        if (gtk_tree_row_reference_valid (next_row_reference)) {
-/*                             next_path = gtk_tree_row_reference_get_path (row_reference); */
                                gtk_tree_selection_select_path (sel, next_path);
                        }
                        else if (gtk_tree_row_reference_valid (prev_row_reference)) {                           
@@ -540,8 +539,10 @@ modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win)
                }
                
                /* Update toolbar dimming state */
-               if (main_window)
+               if (main_window) {
+                       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
                        modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
+               }
 
                /* Free */
                g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL);
index caabb65..c739e55 100644 (file)
@@ -2125,7 +2125,7 @@ _header_view_is_all_selected (ModestMainWindow *win)
 static gboolean
 _selected_folder_is_empty (ModestMainWindow *win)
 {
-       GtkWidget *folder_view = NULL;
+       GtkWidget *folder_view = NULL, *header_view = NULL;
        TnyFolderStore *folder = NULL;
        gboolean result = FALSE;
 
@@ -2134,8 +2134,12 @@ _selected_folder_is_empty (ModestMainWindow *win)
        /* Get folder view */
        folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
                                                           MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
+
+       header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
+                                                          MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
+
        /* If no folder view, always dimmed */
-       if (!folder_view)
+       if (!folder_view || !header_view)
                return TRUE;
        
        /* Get selected folder as parent of new folder to create */
@@ -2147,7 +2151,9 @@ _selected_folder_is_empty (ModestMainWindow *win)
        }
        
        /* Check folder type */
-       result = tny_folder_get_all_count (TNY_FOLDER (folder)) == 0;
+       if (modest_header_view_is_empty (MODEST_HEADER_VIEW (header_view)) ||
+           tny_folder_get_all_count (TNY_FOLDER (folder)) == 0)
+               result = TRUE;
 
        /* free */
        g_object_unref (folder);