[evince] shell: let GtkApplication load the appmenu
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] shell: let GtkApplication load the appmenu
- Date: Sun, 31 Jan 2016 11:24:02 +0000 (UTC)
commit a05ec4a328468c42f3a99d3667fc875c45c3a663
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Dec 4 11:20:57 2015 +0100
shell: let GtkApplication load the appmenu
Since bgo#757828 introduced g_application_set_resource_base_path,
we don't need to use a GtkBuilder to load the appmenu.
GtkApplication automatically loads menus from the GtkBuilder resource
located at "gtk/menus.ui", relative to the application's resource
base path (see g_application_set_resource_base_path ()). The menu
with the ID "app-menu" is taken as the application's app menu.
https://bugzilla.gnome.org/show_bug.cgi?id=757937
shell/ev-application.c | 10 ----------
shell/ev-toolbar.c | 2 +-
shell/ev-window.c | 2 +-
shell/evince-menus.ui | 2 +-
shell/evince.gresource.xml | 2 +-
5 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 1466b4f..c8ec9c5 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -1087,8 +1087,6 @@ ev_application_startup (GApplication *gapplication)
};
EvApplication *application = EV_APPLICATION (gapplication);
- GtkBuilder *builder;
- GError *error = NULL;
const gchar **it;
g_application_set_resource_base_path (gapplication, "/org/gnome/evince");
@@ -1099,14 +1097,6 @@ ev_application_startup (GApplication *gapplication)
app_menu_actions, G_N_ELEMENTS (app_menu_actions),
application);
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/evince/ui/menus.ui", &error);
- g_assert_no_error (error);
-
- gtk_application_set_app_menu (GTK_APPLICATION (application),
- G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu")));
- g_object_unref (builder);
-
for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
}
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 64aed8e..a91788a 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -195,7 +195,7 @@ ev_toolbar_constructed (GObject *object)
G_OBJECT_CLASS (ev_toolbar_parent_class)->constructed (object);
- builder = gtk_builder_new_from_resource ("/org/gnome/evince/ui/menus.ui");
+ builder = gtk_builder_new_from_resource ("/org/gnome/evince/gtk/menus.ui");
button = ev_toolbar_create_button (ev_toolbar, "win.open",
"document-open-symbolic",
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 601bb1b..7cf3931 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -7091,7 +7091,7 @@ ev_window_init (EvWindow *ev_window)
ev_window);
/* Popups */
- builder = gtk_builder_new_from_resource ("/org/gnome/evince/ui/menus.ui");
+ builder = gtk_builder_new_from_resource ("/org/gnome/evince/gtk/menus.ui");
ev_window->priv->view_popup_menu = g_object_ref (G_MENU_MODEL (gtk_builder_get_object (builder,
"view-popup-menu")));
ev_window->priv->attachment_popup_menu = g_object_ref (G_MENU_MODEL (gtk_builder_get_object (builder,
"attachments-popup")));
g_object_unref (builder);
diff --git a/shell/evince-menus.ui b/shell/evince-menus.ui
index 5648d1c..b5e39cd 100644
--- a/shell/evince-menus.ui
+++ b/shell/evince-menus.ui
@@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-->
<interface>
- <menu id="appmenu">
+ <menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
diff --git a/shell/evince.gresource.xml b/shell/evince.gresource.xml
index bbacb1c..c7dcc17 100644
--- a/shell/evince.gresource.xml
+++ b/shell/evince.gresource.xml
@@ -20,6 +20,6 @@
<file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">help-overlay.ui</file>
<file alias="ui/evince.css" compressed="true">evince.css</file>
<file alias="ui/thumbnail-frame.png" compressed="true">thumbnail-frame.png</file>
- <file alias="ui/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
+ <file alias="gtk/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]