diff options
author | Ryan Lortie <desrt@desrt.ca> | 2014-07-04 09:46:57 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2014-07-07 14:46:28 -0400 |
commit | cc1af0f71c1f9f6799a2992239f90293d6c37ac8 (patch) | |
tree | 1d02df23f4679f76d023919846466e391228178f /examples | |
parent | 687a84692393cd26db85dbda7d78a2d3bc325ed7 (diff) | |
download | gtk+-cc1af0f71c1f9f6799a2992239f90293d6c37ac8.tar.gz |
bloatpad: use Gtk's automated menu loading
We move our menus.ui file into Gtk's namespace so that it will get
picked up. Accordingly, we no longer have to do any of the work for
ourselves...
https://bugzilla.gnome.org/show_bug.cgi?id=722092
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bp/Makefile.am | 2 | ||||
-rw-r--r-- | examples/bp/bloatpad.c | 9 | ||||
-rw-r--r-- | examples/bp/bloatpad.gresources.xml | 2 | ||||
-rw-r--r-- | examples/bp/gtk/menus.ui (renamed from examples/bp/menus.ui) | 0 |
4 files changed, 4 insertions, 9 deletions
diff --git a/examples/bp/Makefile.am b/examples/bp/Makefile.am index 827432d258..ed1a486af0 100644 --- a/examples/bp/Makefile.am +++ b/examples/bp/Makefile.am @@ -19,7 +19,7 @@ nodist_bloatpad_SOURCES = bloatpad-gresources.c resource_files = \ bloatpad.gresources.xml \ - menus.ui + gtk/menus.ui bloatpad-gresources.c: $(resource_files) $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $< diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c index c0e2d7d507..1ca129ec97 100644 --- a/examples/bp/bloatpad.c +++ b/examples/bp/bloatpad.c @@ -509,7 +509,6 @@ bloat_pad_startup (GApplication *application) { BloatPad *bloatpad = (BloatPad*) application; GtkApplication *app = GTK_APPLICATION (application); - GtkBuilder *builder; GMenu *menu; GMenuItem *item; GIcon *icon; @@ -537,13 +536,10 @@ bloat_pad_startup (GApplication *application) g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application); - builder = gtk_builder_new_from_resource ("/org/gtk/bloatpad/menus.ui"); - gtk_application_set_app_menu (app, G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); - gtk_application_set_menubar (app, G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"))); for (i = 0; i < G_N_ELEMENTS (accels); i++) gtk_application_set_accels_for_action (app, accels[i].action_and_target, accels[i].accelerators); - menu = G_MENU (gtk_builder_get_object (builder, "icon-menu")); + menu = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "icon-menu"); file = g_file_new_for_path (SRCDIR "/../gtk/stock-icons/16/help-about.png"); icon = g_file_icon_new (file); @@ -609,8 +605,7 @@ bloat_pad_startup (GApplication *application) dump_accels (GTK_APPLICATION (application)); //gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); - bloatpad->time = G_MENU (gtk_builder_get_object (builder, "time-menu")); - g_object_unref (builder); + bloatpad->time = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "time-menu"); } static void diff --git a/examples/bp/bloatpad.gresources.xml b/examples/bp/bloatpad.gresources.xml index beee6b27e0..2e5c42314b 100644 --- a/examples/bp/bloatpad.gresources.xml +++ b/examples/bp/bloatpad.gresources.xml @@ -2,6 +2,6 @@ <gresources> <gresource prefix="/org/gtk/bloatpad"> - <file preprocess="xml-stripblanks">menus.ui</file> + <file preprocess="xml-stripblanks">gtk/menus.ui</file> </gresource> </gresources> diff --git a/examples/bp/menus.ui b/examples/bp/gtk/menus.ui index a05986fdb5..a05986fdb5 100644 --- a/examples/bp/menus.ui +++ b/examples/bp/gtk/menus.ui |