[gitg/wip/patch-stage: 11/11] Add stage selection button



commit 9bba235849460599d878cc3ae08119ce67e1d278
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Tue Dec 31 15:18:21 2013 +0100

    Add stage selection button

 gitg/commit/gitg-commit-paned.vala     |    8 ++++++++
 gitg/commit/gitg-commit.vala           |    9 +++++++++
 gitg/resources/ui/gitg-commit-paned.ui |   12 ++++++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gitg/commit/gitg-commit-paned.vala b/gitg/commit/gitg-commit-paned.vala
index bf5b92a..0af1e71 100644
--- a/gitg/commit/gitg-commit-paned.vala
+++ b/gitg/commit/gitg-commit-paned.vala
@@ -35,6 +35,9 @@ class Paned : Gtk.Paned
        [GtkChild (name = "button_commit")]
        private Gtk.Button d_button_commit;
 
+       [GtkChild (name = "button_stage")]
+       private Gtk.Button d_button_stage;
+
        public Gitg.Sidebar sidebar
        {
                get { return d_tree_view_files; }
@@ -55,6 +58,11 @@ class Paned : Gtk.Paned
                get { return d_button_commit; }
        }
 
+       public Gtk.Button button_stage
+       {
+               get { return d_button_stage; }
+       }
+
        construct
        {
                var state_settings = new Settings("org.gnome.gitg.state.commit");
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 4bd835f..2bbc76d 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -120,6 +120,8 @@ namespace GitgCommit
                                        d_main.diff_view.unstaged = true;
                                        d_main.diff_view.staged = false;
 
+                                       d_main.button_stage.label = _("_Stage selection");
+
                                        d_main.diff_view.diff = d;
                                }
                                catch
@@ -199,6 +201,8 @@ namespace GitgCommit
                                        d_main.diff_view.unstaged = false;
                                        d_main.diff_view.staged = true;
 
+                                       d_main.button_stage.label = _("_Unstage selection");
+
                                        d_main.diff_view.diff = d;
                                }
                                catch
@@ -740,6 +744,11 @@ namespace GitgCommit
                        d_main.button_commit.clicked.connect(() => {
                                on_commit_clicked();
                        });
+
+                       d_main.diff_view.bind_property("has-selection",
+                                                      d_main.button_stage,
+                                                      "sensitive",
+                                                      BindingFlags.DEFAULT);
                }
        }
 }
diff --git a/gitg/resources/ui/gitg-commit-paned.ui b/gitg/resources/ui/gitg-commit-paned.ui
index f6f281d..85c2418 100644
--- a/gitg/resources/ui/gitg-commit-paned.ui
+++ b/gitg/resources/ui/gitg-commit-paned.ui
@@ -60,6 +60,7 @@
                 <property name="orientation">horizontal</property>
                 <property name="visible">True</property>
                 <property name="margin">6</property>
+                <property name="spacing">6</property>
                 <child>
                   <object class="GtkCheckButton" id="check_button_skip_hooks">
                     <property name="visible">True</property>
@@ -82,6 +83,17 @@
                     <property name="pack-type">end</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkButton" id="button_stage">
+                    <property name="visible">True</property>
+                    <property name="use_underline">True</property>
+                    <property name="label" translatable="yes">S_tage selection</property>
+                    <property name="sensitive">False</property>
+                  </object>
+                  <packing>
+                    <property name="pack-type">end</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>


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