[dconf-editor] Special case root for search, part 1.



commit 428cdb32f21eda31abb410cc0617eae7edee7238
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Jan 5 14:20:05 2019 +0100

    Special case root for search, part 1.
    
    The root path does not have a "local search" functionality, as
    that would be similar to the "global search" and so, confusing
    as hell. Instead, use an "Open path entry" functionality for a
    better discoverability of this function (part 1), and make the
    search buttons open for there the search entry empty (part 2).

 editor/browser-window.vala   | 9 +++++++++
 editor/key-list-box-row.vala | 4 ++++
 editor/registry-list.vala    | 2 ++
 3 files changed, 15 insertions(+)
---
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index d568818..eb70c20 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -87,6 +87,7 @@ private abstract class BrowserWindow : BaseWindow
         { "open-search",        open_search, "s" },
         { "open-search-local",  open_search_local },
         { "open-search-global", open_search_global },
+        { "open-search-root",   open_search_root },
         { "next-search",        next_search, "s" },
         { "open-parent",        open_parent, "s" },
 
@@ -172,6 +173,14 @@ private abstract class BrowserWindow : BaseWindow
         request_search ();
     }
 
+    private void open_search_root (/* SimpleAction action, Variant? search_variant */)
+    {
+        close_in_window_panels ();
+
+        init_next_search = true;
+        request_search (PathEntry.SearchMode.EDIT_PATH_MOVE_END, "/");
+    }
+
     private void next_search (SimpleAction action, Variant? search_variant)
         requires (search_variant != null)
     {
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 57de8a9..9c71648 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -148,6 +148,10 @@ private class FilterListBoxRow : ClickableListBoxRow
             /* Translators: first item of the keys list displayed during browsing, the %s is the current 
folder name */
             folder_name_label.set_text (_("Search in ā€œ%sā€ folder").printf (name));
 
+        else if (path == "/")
+            /* Translators: first item of the keys list displayed during browsing at root path */
+            folder_name_label.set_text (_("Open path entry"));
+
         else
             /* Translators: last item of the keys list displayed during a local search */
             folder_name_label.set_text (_("Search everywhere"));
diff --git a/editor/registry-list.vala b/editor/registry-list.vala
index 1fbb2f1..5e38392 100644
--- a/editor/registry-list.vala
+++ b/editor/registry-list.vala
@@ -554,6 +554,8 @@ private abstract class RegistryList : Grid, BrowsableView, AdaptativeWidget
             wrapper.get_style_context ().add_class ("f-or-s-row");
             if (((FilterListBoxRow) row).is_local_search)
                 wrapper.action_name = "browser.open-search-local";
+            else if (row.full_name == "/")
+                wrapper.action_name = "browser.open-search-root";
             else
                 wrapper.action_name = "browser.open-search-global";
         }


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