[dconf-editor] Use GAction in PathBar.



commit f6d8293cbe4d46759ba639d5848645d017d51615
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Jan 7 07:40:53 2018 +0100

    Use GAction in PathBar.

 editor/dconf-editor.ui   |    1 -
 editor/dconf-window.vala |   15 +++++++++++----
 editor/pathbar.vala      |   19 ++-----------------
 3 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index c618f7e..91a47be 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -97,7 +97,6 @@
             <property name="visible">True</property>
             <property name="hexpand">True</property>
             <property name="valign">center</property>
-            <signal name="request_path" handler="request_path"/>
           </object>
           <packing>
             <property name="pack-type">start</property>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index a46cc8e..bbec383 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -623,14 +623,21 @@ class DConfWindow : ApplicationWindow
         else
             request_path (SettingsModel.get_parent_path (current_path));
     }
-    // TODO do something when open_child fails (returns false)?
     private void go_forward (bool shift)
     {
+        string complete_path = pathbar.complete_path;
+
         browser_view.discard_row_popover ();
         if (shift)
-            pathbar.open_child (null);
-        else
-            pathbar.open_child (current_path);
+        {
+            request_path (complete_path);
+            return;
+        }
+        if (current_path == complete_path)
+            return;
+
+        int index_of_last_slash = complete_path.index_of ("/", ((!) current_path).length);
+        request_path (index_of_last_slash == -1 ? complete_path : complete_path.slice (0, 
index_of_last_slash + 1));
     }
 
     /*\
diff --git a/editor/pathbar.vala b/editor/pathbar.vala
index 750ee31..e4681ff 100644
--- a/editor/pathbar.vala
+++ b/editor/pathbar.vala
@@ -18,13 +18,12 @@
 using Gtk;
 
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/pathbar.ui")]
-public class PathBar : Box, PathElement
+public class PathBar : Box
 {
     [GtkChild] private PathBarItem root_button;
 
     public SettingsModel model { private get; set; }
-
-    private string complete_path = "";
+    public string complete_path { get; private set; default = ""; }
 
     construct
     {
@@ -130,20 +129,6 @@ public class PathBar : Box, PathElement
         show_all ();
     }
 
-    public bool open_child (string? current_path)
-    {
-        if (current_path == null)
-        {
-            request_path (complete_path);
-            return true;
-        }
-        if (current_path == complete_path)
-            return false;
-        int index_of_last_slash = complete_path.index_of ("/", ((!) current_path).length);
-        request_path (index_of_last_slash == -1 ? complete_path : complete_path.slice (0, 
index_of_last_slash + 1));
-        return true;
-    }
-
     public string? get_selected_child (string current_path)
     {
         if (!complete_path.has_prefix (current_path) || complete_path == current_path)


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