[dconf-editor] Make ClickableListBoxRow an abstract class.



commit 7f66f96eb20ea80cf9e6a5e45ece27daa9794221
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Apr 29 20:19:14 2016 +0200

    Make ClickableListBoxRow an abstract class.

 editor/folder-list-box-row.ui |    2 +-
 editor/key-list-box-row.ui    |    2 +-
 editor/key-list-box-row.vala  |   64 +++++++++++++++++++++-------------------
 3 files changed, 36 insertions(+), 32 deletions(-)
---
diff --git a/editor/folder-list-box-row.ui b/editor/folder-list-box-row.ui
index dbb1e78..4a7aab5 100644
--- a/editor/folder-list-box-row.ui
+++ b/editor/folder-list-box-row.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <template class="FolderListBoxRow" parent="GtkEventBox">
+  <template class="FolderListBoxRow" parent="ClickableListBoxRow">
     <property name="visible">True</property>
     <style>
       <class name="folder"/>
diff --git a/editor/key-list-box-row.ui b/editor/key-list-box-row.ui
index 2056bf9..e2bfa59 100644
--- a/editor/key-list-box-row.ui
+++ b/editor/key-list-box-row.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <template class="KeyListBoxRow" parent="GtkEventBox">
+  <template class="KeyListBoxRow" parent="ClickableListBoxRow">
     <child>
       <object class="GtkGrid">
         <property name="visible">True</property>
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 0cc6e78..71fe0f8 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -17,37 +17,15 @@
 
 using Gtk;
 
-private interface ClickableListBoxRow : Object
+private abstract class ClickableListBoxRow : EventBox
 {
     public signal void on_row_clicked ();
 
     public abstract string get_text ();
-}
-
-[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/folder-list-box-row.ui")]
-private class FolderListBoxRow : EventBox, ClickableListBoxRow
-{
-    [GtkChild] private Label folder_name_label;
-    private string full_name;
-
-    public FolderListBoxRow (string label, string path)
-    {
-        folder_name_label.set_text (label);
-        full_name = path;
-    }
 
-    public string get_text ()
-    {
-        return full_name;
-    }
-}
-
-[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/key-list-box-row.ui")]
-private abstract class KeyListBoxRow : EventBox
-{
-    [GtkChild] protected Label key_name_label;
-    [GtkChild] protected Label key_value_label;
-    [GtkChild] protected Label key_info_label;
+    /*\
+    * * right click popover stuff
+    \*/
 
     protected ContextPopover? nullable_popover;
     protected virtual bool generate_popover (ContextPopover popover) { return false; }      // no popover 
should be created
@@ -72,6 +50,32 @@ private abstract class KeyListBoxRow : EventBox
 
         return false;
     }
+}
+
+[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/folder-list-box-row.ui")]
+private class FolderListBoxRow : ClickableListBoxRow
+{
+    [GtkChild] private Label folder_name_label;
+    private string full_name;
+
+    public FolderListBoxRow (string label, string path)
+    {
+        folder_name_label.set_text (label);
+        full_name = path;
+    }
+
+    public override string get_text ()
+    {
+        return full_name;
+    }
+}
+
+[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/key-list-box-row.ui")]
+private abstract class KeyListBoxRow : ClickableListBoxRow
+{
+    [GtkChild] protected Label key_name_label;
+    [GtkChild] protected Label key_value_label;
+    [GtkChild] protected Label key_info_label;
 
     protected static string cool_text_value (Key key)   // TODO better
     {
@@ -79,7 +83,7 @@ private abstract class KeyListBoxRow : EventBox
     }
 }
 
-private class KeyListBoxRowEditableNoSchema : KeyListBoxRow, ClickableListBoxRow
+private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
 {
     public DConfKey key { get; private set; }
 
@@ -103,7 +107,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow, ClickableListBoxRow
             });
     }
 
-    protected string get_text ()
+    protected override string get_text ()
     {
         return key.full_name + " " + key.value.print (false);
     }
@@ -128,7 +132,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow, ClickableListBoxRow
     }
 }
 
-private class KeyListBoxRowEditable : KeyListBoxRow, ClickableListBoxRow
+private class KeyListBoxRowEditable : KeyListBoxRow
 {
     public GSettingsKey key { get; private set; }
 
@@ -150,7 +154,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow, ClickableListBoxRow
             });
     }
 
-    protected string get_text ()
+    protected override string get_text ()
     {
         return key.schema_id + " " + key.name + " " + key.value.print (false);
     }


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