[gitg/wip/sindhus/interactive-rebase] Convert git-rebase-window.vala into template
- From: Sindhu Sundar <sindhus src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/sindhus/interactive-rebase] Convert git-rebase-window.vala into template
- Date: Fri, 13 Sep 2013 13:05:59 +0000 (UTC)
commit ceae3d8a894c8fcb84a1ea2b970603e4e4edc0c5
Author: Sindhu S <sindhus live in>
Date: Fri Sep 13 18:35:10 2013 +0530
Convert git-rebase-window.vala into template
gitg/gitg-rebase-window.vala | 74 ++++++++++++++++-----------------
gitg/resources/gitg-rebase-window.ui | 7 +--
2 files changed, 39 insertions(+), 42 deletions(-)
---
diff --git a/gitg/gitg-rebase-window.vala b/gitg/gitg-rebase-window.vala
index d0ef657..8fc475b 100644
--- a/gitg/gitg-rebase-window.vala
+++ b/gitg/gitg-rebase-window.vala
@@ -19,52 +19,50 @@
namespace Gitg
{
+ [GtkTemplate (ui = "/org/gnome/gitg/gtk/gitg-rebase-window.ui")]
+ public class RebaseWindow : Gtk.Window
+ {
+ [GtkChild (name = "rebase_listbox")]
+ private RebaseListBox r_rebase_list_box;
-public class RebaseWindow : Gtk.Window
-{
- private RebaseListBox r_rebase_list_box;
- private string r_filepath;
+ [GtkChild (name = "start_rebase_button")]
+ private Gtk.Button r_rebase_start_button;
- public RebaseWindow()
- {
- this.title = "gitg Rebase";
- destroy.connect (Gtk.main_quit);
- r_rebase_list_box = new RebaseListBox();
- var hbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 1);
- hbox.homogeneous = true;
- hbox.add (r_rebase_list_box);
- var start_button = new Gtk.Button();
- start_button.label = "Start Rebase";
- start_button.clicked.connect(start_rebase);
- hbox.add(start_button);
- add (hbox);
- }
+ [GtkChild (name = "abort_rebase_button")]
+ private Gtk.Button r_rebase_abort_button;
- public void load_rebase_todo(string filepath)
- {
- r_filepath = filepath;
- var parser = new RebaseParser();
- var rebase_array = parser.parse_rebase_todo(r_filepath);
- foreach (var rebase_row in rebase_array)
+ private string r_filepath;
+ public RebaseWindow()
{
- r_rebase_list_box.add_rebase_row(rebase_row[0], rebase_row[1], rebase_row[2]);
+ destroy.connect (Gtk.main_quit);
+ r_rebase_start_button.clicked.connect(start_rebase);
}
- }
- private void start_rebase()
- {
- var parser = new RebaseParser();
- var rebase_array = r_rebase_list_box.get_rebase_array();
- string rebase_output = "";
- rebase_output = parser.generate_rebase_todo(rebase_array);
- stdout.printf("\nrebase_output: \n%s", rebase_output);
- try
+ public void load_rebase_todo(string filepath)
+ {
+ r_filepath = filepath;
+ var parser = new RebaseParser();
+ var rebase_array = parser.parse_rebase_todo(r_filepath);
+ foreach (var rebase_row in rebase_array)
+ {
+ r_rebase_list_box.add_rebase_row(rebase_row[0], rebase_row[1], rebase_row[2]);
+ }
+ }
+
+ private void start_rebase()
{
- FileUtils.set_contents(r_filepath, rebase_output);
+ var parser = new RebaseParser();
+ var rebase_array = r_rebase_list_box.get_rebase_array();
+ string rebase_output = "";
+ rebase_output = parser.generate_rebase_todo(rebase_array);
+ stdout.printf("\nrebase_output: \n%s", rebase_output);
+ try
+ {
+ FileUtils.set_contents(r_filepath, rebase_output);
+ }
+ catch {}
+ destroy();
}
- catch {}
- destroy();
}
-}
}
\ No newline at end of file
diff --git a/gitg/resources/gitg-rebase-window.ui b/gitg/resources/gitg-rebase-window.ui
index 0f31f8b..761eca8 100644
--- a/gitg/resources/gitg-rebase-window.ui
+++ b/gitg/resources/gitg-rebase-window.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="GitgRebaseWindow" 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="GitgRebaseListBox" id="rebase_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">True</property>
@@ -77,5 +76,5 @@
</child>
</object>
</child>
- </object>
+ </template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]