[gnome-terminal] app: Let GtkApplication load the app menu automatically
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] app: Let GtkApplication load the app menu automatically
- Date: Sun, 29 Mar 2015 12:13:47 +0000 (UTC)
commit d676a2cc519086c02b1c13191348083a6ae61ec2
Author: Lars Uebernickel <lars uebernickel canonical com>
Date: Wed Feb 25 15:36:20 2015 +0100
app: Let GtkApplication load the app menu automatically
GtkApplication automatically loads the app-menu from
$BASE_RESOURCE_PATH/gtk/menus.ui. Rename the resource and menu
identifier to actually make it do that and remove the code that loaded
the menu manually.
Also remove trailing '/' from TERMINAL_RESOURCES_PATH_PREFIX so that we
can use it with g_application_set_resource_base_path().
https://bugzilla.gnome.org/show_bug.cgi?id=734791
configure.ac | 4 ++--
src/Makefile.am | 2 +-
src/terminal-app.c | 12 +-----------
src/terminal-app.h | 2 +-
src/{terminal-appmenu.ui => terminal-menus.ui} | 2 +-
src/terminal-util.c | 2 +-
src/terminal-window.c | 2 +-
src/terminal.gresource.xml | 2 +-
8 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9fa4a87..6490f8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,9 +33,9 @@ IT_PROG_INTLTOOL([0.50.0])
AM_GLIB_GNU_GETTEXT
-GLIB_REQUIRED=2.40.0
+GLIB_REQUIRED=2.42.0
GLIB_MIN_REQUIRED=2.40
-GLIB_MAX_ALLOWED=2.40
+GLIB_MAX_ALLOWED=2.42
GIO_REQUIRED=2.34.0
GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.1.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 7a80f1c..545f89c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -373,7 +373,7 @@ CLEANFILES = \
EXTRA_DIST = \
terminal.about \
terminal.xml \
- terminal-appmenu.ui \
+ terminal-menus.ui \
terminal-window.ui \
terminal.gresource.xml \
terminal-marshal.list \
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 94fa35b..8af60f4 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -321,8 +321,7 @@ terminal_app_startup (GApplication *application)
{ "quit", app_menu_quit_cb, NULL, NULL, NULL }
};
- gs_unref_object GtkBuilder *builder;
- GError *error = NULL;
+ g_application_set_resource_base_path (application, TERMINAL_RESOURCES_PATH_PREFIX);
G_APPLICATION_CLASS (terminal_app_parent_class)->startup (application);
@@ -333,15 +332,6 @@ terminal_app_startup (GApplication *application)
app_menu_actions, G_N_ELEMENTS (app_menu_actions),
application);
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder,
- TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal-appmenu.ui",
- &error);
- g_assert_no_error (error);
-
- gtk_application_set_app_menu (GTK_APPLICATION (application),
- G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu")));
-
_terminal_debug_print (TERMINAL_DEBUG_SERVER, "Startup complete\n");
}
diff --git a/src/terminal-app.h b/src/terminal-app.h
index 9502845..20cb3ee 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
#define GNOME_TERMINAL_ICON_NAME "utilities-terminal"
-#define TERMINAL_RESOURCES_PATH_PREFIX "/org/gnome/terminal/"
+#define TERMINAL_RESOURCES_PATH_PREFIX "/org/gnome/terminal"
#define MONOSPACE_FONT_KEY_NAME "monospace-font-name"
diff --git a/src/terminal-appmenu.ui b/src/terminal-menus.ui
similarity index 98%
rename from src/terminal-appmenu.ui
rename to src/terminal-menus.ui
index 01ff5a8..e248590 100644
--- a/src/terminal-appmenu.ui
+++ b/src/terminal-menus.ui
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<interface>
- <menu id="appmenu">
+ <menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_New Terminal</attribute>
diff --git a/src/terminal-util.c b/src/terminal-util.c
index f999e2c..3b4ff27 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -172,7 +172,7 @@ terminal_util_show_about (GtkWindow *transient_parent)
gs_free char *comment;
gs_free char *vte_version;
- bytes = g_resources_lookup_data (TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal.about",
+ bytes = g_resources_lookup_data (TERMINAL_RESOURCES_PATH_PREFIX "/ui/terminal.about",
G_RESOURCE_LOOKUP_FLAGS_NONE,
&error);
g_assert_no_error (error);
diff --git a/src/terminal-window.c b/src/terminal-window.c
index ba502b2..969e9ee 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2672,7 +2672,7 @@ terminal_window_init (TerminalWindow *window)
/* Load the UI */
error = NULL;
priv->ui_id = gtk_ui_manager_add_ui_from_resource (manager,
- TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal.xml",
+ TERMINAL_RESOURCES_PATH_PREFIX "/ui/terminal.xml",
&error);
g_assert_no_error (error);
diff --git a/src/terminal.gresource.xml b/src/terminal.gresource.xml
index ec07643..abab042 100644
--- a/src/terminal.gresource.xml
+++ b/src/terminal.gresource.xml
@@ -18,11 +18,11 @@
<gresources>
<gresource prefix="/org/gnome/terminal">
<file alias="ui/terminal.xml" compressed="true" preprocess="xml-stripblanks">terminal.xml</file>
- <file alias="ui/terminal-appmenu.ui" compressed="true"
preprocess="xml-stripblanks">terminal-appmenu.ui</file>
<file alias="ui/terminal.about" compressed="true">terminal.about</file>
<file alias="ui/find-dialog.ui" compressed="true" preprocess="xml-stripblanks">find-dialog.ui</file>
<file alias="ui/preferences.ui" compressed="true" preprocess="xml-stripblanks">preferences.ui</file>
<file alias="ui/profile-preferences.ui" compressed="true"
preprocess="xml-stripblanks">profile-preferences.ui</file>
<file alias="ui/window.ui" compressed="true" preprocess="xml-stripblanks">terminal-window.ui</file>
+ <file alias="gtk/menus.ui" compressed="true" preprocess="xml-stripblanks">terminal-menus.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]