diff --git a/configure.ac b/configure.ac index 5607950..7a9ce88 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ GLIB_GSETTINGS AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.38]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) -PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.8]) +PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.12]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0]) PKG_CHECK_MODULES([LIBXSLT], [libexslt]) PKG_CHECK_MODULES([WEBKIT], [webkit2gtk-3.0]) diff --git a/src/ag-app.c b/src/ag-app.c index fbffba9..3a19437 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -265,51 +265,30 @@ setup_actions(AgApp *app) ); } +const gchar *action_accels[] = { + "win.close", "W", NULL, + "win.save", "S", NULL, + "win.export", "E", NULL, + "win.gear-menu", "F10", NULL, + "app.help", "F1", NULL, + "win.change-tab::chart", "F5", NULL, + "win.change-tab::aspects", "F9", NULL, + "win.change-tab::edit", "F10", NULL, + NULL +}; + static void setup_accelerators(AgApp *app) { - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "w", - "win.close", - NULL - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "s", - "win.save", - NULL - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "s", - "win.save-as", - NULL - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "F10", - "win.gear-menu", - NULL - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "F1", - "app.help", - NULL - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "F5", - "win.change-tab", - g_variant_new_string("chart") - ); - gtk_application_add_accelerator( - GTK_APPLICATION(app), - "F9", - "win.change-tab", - g_variant_new_string("aspects") - ); + const char **it; + + for (it = action_accels; it[0]; it += g_strv_length((gchar **)it) + 1) { + gtk_application_set_accels_for_action( + GTK_APPLICATION(app), + it[0], + &it[1] + ); + } } static void