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
This commit is contained in:
Ryan Lortie 2014-07-04 09:46:57 -04:00
parent 687a846923
commit cc1af0f71c
4 changed files with 4 additions and 9 deletions

View File

@ -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 $<

View File

@ -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

View File

@ -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>