[buoh] Clean up accelerator setup
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh] Clean up accelerator setup
- Date: Sun, 3 Feb 2019 15:40:46 +0000 (UTC)
commit 249aae09fcbac916843b325d32acbe384d8508d5
Author: Jan Tojnar <jtojnar gmail com>
Date: Sat Feb 2 18:52:07 2019 +0100
Clean up accelerator setup
src/buoh-application.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/buoh-application.c b/src/buoh-application.c
index 803a035..eb21066 100644
--- a/src/buoh-application.c
+++ b/src/buoh-application.c
@@ -472,27 +472,27 @@ buoh_application_activate (GApplication *buoh)
void
buoh_application_startup (GApplication *app)
{
- const gchar *comic_properties_accel[2] = { "<alt>Return", NULL };
- const gchar *comic_quit_accel[2] = { "<control>Q", NULL };
- const gchar *view_zoom_in_accel[2] = { "<control>plus", NULL };
- const gchar *view_zoom_out_accel[2] = { "<control>minus", NULL };
- const gchar *view_zoom_normal_accel[2] = { "<control>0", NULL };
- const gchar *go_previous_accel[2] = { "<alt>Left", NULL };
- const gchar *go_next_accel[2] = { "<alt>Right", NULL };
- const gchar *go_first_accel[2] = { "<control>Home", NULL };
- const gchar *go_last_accel[2] = { "<control>End", NULL };
+ gint i;
+ struct {
+ const gchar *action;
+ const gchar *accelerators[2];
+ } accels[] = {
+ { "win.comic-properties", { "<alt>Return", NULL } },
+ { "win.comic-quit", { "<control>Q", NULL } },
+ { "win.view-zoom-in", { "<control>plus", NULL } },
+ { "win.view-zoom-out", { "<control>minus", NULL } },
+ { "win.view-zoom-normal", { "<control>0", NULL } },
+ { "win.go-previous", { "<alt>Left", NULL } },
+ { "win.go-next", { "<alt>Right", NULL } },
+ { "win.go-first", { "<control>Home", NULL } },
+ { "win.go-last", { "<control>End", NULL } }
+ };
G_APPLICATION_CLASS (buoh_application_parent_class)->startup (app);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.comic-properties",
comic_properties_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.comic-quit", comic_quit_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.view-zoom-in",
view_zoom_in_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.view-zoom-out",
view_zoom_out_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.view-zoom-normal",
view_zoom_normal_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.go-previous", go_previous_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.go-next", go_next_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.go-first", go_first_accel);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.go-last", go_last_accel);
+ for (i = 0; i < G_N_ELEMENTS (accels); i++) {
+ gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action,
accels[i].accelerators);
+ }
}
GtkTreeModel *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]