[dconf-editor] Allow search to access key path.



commit bf41cfd83bc083b50608421c9d83fef0355b7caa
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Jul 9 01:28:46 2016 +0200

    Allow search to access key path.

 editor/dconf-window.vala  |    1 +
 editor/registry-view.ui   |    1 -
 editor/registry-view.vala |   44 +++++++++++++++++++++++++++++---------------
 3 files changed, 30 insertions(+), 16 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 6bfda84..ebd1516 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -172,6 +172,7 @@ class DConfWindow : ApplicationWindow
     [GtkCallback]
     private bool scroll_to_path (string full_name)
     {
+        registry_view.set_search_mode (false);
         return registry_view.scroll_to_path (full_name);
     }
 
diff --git a/editor/registry-view.ui b/editor/registry-view.ui
index 39cfd2c..8bc0528 100644
--- a/editor/registry-view.ui
+++ b/editor/registry-view.ui
@@ -18,7 +18,6 @@
         <property name="visible">True</property>
         <property name="search-mode-enabled">False</property>
         <property name="show-close-button">False</property>
-        <signal name="notify::search-mode-enabled" handler="show_browse_view"/>
         <child>
           <object class="GtkGrid">
             <property name="visible">True</property>
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 9a16f6d..855ab10 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -119,7 +119,7 @@ class RegistryView : Grid
         if (full_name == folder_name)
         {
             update_current_path (full_name);
-            show_browse_view ();
+            stack.set_visible_child_name ("browse-view");
         }
         else
         {
@@ -128,7 +128,7 @@ class RegistryView : Grid
             if (key == null)
             {
                 update_current_path (folder_name);
-                show_browse_view ();
+                stack.set_visible_child_name ("browse-view");
                 empty_path_message_dialog ((Window) this.get_parent ());
                 return false;
             }
@@ -334,13 +334,6 @@ class RegistryView : Grid
     * * Search box
     \*/
 
-    [GtkCallback]
-    private void show_browse_view ()    // TODO remove when search is available also in properties-view
-    {
-        if (stack.get_visible_child_name () != "browse-view")
-            stack.set_visible_child_name ("browse-view");
-    }
-
     public void set_search_mode (bool? mode)    // mode is never 'true'...
     {
         if (mode == null)
@@ -414,8 +407,12 @@ class RegistryView : Grid
 
             if (!on_first_directory && dir.name.index_of (search_entry.text) >= 0)
             {
-                update_current_path (dir.full_name);
                 dir_tree_selection.select_iter (iter);
+                update_current_path (dir.full_name);
+
+                enable_transition (false);
+                stack.set_visible_child_name ("browse-view");
+                enable_transition (true);
                 return;
             }
             on_first_directory = false;
@@ -425,15 +422,32 @@ class RegistryView : Grid
             while (position < key_model.get_n_items ())
             {
                 SettingObject object = (SettingObject) key_model.get_object (position);
-                if (object.name.index_of (search_entry.text) >= 0 || 
-                    (!object.is_view && key_matches ((Key) object, search_entry.text)))
+                if (object.name.index_of (search_entry.text) >= 0)
                 {
-                    update_current_path (dir.full_name);
                     dir_tree_selection.select_iter (iter);
-                    key_list_box.select_row (key_list_box.get_row_at_index (position));
-                    // TODO select key in ListBox
+                    update_current_path (dir.full_name);
+                    key_list_box.select_row (key_list_box.get_row_at_index (position)); // TODO scroll to 
key in ListBox
+
+                    enable_transition (false);
+                    stack.set_visible_child_name ("browse-view");
+                    enable_transition (true);
                     return;
                 }
+                else if (!object.is_view)
+                {
+                    Key key = (Key) object;
+                    if (key_matches (key, search_entry.text) && properties_view.populate_properties_list_box 
(revealer, key))
+                    {
+                        dir_tree_selection.select_iter (iter);
+                        update_current_path (object.full_name);
+                        key_list_box.select_row (key_list_box.get_row_at_index (position));
+
+                        enable_transition (false);
+                        stack.set_visible_child (properties_view);
+                        enable_transition (true);
+                        return;
+                    }
+                }
                 position++;
             }
 


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