diff --git a/src/gcal-window.c b/src/gcal-window.c index 6f720bc0..f86d09d6 100644 --- a/src/gcal-window.c +++ b/src/gcal-window.c @@ -130,6 +130,12 @@ enum #define FAST_REFRESH_TIMEOUT 900000 /* ms */ #define SLOW_REFRESH_TIMEOUT 3600000 /* ms */ +#define gcal_window_add_accelerator(app,action,accel) {\ + const gchar *tmp[] = {accel, NULL};\ + gtk_application_set_accels_for_action (GTK_APPLICATION (app), action, tmp);\ +} + + static void on_date_action_activated (GSimpleAction *action, GVariant *param, gpointer user_data); @@ -1615,9 +1621,6 @@ gcal_window_new_with_view_and_date (GcalApplication *app, { GcalWindow *win; GcalManager *manager; - const gchar *next_accel[] = {"Right", NULL}; - const gchar *previous_accel[] = {"Left", NULL}; - const gchar *today_accel[] = {"Down", "t", NULL}; manager = gcal_application_get_manager (GCAL_APPLICATION (app)); @@ -1625,9 +1628,13 @@ gcal_window_new_with_view_and_date (GcalApplication *app, NULL); /* setup accels */ - gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.next", next_accel); - gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.previous", previous_accel); - gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.today", today_accel); + gcal_window_add_accelerator (app, "win.next", "Right"); + gcal_window_add_accelerator (app, "win.next", "Right"); + gcal_window_add_accelerator (app, "win.previous", "Left"); + gcal_window_add_accelerator (app, "win.previous", "Left"); + gcal_window_add_accelerator (app, "win.today", "Down"); + gcal_window_add_accelerator (app, "win.today", "Down"); + gcal_window_add_accelerator (app, "win.today", "t"); /* loading size */ load_geometry (win);