[gitg] Remove accels from ui file
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Remove accels from ui file
- Date: Mon, 6 Jan 2014 14:51:49 +0000 (UTC)
commit a2d62663fe9e560e4632bdff62fee9bd3f775dca
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon Jan 6 15:51:18 2014 +0100
Remove accels from ui file
gitg/gitg-application.vala | 38 +++++++++++++++++++++++++-------------
gitg/resources/ui/gitg-menus.ui | 13 -------------
2 files changed, 25 insertions(+), 26 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 1c354dd..ad72eed 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -262,6 +262,12 @@ public class Application : Gtk.Application
{"preferences", on_preferences_activated}
};
+ struct Accel
+ {
+ string name;
+ string accel;
+ }
+
protected override void startup()
{
base.startup();
@@ -270,9 +276,26 @@ public class Application : Gtk.Application
d_state_settings = new Settings("org.gnome.gitg.state.window");
d_state_settings.delay();
+ // Application menu entries
add_action_entries(app_entries, this);
- // App menu
+ const Accel[] accels = {
+ {"app.new", "<Primary>N"},
+ {"app.quit", "<Primary>Q"},
+ {"app.help", "F1"},
+
+ {"win.search", "<Primary>F"},
+ {"win.close", "<Primary>Q"},
+ {"win.reload", "<Primary>R"},
+ {"win.gear-menu", "F10"},
+ {"win.open-repository", "<Primary>O"}
+ };
+
+ foreach (var accel in accels)
+ {
+ add_accelerator(accel.accel, accel.name, null);
+ }
+
if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
{
MenuModel? menu = Resource.load_object<MenuModel>("ui/gitg-menus.ui", "app-menu");
@@ -282,21 +305,10 @@ public class Application : Gtk.Application
set_app_menu(menu);
}
}
- else
- {
- add_accelerator("<Primary>N", "app.new", null);
- add_accelerator("<Primary>Q", "app.quit", null);
- add_accelerator("F1", "app.help", null);
- }
-
- add_accelerator("<Primary>F", "win.search", null);
- add_accelerator("<Primary>W", "win.close", null);
- add_accelerator("F5", "win.reload", null);
- add_accelerator("<Primary>R", "win.reload", null);
- add_accelerator("F10", "win.gear-menu", null);
// Use our own css provider
Gtk.CssProvider? provider = Resource.load_css("style.css");
+
if (provider != null)
{
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
diff --git a/gitg/resources/ui/gitg-menus.ui b/gitg/resources/ui/gitg-menus.ui
index 34c56f8..097147e 100644
--- a/gitg/resources/ui/gitg-menus.ui
+++ b/gitg/resources/ui/gitg-menus.ui
@@ -6,7 +6,6 @@
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new</attribute>
- <attribute name="accel"><Primary>n</attribute>
</item>
</section>
<section>
@@ -19,7 +18,6 @@
<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>
@@ -28,7 +26,6 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
- <attribute name="accel"><Primary>q</attribute>
</item>
</section>
</menu>
@@ -37,7 +34,6 @@
<item>
<attribute name="label" translatable="yes">_Open Repository…</attribute>
<attribute name="action">win.open-repository</attribute>
- <attribute name="accel"><Primary>o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Clone Repository…</attribute>
@@ -56,7 +52,6 @@
<item>
<attribute name="label" translatable="yes">_Reload</attribute>
<attribute name="action">win.reload</attribute>
- <attribute name="accel"><Primary>r</attribute>
</item>
</section>
<section>
@@ -71,14 +66,12 @@
<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">_Open Repository…</attribute>
<attribute name="action">win.open-repository</attribute>
- <attribute name="accel"><Primary>o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Clone Repository…</attribute>
@@ -101,7 +94,6 @@
<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>
@@ -112,7 +104,6 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
- <attribute name="accel"><Primary>q</attribute>
</item>
</section>
</menu>
@@ -121,14 +112,12 @@
<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">_Reload</attribute>
<attribute name="action">win.reload</attribute>
- <attribute name="accel"><Primary>r</attribute>
</item>
</section>
<section>
@@ -147,7 +136,6 @@
<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>
@@ -158,7 +146,6 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
- <attribute name="accel"><Primary>q</attribute>
</item>
</section>
</menu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]