[gitg/wip/sindhus/interactive-rebase] Create new rebase start dialog



commit 07f5bc47854fc9ad4c07f91f1f725f2ed503fff9
Author: Sindhu S <sindhus live in>
Date:   Fri Sep 13 19:26:49 2013 +0530

    Create new rebase start dialog

 gitg/Makefile.am                           |    1 +
 gitg/gitg-rebase-controller.vala           |    6 +-
 gitg/gitg-rebase-result-dialog.vala        |    1 -
 gitg/gitg-rebase-start-dialog.vala         |   35 ++++++++
 gitg/gitg-window.vala                      |    6 +-
 gitg/resources/gitg-rebase-start-dialog.ui |  119 ++++++++++++++++++++++++++++
 gitg/resources/gitg-resources.xml          |    1 +
 7 files changed, 162 insertions(+), 7 deletions(-)
---
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 0e6404e..96ca94c 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -47,6 +47,7 @@ VALASOURCES =                                                 \
        gitg-rebase-window.vala                                 \
        gitg-rebase-result-dialog.vala                  \
        gitg-rebase-controller.vala                             \
+       gitg-rebase-start-dialog.vala                   \
        gitg-rebase-commit-editor-window.vala   \
        gitg-application.vala                                   \
        gitg-plugins-engine.vala                                \
diff --git a/gitg/gitg-rebase-controller.vala b/gitg/gitg-rebase-controller.vala
index 2388882..9232512 100644
--- a/gitg/gitg-rebase-controller.vala
+++ b/gitg/gitg-rebase-controller.vala
@@ -22,6 +22,7 @@ namespace Gitg
        public class RebaseController
        {
                private string output;
+               private string repo_path;
                public RebaseController()
                {
                        output = "";
@@ -49,7 +50,7 @@ namespace Gitg
                        return streamoutput;
                }
 
-               public void start_rebase(Gtk.Window parent, Gitg.Repository repository)
+               public void start_rebase()
                {
                        string gitg_path = "";
                        string git_path = "";
@@ -59,9 +60,6 @@ namespace Gitg
                        stdout.printf("gitg path: %s\n", gitg_path);
                        stdout.printf("git path: %s\n", git_path);
 
-                       File? workdir = repository.get_workdir();
-                       string repo_path = workdir.get_path();
-
                        string[] spawn_args = {"/usr/bin/git", "rebase", "-i", "HEAD~5"};
                        string[] spawn_env = Environ.get ();
                        spawn_env = Environ.set_variable(spawn_env, "GIT_SEQUENCE_EDITOR", "jhbuild run gitg 
--rebase", true);
diff --git a/gitg/gitg-rebase-result-dialog.vala b/gitg/gitg-rebase-result-dialog.vala
index 0f8b666..05e2b5c 100644
--- a/gitg/gitg-rebase-result-dialog.vala
+++ b/gitg/gitg-rebase-result-dialog.vala
@@ -35,7 +35,6 @@ namespace Gitg
 
                public void return_to_gitg()
                {
-
                }
        }
 }
\ No newline at end of file
diff --git a/gitg/gitg-rebase-start-dialog.vala b/gitg/gitg-rebase-start-dialog.vala
new file mode 100644
index 0000000..4af641a
--- /dev/null
+++ b/gitg/gitg-rebase-start-dialog.vala
@@ -0,0 +1,35 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2013 - Sindhu S
+ *
+ * gitg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * gitg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Gitg
+{
+       [GtkTemplate (ui = "/org/gnome/gitg/gtk/gitg-rebase-start-dialog.ui")]
+       public class RebaseStartDialog : Gtk.Dialog
+       {
+               [GtkChild (name = "rebase_spinbutton")]
+               private Gtk.SpinButton r_rebase_spinbutton;
+               private string repository_path;
+
+               public RebaseStartDialog(Gitg.Repository repository)
+               {
+                       File? workdir = repository.get_workdir();
+                       repository_path = workdir.get_path();
+               }
+       }
+}
\ No newline at end of file
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 445025c..56f3511 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -381,8 +381,10 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
 
        private void on_interactive_rebase_activated()
        {
-               var rebase_controller = new RebaseController();
-               rebase_controller.start_rebase(this, d_repository);
+//             var rebase_controller = new RebaseController();
+//             rebase_controller.start_rebase(this, d_repository);
+               var rebase_start_dialog = new RebaseStartDialog(d_repository);
+               rebase_start_dialog.show_all();
        }
 
        private void on_current_activity_changed(Object obj, ParamSpec pspec)
diff --git a/gitg/resources/gitg-rebase-start-dialog.ui b/gitg/resources/gitg-rebase-start-dialog.ui
new file mode 100644
index 0000000..11f248d
--- /dev/null
+++ b/gitg/resources/gitg-rebase-start-dialog.ui
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <template class="GitgRebaseStartDialog" parent="Gtk.Dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancel_button">
+                <property name="label" translatable="yes">Cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="start_button">
+                <property name="label" translatable="yes">Start</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">label</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkLabel" id="num_commits_to_rebase">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xpad">10</property>
+                    <property name="label" translatable="yes">Number of commits from HEAD to 
rebase:</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="rebase_spinbutton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-5">start_button</action-widget>
+    </action-widgets>
+  </template>
+</interface>
diff --git a/gitg/resources/gitg-resources.xml b/gitg/resources/gitg-resources.xml
index a70cd48..54b594e 100644
--- a/gitg/resources/gitg-resources.xml
+++ b/gitg/resources/gitg-resources.xml
@@ -22,6 +22,7 @@
     <file compressed="true" preprocess="xml-stripblanks">gitg-rebase-window.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gitg-rebase-commit-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">gitg-rebase-result-dialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">gitg-rebase-start-dialog.ui</file>
   </gresource>
 </gresources>
 


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