diff --git a/demos/print-editor/print-editor.c b/demos/print-editor/print-editor.c index 27202dd2ee..3737affd49 100644 --- a/demos/print-editor/print-editor.c +++ b/demos/print-editor/print-editor.c @@ -721,7 +721,6 @@ static const char ui_info[] = " " " _New" " app.new" - " <Primary>n" " " " " " _Open" @@ -730,12 +729,10 @@ static const char ui_info[] = " " " _Save" " app.save" - " <Primary>s" " " " " " Save _As..." " app.save-as" - " <Primary>s" " " " " "
" @@ -756,7 +753,6 @@ static const char ui_info[] = " " " _Quit" " app.quit" - " <Primary>q" " " "
" " " @@ -766,7 +762,6 @@ static const char ui_info[] = " " " _About Print Editor" " app.about" - " <Primary>a" " " " " " " @@ -794,6 +789,15 @@ startup (GApplication *app) { GtkBuilder *builder; GMenuModel *menubar; + struct { + const char *action_and_target; + const char *accelerators[2]; + } accels[] = { + { "app.new", { "n", NULL } }, + { "app.quit", { "q", NULL } }, + { "app.save", { "s", NULL } }, + { "app.about", { "a", NULL } }, + }; builder = gtk_builder_new (); gtk_builder_add_from_string (builder, ui_info, -1, NULL); @@ -802,6 +806,9 @@ startup (GApplication *app) gtk_application_set_menubar (GTK_APPLICATION (app), menubar); + for (int i = 0; i < G_N_ELEMENTS (accels); i++) + gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators); + g_object_unref (builder); }