[dconf-editor] Improve paths search.



commit ae065d0dfdba9f29ba926805942ca72153440f7b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Nov 28 17:59:58 2018 +0100

    Improve paths search.

 editor/dconf-window.vala     | 11 +++++++++++
 editor/key-list-box-row.vala |  6 ++++--
 editor/registry-list.vala    | 13 ++++++++-----
 3 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index d5b5654..ee18ed3 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -490,6 +490,7 @@ private class DConfWindow : AdaptativeWindow, AdaptativeWidget
         { "open-object", open_object, "(sq)" },
         { "open-config", open_config, "s" },
         { "open-search", open_search, "s" },
+        { "next-search", next_search, "s" },
         { "open-parent", open_parent, "s" },
 
         { "open-path", open_path, "(sq)", "('/',uint16 " + ModelUtils.folder_context_id_string + ")" },
@@ -597,6 +598,15 @@ private class DConfWindow : AdaptativeWindow, AdaptativeWidget
         request_search (true, PathEntry.SearchMode.EDIT_PATH_SELECT_ALL, search);
     }
 
+    private void next_search (SimpleAction action, Variant? search_variant)
+        requires (search_variant != null)
+    {
+        saved_type = ViewType.FOLDER;
+        saved_view = ((!) search_variant).get_string ();
+
+        request_search (true, PathEntry.SearchMode.EDIT_PATH_MOVE_END, saved_view);
+    }
+
     private void open_parent (SimpleAction action, Variant? path_variant)
         requires (path_variant != null)
     {
@@ -1449,6 +1459,7 @@ private class DConfWindow : AdaptativeWindow, AdaptativeWidget
         {
             saved_type = type;
             saved_view = path;
+            reload_search_next = true;
         }
         else if (current_type == ViewType.FOLDER)
             saved_selection = browser_view.get_selected_row_name ();
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index d40f762..5a48124 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -123,9 +123,11 @@ private class FolderListBoxRow : ClickableListBoxRow
 {
     [GtkChild] private Label folder_name_label;
 
-    internal FolderListBoxRow (string label, string path, bool search_result_mode)
+    public bool path_search { internal get; internal construct; }
+
+    internal FolderListBoxRow (string label, string path, bool path_search, bool search_result_mode)
     {
-        Object (full_name: path, context_id: ModelUtils.folder_context_id, search_result_mode: 
search_result_mode);
+        Object (full_name: path, context_id: ModelUtils.folder_context_id, path_search: path_search, 
search_result_mode: search_result_mode);
         folder_name_label.set_text (search_result_mode ? path : label);
     }
 }
diff --git a/editor/registry-list.vala b/editor/registry-list.vala
index 18df310..9fdba45 100644
--- a/editor/registry-list.vala
+++ b/editor/registry-list.vala
@@ -415,9 +415,7 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
 
         if (search_mode && current_path_if_search_mode == null)
             assert_not_reached ();
-        bool search_mode_non_local_result = search_mode
-                                         && (search_is_path_search
-                                          || ModelUtils.get_parent_path (full_name) != (!) 
current_path_if_search_mode);
+        bool search_mode_non_local_result = search_mode && ModelUtils.get_parent_path (full_name) != (!) 
current_path_if_search_mode;
 
         if (setting_object.is_config)
         {
@@ -429,7 +427,7 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
         }
         else if (ModelUtils.is_folder_context_id (context_id))
         {
-            row = new FolderListBoxRow (setting_object.name, full_name, search_mode_non_local_result);
+            row = new FolderListBoxRow (setting_object.name, full_name, search_mode && 
search_is_path_search, search_mode_non_local_result);
         }
         else if (setting_object.is_search)
         {
@@ -560,7 +558,12 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
         {
             wrapper.get_style_context ().add_class ("f-or-s-row");
             if (row is FolderListBoxRow)
-                wrapper.action_name = "ui.open-folder";
+            {
+                if (((FolderListBoxRow) row).path_search)
+                    wrapper.action_name = "ui.next-search";
+                else
+                    wrapper.action_name = "ui.open-folder";
+            }
             else if (row is ConfigListBoxRow)
                 wrapper.action_name = "ui.open-config";
             else assert_not_reached ();


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