[dconf-editor] Handle search_bar visibility in RegistryView only.



commit 79568937048e11c431c2d9c587fdd96de258c6fc
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Jun 19 19:01:40 2016 +0200

    Handle search_bar visibility in RegistryView only.

 editor/dconf-editor.ui    |    2 +-
 editor/dconf-window.vala  |    6 +++---
 editor/registry-view.vala |   15 ++++++++++++++-
 3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 001996f..4a3b4ac 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -60,7 +60,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToggleButton" id="search_button">
+          <object class="GtkToggleButton">
             <property name="visible">True</property>
             <property name="valign">center</property>
             <!-- TODO <property name="focus-on-click">False</property> does not work here because of 
explicit focus grab -->
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 7be28da..79ec304 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -228,7 +228,7 @@ class DConfWindow : ApplicationWindow
                     if (info_button.active)
                         info_button.active = false;
                     registry_view.discard_row_popover ();
-                    registry_view.search_bar.set_search_mode (!registry_view.search_bar.get_search_mode ());
+                    registry_view.set_search_mode (null);
                     return true;
                 case "c":
                     registry_view.discard_row_popover (); // TODO avoid duplicate get_selected_row () call
@@ -282,13 +282,13 @@ class DConfWindow : ApplicationWindow
         if (bookmarks_button.active || info_button.active)      // TODO open bug about modal popovers and 
search_bar
             return false;
 
-        return registry_view.search_bar.handle_event (event);
+        return registry_view.handle_search_event (event);
     }
 
     [GtkCallback]
     private void on_menu_button_clicked ()
     {
         registry_view.discard_row_popover ();
-        registry_view.search_bar.set_search_mode (false);
+        registry_view.set_search_mode (false);
     }
 }
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 294a661..e497e23 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -35,7 +35,7 @@ class RegistryView : Grid
 
     [GtkChild] private ModificationsRevealer revealer;
 
-    [GtkChild] public SearchBar search_bar;
+    [GtkChild] private SearchBar search_bar;
     [GtkChild] private SearchEntry search_entry;
     [GtkChild] private Button search_next_button;
 
@@ -372,6 +372,19 @@ class RegistryView : Grid
     * * Search box
     \*/
 
+    public void set_search_mode (bool? mode)
+    {
+        if (mode == null)
+            search_bar.set_search_mode (!search_bar.get_search_mode ());
+        else
+            search_bar.set_search_mode ((!) mode);
+    }
+
+    public bool handle_search_event (Gdk.EventKey event)
+    {
+        return search_bar.handle_event (event);
+    }
+
     public bool show_row_popover ()
     {
         ListBoxRow? selected_row = (ListBoxRow) key_list_box.get_selected_row ();


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