[gitg] Sepearate header row ui into template



commit 31ab3205171361a92581ec9767e9737a16a270c4
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Jul 12 11:55:25 2014 +0200

    Sepearate header row ui into template

 gitg/history/gitg-history-refs-list.vala     |   13 +++----------
 gitg/resources/gitg-resources.xml            |    1 +
 gitg/resources/ui/gitg-history-ref-header.ui |   22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index ff60a4d..d1b5e38 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -316,11 +316,14 @@ private class RefRow : RefTyped, Gtk.ListBoxRow
        }
 }
 
+[GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-history-ref-header.ui")]
 private class RefHeader : RefTyped, Gtk.ListBoxRow
 {
        private Gitg.RefType d_rtype;
        private bool d_is_sub_header_remote;
        private string d_name;
+
+       [GtkChild]
        private Gtk.Label d_label;
 
        public Gitg.RefType ref_type
@@ -335,22 +338,12 @@ private class RefHeader : RefTyped, Gtk.ListBoxRow
 
        public RefHeader(Gitg.RefType rtype, string name)
        {
-               d_label = new Gtk.Label(null);
-               d_label.show();
-
-               add(d_label);
-
                var escaped = Markup.escape_text(name);
 
                d_label.set_markup(@"<b>$escaped</b>");
-               d_label.halign = Gtk.Align.START;
 
                d_name = name;
                d_rtype = rtype;
-
-               d_label.margin_top = 3;
-               d_label.margin_bottom = 3;
-               d_label.margin_start = 16;
        }
 
        public RefHeader.remote(string name)
diff --git a/gitg/resources/gitg-resources.xml b/gitg/resources/gitg-resources.xml
index eefd833..45b29a9 100644
--- a/gitg/resources/gitg-resources.xml
+++ b/gitg/resources/gitg-resources.xml
@@ -13,6 +13,7 @@
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-author-details-dialog.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-history-paned.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-history-ref-row.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-history-ref-header.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-commit-paned.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-commit-dialog.ui</file>
     <file compressed="true">ui/style.css</file>
diff --git a/gitg/resources/ui/gitg-history-ref-header.ui b/gitg/resources/ui/gitg-history-ref-header.ui
new file mode 100644
index 0000000..ddd3cdf
--- /dev/null
+++ b/gitg/resources/ui/gitg-history-ref-header.ui
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.3 -->
+  <!-- interface-requires gitg 0.0 -->
+  <!-- interface-requires gd 1.0 -->
+  <template class="GitgHistoryRefHeader" parent="GtkListBoxRow">
+    <property name="visible">True</property>
+    <style>
+      <class name="sidebar"/>
+    </style>
+    <child>
+      <object class="GtkLabel" id="d_label">
+        <property name="visible">True</property>
+        <property name="margin_top">3</property>
+        <property name="margin_bottom">3</property>
+        <property name="margin_start">16</property>
+        <property name="halign">start</property>
+      </object>
+    </child>
+  </template>
+</interface>
+<!-- vi:ts=2:et -->


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