[dconf-editor] Simplify PathBarItem code.



commit 8b4363fa8b330f9e846eb56db6167eb764a29d12
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Jun 27 01:37:19 2016 +0200

    Simplify PathBarItem code.

 editor/pathbar-item.ui |    1 -
 editor/pathbar.vala    |   14 ++------------
 2 files changed, 2 insertions(+), 13 deletions(-)
---
diff --git a/editor/pathbar-item.ui b/editor/pathbar-item.ui
index a5e5066..dc43202 100644
--- a/editor/pathbar-item.ui
+++ b/editor/pathbar-item.ui
@@ -2,7 +2,6 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <template class="PathBarItem" parent="GtkButton">
-    <signal name="clicked" handler="on_path_bar_item_clicked"/>
     <child>
       <object class="GtkLabel" id="text">
         <property name="visible">True</property>
diff --git a/editor/pathbar.vala b/editor/pathbar.vala
index 24eeb53..a864384 100644
--- a/editor/pathbar.vala
+++ b/editor/pathbar.vala
@@ -73,22 +73,12 @@ public class PathBar : Box
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/pathbar-item.ui")]
 private class PathBarItem : Button
 {
-    public string complete_path { get; construct; }
-    private bool is_clickable;
-
     [GtkChild] private Label text;
 
-    public PathBarItem (string label, string path, bool _is_clickable)
+    public PathBarItem (string label, string path, bool is_clickable)
     {
-        Object (complete_path: path);
         text.set_text (label);
-        is_clickable = _is_clickable;
-    }
-
-    [GtkCallback]
-    private void on_path_bar_item_clicked ()
-    {
         if (is_clickable)
-            ((PathBar) get_parent ()).set_path (complete_path, true);
+            clicked.connect (() => { ((PathBar) get_parent ()).set_path (path, true); });
     }
 }


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