summaryrefslogtreecommitdiff
path: root/examples/application10
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-04-17 11:36:33 -0700
committerMatthias Clasen <mclasen@redhat.com>2014-04-17 22:55:38 -0400
commitb718b95aabf5484f7ea5f1679706a50f67bd0271 (patch)
treedc34e4ca4702fec4858fac2722c8c6b507f0a66e /examples/application10
parent25ce82d5b3eebc3ac27c3726ea66834b065aec35 (diff)
downloadgtk+-b718b95aabf5484f7ea5f1679706a50f67bd0271.tar.gz
example: Port to gtk_application_set_accels_for_action
Instead of hardcoding an accelerator in the ui file, use gtk_application_set_accels_for_action.
Diffstat (limited to 'examples/application10')
-rw-r--r--examples/application10/app-menu.ui1
-rw-r--r--examples/application10/exampleapp.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/examples/application10/app-menu.ui b/examples/application10/app-menu.ui
index b0eddb65e5..e1e131cfca 100644
--- a/examples/application10/app-menu.ui
+++ b/examples/application10/app-menu.ui
@@ -12,7 +12,6 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
- <attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
</item>
</section>
</menu>
diff --git a/examples/application10/exampleapp.c b/examples/application10/exampleapp.c
index 1bc6ce85ee..66e85793f8 100644
--- a/examples/application10/exampleapp.c
+++ b/examples/application10/exampleapp.c
@@ -53,12 +53,16 @@ example_app_startup (GApplication *app)
{
GtkBuilder *builder;
GMenuModel *app_menu;
+ const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (app),
+ "app.quit",
+ quit_accels);
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));