[nautilus/gnome-3-24] search-popover: make type list box keyboard-navigable



commit 054decb60acecefd7f99135e0ea6da3eb0cf855d
Author: Ernestas Kulik <ernestask gnome org>
Date:   Thu Aug 17 12:29:45 2017 +0300

    search-popover: make type list box keyboard-navigable
    
    Currently, the type list box in the search popover is not
    keyboard-navigable, which, as a consequence, results in the user’s
    inability to also easily close the popover.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786402

 src/nautilus-search-popover.c               |   11 +++++++++++
 src/resources/ui/nautilus-search-popover.ui |    2 +-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index db95a2b..8aa949d 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -260,7 +260,15 @@ static void
 select_type_button_clicked (GtkButton             *button,
                             NautilusSearchPopover *popover)
 {
+    GtkListBoxRow *selected_row;
+
+    selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (popover->type_listbox));
+
     gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-list");
+    if (selected_row != NULL)
+    {
+        gtk_widget_grab_focus (GTK_WIDGET (selected_row));
+    }
 
     /* Hide the date selection widgets when the type selection
      * listbox is shown.
@@ -829,6 +837,9 @@ nautilus_search_popover_init (NautilusSearchPopover *self)
 
     fill_types_listbox (self);
 
+    gtk_list_box_select_row (GTK_LIST_BOX (self->type_listbox),
+                             gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->type_listbox), 0));
+
     filter_time_type = g_settings_get_enum (nautilus_preferences, "search-filter-time-type");
     if (filter_time_type == NAUTILUS_QUERY_SEARCH_TYPE_LAST_MODIFIED)
     {
diff --git a/src/resources/ui/nautilus-search-popover.ui b/src/resources/ui/nautilus-search-popover.ui
index 72fd99d..23b2e22 100644
--- a/src/resources/ui/nautilus-search-popover.ui
+++ b/src/resources/ui/nautilus-search-popover.ui
@@ -315,7 +315,7 @@
                       <object class="GtkListBox" id="type_listbox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="selection_mode">none</property>
+                        <property name="selection_mode">single</property>
                         <signal name="row-activated" handler="types_listbox_row_activated" 
object="NautilusSearchPopover" swapped="no" />
                       </object>
                     </child>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]