[gitg] Use set_accels_for_action to set multiple accels
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Use set_accels_for_action to set multiple accels
- Date: Sun, 13 Jul 2014 01:29:33 +0000 (UTC)
commit b5acc0661f467f41277550199f604a12d6100709
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Jul 13 03:28:16 2014 +0200
Use set_accels_for_action to set multiple accels
https://bugzilla.gnome.org/show_bug.cgi?id=700774
gitg/gitg-application.vala | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index f64eabe..ba44f7c 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -266,6 +266,12 @@ public class Application : Gtk.Application
string accel;
}
+ struct MultiAccel
+ {
+ string name;
+ string[] accels;
+ }
+
protected override void startup()
{
base.startup();
@@ -277,21 +283,32 @@ public class Application : Gtk.Application
// Application menu entries
add_action_entries(app_entries, this);
- const Accel[] accels = {
- {"app.new", "<Primary>N"},
+ const Accel[] single_accels = {
+ {"app.new", "<Primary>N",},
{"app.quit", "<Primary>Q"},
{"app.help", "F1"},
{"win.search", "<Primary>F"},
- {"win.reload", "<Primary>R"},
{"win.gear-menu", "F10"},
{"win.open-repository", "<Primary>O"},
{"win.close", "<Primary>W"}
};
- foreach (var accel in accels)
+ var multi_accels = new MultiAccel[] {
+ MultiAccel() {
+ name = "win.reload",
+ accels = new string[] {"<Primary>R", "F5"}
+ }
+ };
+
+ foreach (var accel in single_accels)
+ {
+ set_accels_for_action(accel.name, new string[] {accel.accel});
+ }
+
+ foreach (var accel in multi_accels)
{
- add_accelerator(accel.accel, accel.name, null);
+ set_accels_for_action(accel.name, accel.accels);
}
if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]