Commit cc1af0f7 authored by Allison Karlitskaya's avatar Allison Karlitskaya

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
parent 687a8469
......@@ -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 $<
......
......@@ -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
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment