[gitg/wip/sindhus/interactive-rebase] Convert to template gitg-rebase-commit-editor-window.vala



commit edf94be9c9e1514dfab03cc66ba1a556e8c43308
Author: Sindhu S <sindhus live in>
Date:   Fri Sep 13 18:51:00 2013 +0530

    Convert to template gitg-rebase-commit-editor-window.vala

 gitg/gitg-rebase-commit-editor-window.vala  |   21 +++++++++++----------
 gitg/resources/gitg-rebase-commit-editor.ui |   11 +++++------
 gitg/resources/gitg-rebase-window.ui        |    2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/gitg/gitg-rebase-commit-editor-window.vala b/gitg/gitg-rebase-commit-editor-window.vala
index e4bd4c0..4e27ffb 100644
--- a/gitg/gitg-rebase-commit-editor-window.vala
+++ b/gitg/gitg-rebase-commit-editor-window.vala
@@ -19,24 +19,24 @@
 
 namespace Gitg
 {
+       [GtkTemplate (ui = "/org/gnome/gitg/gtk/gitg-rebase-commit-editor.ui")]
        public class RebaseCommitEditorWindow : Gtk.Window
        {
+               [GtkChild (name = "commit_editor")]
                private GtkSource.View r_commit_editor;
+
+               [GtkChild (name = "continue_rebase_button")]
+               private Gtk.Button r_rebase_continue_button;
+
+               [GtkChild (name = "abort_rebase_button")]
+               private Gtk.Button r_rebase_abort_button;
+
                private string r_filepath;
 
                public RebaseCommitEditorWindow()
                {
-                       this.title = "Rebase Commit Editor";
                        destroy.connect (Gtk.main_quit);
-                       r_commit_editor = new GtkSource.View();
-                       var hbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 1);
-                       hbox.homogeneous = true;
-                       hbox.add (r_commit_editor);
-                       var save_button = new Gtk.Button();
-                       save_button.label = "Save and load next...";
-                       save_button.clicked.connect(save_and_continue);
-                       hbox.add(save_button);
-                       add (hbox);
+                       r_rebase_continue_button.clicked.connect(save_and_continue);
                }
 
                public void load_commit_file(string filename)
@@ -49,6 +49,7 @@ namespace Gitg
                                FileUtils.get_contents(filename, out contents);
                        }
                        catch {}
+
                        r_commit_editor.buffer.set_text(contents);
                }
 
diff --git a/gitg/resources/gitg-rebase-commit-editor.ui b/gitg/resources/gitg-rebase-commit-editor.ui
index 15315fb..4c74c5e 100644
--- a/gitg/resources/gitg-rebase-commit-editor.ui
+++ b/gitg/resources/gitg-rebase-commit-editor.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkWindow" id="rebase_editor_window">
+  <template class="GitgRebaseCommitEditorWindow" parent="Gtk.Window">
     <property name="can_focus">False</property>
     <child>
       <object class="GtkBox" id="rebase_container">
@@ -24,10 +24,9 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="rebase_listbox">
+          <object class="GtkSourceView" id="commit_editor">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">label</property>
+            <property name="can_focus">True</property>
           </object>
           <packing>
             <property name="expand">True</property>
@@ -56,7 +55,7 @@
             </child>
             <child>
               <object class="GtkButton" id="continue_rebase_button">
-                <property name="label" translatable="yes">Start Rebase</property>
+                <property name="label" translatable="yes">Save and load next...</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="receives_default">True</property>
@@ -77,5 +76,5 @@
         </child>
       </object>
     </child>
-  </object>
+  </template>
 </interface>
diff --git a/gitg/resources/gitg-rebase-window.ui b/gitg/resources/gitg-rebase-window.ui
index 761eca8..c40f66d 100644
--- a/gitg/resources/gitg-rebase-window.ui
+++ b/gitg/resources/gitg-rebase-window.ui
@@ -26,7 +26,7 @@
         <child>
           <object class="GitgRebaseListBox" id="rebase_listbox">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can_focus">True</property>
           </object>
           <packing>
             <property name="expand">True</property>


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