Highlight the first message when selecting a new folder, but don't let
authorAlberto Garcia <agarcia@igalia.com>
Wed, 17 Oct 2007 08:25:33 +0000 (08:25 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Wed, 17 Oct 2007 08:25:33 +0000 (08:25 +0000)
it get the active focus.
Fixes NB#58917

pmo-trunk-r3517

src/widgets/modest-header-view.c

index beea9b5..a7e264b 100644 (file)
@@ -916,19 +916,17 @@ modest_header_view_on_expose_event(GtkTreeView *header_view,
        GtkTreeModel *model;
        GtkTreeIter tree_iter;
 
-       /* I'm invalidating this method because it causes an annoying
-          efect, the focus changes to the header view when selecting
-          a folder in the folder view because of this code and it
-          shouldn't. We need to find another way to set the passive
-          focus on it. Sergio. */
-       return FALSE;
-
        model = gtk_tree_view_get_model(header_view);
 
        sel = gtk_tree_view_get_selection(header_view);
        if(!gtk_tree_selection_count_selected_rows(sel))
-               if (gtk_tree_model_get_iter_first(model, &tree_iter))
+               if (gtk_tree_model_get_iter_first(model, &tree_iter)) {
+                       /* Prevent the widget from getting the focus
+                          when selecting the first item */
+                       g_object_set(header_view, "can-focus", FALSE, NULL);
                        gtk_tree_selection_select_iter(sel, &tree_iter);
+                       g_object_set(header_view, "can-focus", TRUE, NULL);
+               }
 
        return FALSE;
 }