[dconf-editor] SearchEntry focus fix.



commit 184a5adb4eb4faf7d5d80af28d94cf370d28c39c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Dec 11 07:18:43 2017 +0100

    SearchEntry focus fix.

 editor/dconf-window.vala     |    7 +++++++
 editor/key-list-box-row.vala |    3 +++
 editor/registry-search.vala  |    2 ++
 3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index cac79da..3a76702 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -415,6 +415,13 @@ class DConfWindow : ApplicationWindow
     * * Search
     \*/
 
+    public void select_search_entry ()
+    {
+        if (!browser_view.current_view_is_search_results_view ())
+            return;
+        search_entry.grab_focus_without_selecting ();
+    }
+
     [GtkCallback]
     private void search_changed ()
     {
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 6a96e06..9420b48 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -70,6 +70,7 @@ private abstract class ClickableListBoxRow : EventBox
     public signal void on_row_clicked ();
     public signal void on_open_parent ();
     public signal void on_delete_call ();
+    public signal void on_popover_disappear ();
 
     public abstract string get_text ();
 
@@ -105,6 +106,7 @@ private abstract class ClickableListBoxRow : EventBox
     {
         if (nullable_popover != null)       // check sometimes not useful
             ((!) nullable_popover).destroy ();
+        on_popover_disappear ();
     }
 
     public void hide_right_click_popover ()
@@ -130,6 +132,7 @@ private abstract class ClickableListBoxRow : EventBox
                 return;
             }
 
+            ((!) nullable_popover).closed.connect (() => on_popover_disappear ());
             ((!) nullable_popover).destroy.connect (() => nullable_popover = null);
 
             ((!) nullable_popover).set_relative_to (this);
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 117aef3..b2404a4 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -218,6 +218,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
             }
 
             row.show_right_click_popover (modifications_handler, event_x);
+            row.on_popover_disappear.connect (window.select_search_entry);
             rows_possibly_with_popover.append (row);
         }
 
@@ -309,6 +310,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
 
         ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
         row.show_right_click_popover (modifications_handler);
+        row.on_popover_disappear.connect (window.select_search_entry);
         rows_possibly_with_popover.append (row);
         return true;
     }


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