[gtk+] bloatpad: use Gtk's automated menu loading
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] bloatpad: use Gtk's automated menu loading
- Date: Mon, 7 Jul 2014 18:48:00 +0000 (UTC)
commit cc1af0f71c1f9f6799a2992239f90293d6c37ac8
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jul 4 09:46:57 2014 -0400
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
examples/bp/Makefile.am | 2 +-
examples/bp/bloatpad.c | 9 ++-------
examples/bp/bloatpad.gresources.xml | 2 +-
examples/bp/{ => gtk}/menus.ui | 0
4 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/examples/bp/Makefile.am b/examples/bp/Makefile.am
index 827432d..ed1a486 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 c0e2d7d..1ca129e 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 beee6b2..2e5c423 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
similarity index 100%
rename from examples/bp/menus.ui
rename to examples/bp/gtk/menus.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]