[dconf-editor] Do not save current_path in DConfHeaderBar.



commit 718237d88ace315c31610f9f853bd78ef273a212
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jan 10 20:23:46 2019 +0100

    Do not save current_path in DConfHeaderBar.
    
    Let's just keep there the useful informations.

 editor/dconf-headerbar.vala | 12 ++++--------
 editor/dconf-window.vala    | 22 +++++++++++++---------
 2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/editor/dconf-headerbar.vala b/editor/dconf-headerbar.vala
index e0dfaa9..8503753 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -154,12 +154,10 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
     \*/
 
     private bool is_folder_view = true;
-    private string current_path = "/";
 
     internal override void set_path (ViewType type, string path)
     {
         is_folder_view = type == ViewType.FOLDER;
-        current_path = path;
 
         base.set_path (type, path);
     }
@@ -180,10 +178,10 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
     {
         base.populate_menu (ref menu);
 
-        append_or_not_delay_mode_section (delay_mode, is_folder_view, current_path, ref menu);
+        append_or_not_delay_mode_section (delay_mode, is_folder_view, ref menu);
     }
 
-    private static void append_or_not_delay_mode_section (bool delay_mode, bool is_folder_view, string 
current_path, ref GLib.Menu menu)
+    private static void append_or_not_delay_mode_section (bool delay_mode, bool is_folder_view, ref 
GLib.Menu menu)
     {
         if (delay_mode && !is_folder_view)
             return;
@@ -194,13 +192,11 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
             section.append (_("Enter delay mode"), "ui.enter-delay-mode");
         if (is_folder_view)
         {
-            Variant variant = new Variant.string (current_path);
-
             /* Translators: hamburger menu entry that appears when browsing a folder path, to set to their 
default value all currently visible keys, not including keys in subfolders */
-            section.append (_("Reset visible keys"), "ui.reset-visible(" + variant.print (false) + ")");
+            section.append (_("Reset visible keys"), "ui.reset-current-non-recursively");
 
             /* Translators: hamburger menu entry that appears when browsing a folder path, to set to their 
default value all currently visible keys, and all keys in subfolders */
-            section.append (_("Reset view recursively"), "ui.reset-recursive(" + variant.print (false) + 
")");
+            section.append (_("Reset view recursively"), "ui.reset-current-recursively");
         }
         section.freeze ();
         menu.append_section (null, section);
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 52965ac..8286d02 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -423,18 +423,18 @@ private class DConfWindow : BrowserWindow
 
     private const GLib.ActionEntry [] ui_action_entries =
     {
-        { "reset-recursive", reset_recursively, "s" },
-        { "reset-visible", reset_visible, "s" },
+        { "reset-recursive",                reset_recursively, "s" },
+        { "reset-current-recursively",      reset_current_recursively },
+        { "reset-current-non-recursively",  reset_current_non_recursively },
 
-        { "enter-delay-mode", enter_delay_mode },
-        { "apply-delayed-settings", apply_delayed_settings },
-        { "dismiss-delayed-settings", dismiss_delayed_settings },
+        { "enter-delay-mode",           enter_delay_mode },
+        { "apply-delayed-settings",     apply_delayed_settings },
+        { "dismiss-delayed-settings",   dismiss_delayed_settings },
 
         { "dismiss-change", dismiss_change, "s" },  // here because needs to be accessed from 
DelayedSettingView rows
         { "erase", erase_dconf_key, "s" },          // here because needs a reload_view as we enter 
delay_mode
 
         { "show-in-window-bookmarks",       show_use_bookmarks_view },
-
         { "show-in-window-modifications",   show_modifications_view },
 
         { "update-bookmarks-icons", update_bookmarks_icons, "as" },
@@ -449,10 +449,14 @@ private class DConfWindow : BrowserWindow
         reset_path (((!) path_variant).get_string (), true);
     }
 
-    private void reset_visible (SimpleAction action, Variant? path_variant)
-        requires (path_variant != null)
+    private void reset_current_recursively (/* SimpleAction action, Variant? path_variant */)
+    {
+        reset_path (current_path, true);
+    }
+
+    private void reset_current_non_recursively (/* SimpleAction action, Variant? path_variant */)
     {
-        reset_path (((!) path_variant).get_string (), false);
+        reset_path (current_path, false);
     }
 
     private void reset_path (string path, bool recursively)


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