[dconf-editor] Selection activation in search view.



commit 3c521429ecf173931e60da8d234e8efd3b0688cc
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Dec 2 11:59:18 2017 +0100

    Selection activation in search view.

 editor/browser-view.vala    |    8 ++++++++
 editor/dconf-window.vala    |    9 +++++++++
 editor/registry-search.vala |   11 +++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 3a7e582..47976a3 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -245,6 +245,14 @@ class BrowserView : Grid, PathElement
     * * Keyboard calls
     \*/
 
+    public bool return_pressed ()
+    {
+        if (!current_view_is_search_results_view ())
+            assert_not_reached ();
+
+        return search_results_view.return_pressed ();
+    }
+
     public bool up_pressed (bool grab_focus)
     {
         if (current_view_is_browse_view ())
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 6f9ac9f..cc4717b 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -516,6 +516,15 @@ class DConfWindow : ApplicationWindow
         if (name == "Down")
             return browser_view.down_pressed (!search_bar.get_search_mode ());
 
+        if ((name == "Return" || name == "KP_Enter")
+         && browser_view.current_view_is_search_results_view ()
+         && search_entry.has_focus
+         && browser_view.return_pressed ())
+        {
+            search_bar.set_search_mode (false);
+            return true;
+        }
+
         if (name == "Menu")
         {
             if (browser_view.show_row_popover ())
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 49a5c8d..b7249d1 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -243,6 +243,17 @@ class RegistrySearch : Grid, PathElement, BrowsableView
         return false;
     }
 
+    public bool return_pressed ()
+    {
+        ListBoxRow? selected_row = (ListBoxRow?) key_list_box.get_selected_row ();
+        if (selected_row == null)
+            return false;
+
+        ((ClickableListBoxRow) ((!) selected_row).get_child ()).on_row_clicked ();
+
+        return true;
+    }
+
     public bool up_or_down_pressed (bool grab_focus, bool is_down)
     {
         ListBoxRow? selected_row = key_list_box.get_selected_row ();


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