summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-01-24 20:01:33 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-01-24 20:01:33 -0500
commit792857c7b8883c7fbeb44b6b3af3c421d32c6ed5 (patch)
treee5a04503c160a60e354dcfc85fe3fdbc68db0808 /demos
parente8ad47498b13d5d2e09388d6853356debb593841 (diff)
downloadgtk+-792857c7b8883c7fbeb44b6b3af3c421d32c6ed5.tar.gz
icon browser: Load app menu automagically
No need to manually create a builder and pass the resource to it, just follow the conventions and have GtkApplication do it for us.
Diffstat (limited to 'demos')
-rw-r--r--demos/icon-browser/iconbrowser.gresource.xml4
-rw-r--r--demos/icon-browser/iconbrowserapp.c7
-rw-r--r--demos/icon-browser/iconbrowserwin.c2
-rw-r--r--demos/icon-browser/menus.ui (renamed from demos/icon-browser/app-menu.ui)2
4 files changed, 4 insertions, 11 deletions
diff --git a/demos/icon-browser/iconbrowser.gresource.xml b/demos/icon-browser/iconbrowser.gresource.xml
index 455c684004..fd2523a016 100644
--- a/demos/icon-browser/iconbrowser.gresource.xml
+++ b/demos/icon-browser/iconbrowser.gresource.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gtk/iconbrowser">
+ <gresource prefix="/org/gtk/iconbrowser/gtk">
<file preprocess="xml-stripblanks">window.ui</file>
- <file preprocess="xml-stripblanks">app-menu.ui</file>
+ <file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
</gresources>
diff --git a/demos/icon-browser/iconbrowserapp.c b/demos/icon-browser/iconbrowserapp.c
index 1c9065e6c3..fc291d06f2 100644
--- a/demos/icon-browser/iconbrowserapp.c
+++ b/demos/icon-browser/iconbrowserapp.c
@@ -36,8 +36,6 @@ static GActionEntry app_entries[] =
static void
icon_browser_app_startup (GApplication *app)
{
- GtkBuilder *builder;
- GMenuModel *app_menu;
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);
@@ -48,11 +46,6 @@ icon_browser_app_startup (GApplication *app)
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
"app.quit",
quit_accels);
-
- builder = gtk_builder_new_from_resource ("/org/gtk/iconbrowser/app-menu.ui");
- app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
- gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
- g_object_unref (builder);
}
static void
diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c
index ec3a80432b..7645dcacec 100644
--- a/demos/icon-browser/iconbrowserwin.c
+++ b/demos/icon-browser/iconbrowserwin.c
@@ -840,7 +840,7 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
g_type_ensure (ICON_STORE_TYPE);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
- "/org/gtk/iconbrowser/window.ui");
+ "/org/gtk/iconbrowser/gtk/window.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_list);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, filter_model);
diff --git a/demos/icon-browser/app-menu.ui b/demos/icon-browser/menus.ui
index ed89a439c3..1a0f0c5365 100644
--- a/demos/icon-browser/app-menu.ui
+++ b/demos/icon-browser/menus.ui
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <menu id="appmenu">
+ <menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>