[gitg/wip/headerbar: 18/20] Add commit button
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/headerbar: 18/20] Add commit button
- Date: Sun, 7 Jul 2013 10:13:20 +0000 (UTC)
commit 35805cf95f194b28cff8b32514e3ee2b41153a2c
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Jul 6 22:19:56 2013 +0200
Add commit button
gitg/gitg-header-bar.vala | 21 ++++++++++++---------
gitg/gitg-window.vala | 4 +++-
gitg/resources/ui/gitg-header-bar.ui | 14 +++++++++++++-
3 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/gitg/gitg-header-bar.vala b/gitg/gitg-header-bar.vala
index 2a33fc0..587e51a 100644
--- a/gitg/gitg-header-bar.vala
+++ b/gitg/gitg-header-bar.vala
@@ -35,8 +35,9 @@ public class HeaderBar : Gtk.HeaderBar
[GtkChild]
private Gtk.ToggleButton d_search_button;
+
[GtkChild]
- private Gtk.StackSwitcher d_activities_switcher;
+ private Gtk.Button d_commit_button;
[GtkChild]
private Gtk.Button d_done_button;
@@ -47,6 +48,7 @@ public class HeaderBar : Gtk.HeaderBar
private Gtk.Button d_close_button;
public signal void request_dash();
+ public signal void request_commit();
public signal void exit_mode();
public enum Mode
@@ -71,7 +73,7 @@ public class HeaderBar : Gtk.HeaderBar
d_gear_menu.hide();
d_dash_button.hide();
d_search_button.hide();
- d_activities_switcher.hide();
+ d_commit_button.hide();
d_close_button_separator.hide();
d_close_button.hide();
d_done_button.show();
@@ -91,13 +93,13 @@ public class HeaderBar : Gtk.HeaderBar
{
d_gear_menu.menu_model = d_dash_model;
d_dash_button.hide();
- d_activities_switcher.hide();
+ d_commit_button.hide();
}
else if (d_mode == Mode.ACTIVITIES)
{
d_gear_menu.menu_model = d_activities_model;
d_dash_button.show();
- d_activities_switcher.show();
+ d_commit_button.show();
}
notify_property("mode");
@@ -123,6 +125,12 @@ public class HeaderBar : Gtk.HeaderBar
exit_mode();
}
+ [GtkCallback]
+ private void commit_button_clicked(Gtk.Button button)
+ {
+ request_commit();
+ }
+
construct
{
string menuname;
@@ -144,11 +152,6 @@ public class HeaderBar : Gtk.HeaderBar
{
return d_search_button;
}
-
- public Gtk.StackSwitcher get_activities_switcher()
- {
- return d_activities_switcher;
- }
}
}
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index c0adaf2..0be8aac 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -111,10 +111,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
d_search_entry.set_text("");
}
});
- d_header_bar.get_activities_switcher().set_stack(d_stack_activities);
d_header_bar.request_dash.connect(() => {
repository = null;
});
+ d_header_bar.request_commit.connect(() => {
+ d_header_bar.mode = HeaderBar.Mode.COMMIT;
+ });
d_header_bar.exit_mode.connect(() => {
d_header_bar.mode = HeaderBar.Mode.ACTIVITIES;
});
diff --git a/gitg/resources/ui/gitg-header-bar.ui b/gitg/resources/ui/gitg-header-bar.ui
index cfeb49d..2e4e720 100644
--- a/gitg/resources/ui/gitg-header-bar.ui
+++ b/gitg/resources/ui/gitg-header-bar.ui
@@ -42,7 +42,19 @@
</packing>
</child>
<child>
- <object class="GtkStackSwitcher" id="d_activities_switcher">
+ <object class="GtkButton" id="d_commit_button">
+ <property name="valign">center</property>
+ <signal name="clicked" handler="commit_button_clicked" swapped="no"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="commit_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">document-save-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
<property name="pack_type">end</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]