[gitg] Added combined app and window menu when there is no shell
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Added combined app and window menu when there is no shell
- Date: Fri, 1 Mar 2013 22:14:29 +0000 (UTC)
commit 067821e401aa8282dffe051146b84c4a49f795be
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Fri Mar 1 23:14:04 2013 +0100
Added combined app and window menu when there is no shell
gitg/gitg-window.vala | 27 +++++++++++++++++++++++++-
gitg/resources/ui/gitg-menus.ui | 40 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index e17789b..d063db8 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -52,6 +52,20 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
private GitgExt.NavigationTreeView d_navigation;
+ private static const ActionEntry[] win_entries = {
+ {"close", on_close_activated},
+ };
+
+ construct
+ {
+ add_action_entries(win_entries, this);
+ }
+
+ private void on_close_activated()
+ {
+ destroy();
+ }
+
public GitgExt.View? current_view
{
owned get { return d_views.current; }
@@ -172,7 +186,18 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
d_navigation = builder.get_object("tree_view_navigation") as GitgExt.NavigationTreeView;
d_config = builder.get_object("button_config") as Gtk.MenuButton;
- var model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", "win-menu");
+ string menuname;
+
+ if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
+ {
+ menuname = "win-menu";
+ }
+ else
+ {
+ menuname = "app-win-menu";
+ }
+
+ var model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", menuname);
d_config.menu_model = model;
var search_button = builder.get_object("search-button") as Gd.HeaderToggleButton;
diff --git a/gitg/resources/ui/gitg-menus.ui b/gitg/resources/ui/gitg-menus.ui
index febe4a3..06936ff 100644
--- a/gitg/resources/ui/gitg-menus.ui
+++ b/gitg/resources/ui/gitg-menus.ui
@@ -38,9 +38,47 @@
<section>
<item>
<attribute name="label" translatable="yes">_Close</attribute>
- <attribute name="action">app.winclose</attribute>
+ <attribute name="action">win.close</attribute>
<attribute name="accel"><Primary>w</attribute>
</item>
</section>
</menu>
+ <menu id="app-win-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_New Window</attribute>
+ <attribute name="action">app.new</attribute>
+ <attribute name="accel"><Primary>n</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">app.preferences</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">app.help</attribute>
+ <attribute name="accel">F1</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Close</attribute>
+ <attribute name="action">win.close</attribute>
+ <attribute name="accel"><Primary>w</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="accel"><Primary>q</attribute>
+ </item>
+ </section>
+ </menu>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]