diff --git a/app/app.c b/app/app.c index af86865269..2a398f1fc3 100644 --- a/app/app.c +++ b/app/app.c @@ -247,6 +247,8 @@ app_run (const gchar *full_prog_name, app = gimp_console_app_new (gimp, quit, as_new, filenames, batch_interpreter, batch_commands); #endif + gimp->app = app; + gimp_cpu_accel_set_use (use_cpu_accel); /* Check if the user's gimp_directory exists */ diff --git a/app/core/gimp.h b/app/core/gimp.h index 0e9d91a2de..45cf74a412 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -36,6 +36,8 @@ struct _Gimp { GimpObject parent_instance; + GApplication *app; + GimpCoreConfig *config; GimpCoreConfig *edit_config; /* don't use this one, it's just * for the preferences dialog diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c index e13fe257e9..59aac9c8d8 100644 --- a/app/widgets/gimpactiongroup.c +++ b/app/widgets/gimpactiongroup.c @@ -326,6 +326,24 @@ gimp_action_group_add_action_with_accel (GimpActionGroup *action_group, GimpAction *action, const gchar *accelerator) { + + /* Making sure all our Gimp*Action classes are also GAction. */ + g_return_if_fail (G_IS_ACTION (action)); + + g_action_map_add_action (G_ACTION_MAP (action_group->gimp->app), G_ACTION (action)); + if ((accelerator != NULL && g_strcmp0 (accelerator, "") != 0)) + { + gchar* detailed_action_name; + + detailed_action_name = g_strdup_printf ("app.%s", + g_action_get_name (G_ACTION (action))); + gtk_application_set_accels_for_action (GTK_APPLICATION (action_group->gimp->app), + detailed_action_name, + (const char*[]) { accelerator, NULL }); + g_free (detailed_action_name); + } + + /* TODO: remove the old logic with GtkAction. */ gtk_action_group_add_action_with_accel ((GtkActionGroup *) action_group, (GtkAction *) action, accelerator);