[gitg/wip/commit] Added commit button
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/commit] Added commit button
- Date: Wed, 3 Jul 2013 17:43:00 +0000 (UTC)
commit 550740b7670de7c3ced6b98a638272523456c64a
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Wed Jul 3 19:42:42 2013 +0200
Added commit button
gitg/commit/gitg-commit-paned.vala | 16 ++++++
gitg/commit/gitg-commit.vala | 15 ++++++
gitg/resources/ui/gitg-commit-paned.ui | 79 ++++++++++++++++++++++++--------
gitg/resources/ui/style.css | 5 ++
4 files changed, 96 insertions(+), 19 deletions(-)
---
diff --git a/gitg/commit/gitg-commit-paned.vala b/gitg/commit/gitg-commit-paned.vala
index ab6c70c..3331d3e 100644
--- a/gitg/commit/gitg-commit-paned.vala
+++ b/gitg/commit/gitg-commit-paned.vala
@@ -29,6 +29,12 @@ class Paned : Gtk.Paned
[GtkChild (name = "diff_view")]
private Gitg.DiffView d_diff_view;
+ [GtkChild (name = "label_commit_summary")]
+ private Gtk.Label d_label_commit_summary;
+
+ [GtkChild (name = "button_commit")]
+ private Gtk.Button d_button_commit;
+
public Gitg.Sidebar sidebar
{
get { return d_tree_view_files; }
@@ -39,6 +45,16 @@ class Paned : Gtk.Paned
get { return d_diff_view; }
}
+ public Gtk.Label label_commit_summary
+ {
+ get { return d_label_commit_summary; }
+ }
+
+ public Gtk.Button button_commit
+ {
+ get { return d_button_commit; }
+ }
+
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 e5e321d..379f626 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -361,6 +361,21 @@ namespace GitgCommit
model.end_header();
d_main.sidebar.expand_all();
+
+ if (staged.length == 0)
+ {
+ d_main.label_commit_summary.label = _("No files staged to be
committed.");
+ d_main.button_commit.sensitive = false;
+ }
+ else
+ {
+ d_main.label_commit_summary.label =
+ ngettext(_("1 file staged to be committed."),
+ _("%d files staged to be
commited.").printf(staged.length),
+ staged.length);
+
+ d_main.button_commit.sensitive = true;
+ }
});
}
diff --git a/gitg/resources/ui/gitg-commit-paned.ui b/gitg/resources/ui/gitg-commit-paned.ui
index 0f761a1..c98476e 100644
--- a/gitg/resources/ui/gitg-commit-paned.ui
+++ b/gitg/resources/ui/gitg-commit-paned.ui
@@ -14,47 +14,88 @@
<class name="sidebar-paned"/>
</style>
<child>
+ <object class="GtkScrolledWindow" id="scrolled_window_files">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="name">scrolled_window_files</property>
+ <style>
+ <class name="sidebar"/>
+ </style>
+ <child>
+ <object class="GitgSidebar" id="tree_view_files">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="name">tree_view_files</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
<object class="GtkBox" id="box_sidebar">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkScrolledWindow" id="scrolled_window_files">
+ <object class="GitgDiffView" id="diff_view">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="name">scrolled_window_files</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame_commit">
+ <property name="visible">True</property>
<style>
- <class name="sidebar"/>
+ <class name="commit-frame"/>
</style>
<child>
- <object class="GitgSidebar" id="tree_view_files">
+ <object class="GtkBox" id="box_commit">
+ <property name="orientation">horizontal</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="name">tree_view_files</property>
+ <property name="margin">6</property>
+ <child>
+ <object class="GtkLabel" id="label_commit_summary">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_commit">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="label" translatable="yes">Commit</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</object>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</object>
</child>
- <child>
- <object class="GitgDiffView" id="diff_view">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="can_focus">True</property>
- </object>
- </child>
</template>
</interface>
diff --git a/gitg/resources/ui/style.css b/gitg/resources/ui/style.css
index 2a3dd93..1a5c5cf 100644
--- a/gitg/resources/ui/style.css
+++ b/gitg/resources/ui/style.css
@@ -116,3 +116,8 @@ GitgHistoryPaned panel-switcher {
.stash {
background-color: @butter3;
}
+
+GtkFrame.commit-frame {
+ border: 0px;
+ border-top: 1px solid @borders;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]