[gnome-terminal/gsettings] window: Use GResource for the UI manager data



commit ccff7248ac77b5c29d76c7e59df770b6ebe97fd2
Author: Christian Persch <chpe gnome org>
Date:   Sat Apr 14 21:48:46 2012 +0200

    window: Use GResource for the UI manager data

 configure.ac               |   18 +++++++++++++++---
 src/Makefile.am            |   12 +++++++-----
 src/terminal-app.h         |    2 ++
 src/terminal-window.c      |   12 ++++--------
 src/terminal.gresource.xml |   22 ++++++++++++++++++++++
 5 files changed, 50 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 85892e5..063f916 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,8 +37,8 @@ GNOME_DEBUG_CHECK
 
 AM_GLIB_GNU_GETTEXT
 
-GLIB_REQUIRED=2.31.0
-GIO_REQUIRED=2.27.0
+GLIB_REQUIRED=2.32.0
+GIO_REQUIRED=2.32.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.1.0
 
 AC_MSG_CHECKING([which gtk+ version to compile against])
@@ -54,7 +54,7 @@ AC_MSG_RESULT([$with_gtk])
 
 case "$with_gtk" in
   3.0) GTK_API_VERSION=3.0
-       GTK_REQUIRED=3.3.21
+       GTK_REQUIRED=3.4.0
        VTE_PC_VERSION=-2.90
        VTE_REQUIRED=0.27.3
        ;;
@@ -129,12 +129,24 @@ if test -z "$GLIB_MKENUMS"; then
   AC_MSG_ERROR([glib-mkenums not found])
 fi
 
+AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
+AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
+if test -z "$GLIB_COMPILE_RESOURCES"; then
+  AC_MSG_ERROR([glib-compile-resources not found])
+fi
+
 AC_ARG_VAR([GDBUS_CODEGEN],[the gdbus-codegen programme])
 AC_PATH_PROG([GDBUS_CODEGEN],[gdbus-codegen],[])
 if test -z "$GDBUS_CODEGEN"; then
   AC_MSG_ERROR([gdbus-codegen not found])
 fi
 
+AC_ARG_VAR([XMLLINT],[the xmllint programme])
+AC_PATH_PROG([XMLLINT],[xmllint],[])
+if test -z "$XMLLINT"; then
+  AC_MSG_ERROR([xmllint not found])
+fi
+
 AC_ARG_VAR([GTK_BUILDER_CONVERT],[the gtk-builder-convert programme])
 AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[])
 if test -z "$GTK_BUILDER_CONVERT"; then
diff --git a/src/Makefile.am b/src/Makefile.am
index 23e4e9b..bcc557a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,8 @@ BUILT_SOURCES = \
 	terminal-type-builtins.h \
 	terminal-gdbus-generated.c \
 	terminal-gdbus-generated.h \
+	terminal-resources.c \
+	terminal-resources.h \
 	$(NULL)
 
 gnome_terminal_server_SOURCES = \
@@ -133,6 +135,9 @@ terminal-gdbus-generated.c terminal-gdbus-generated.h: org.gnome.Terminal.xml Ma
 			--generate-c-code terminal-gdbus-generated \
 			$<
 
+terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/terminal.gresource.xml)
+	$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $<
+
 # Terminal client
 
 gnome_terminal_client_SOURCES = \
@@ -261,11 +266,6 @@ about_DATA = \
 	terminal.about \
 	$(NULL)
 
-uimanagerdir = $(pkgdatadir)
-uimanager_DATA = \
-	terminal.xml \
-	$(NULL)
-
 builder_in_files = \
 	encodings-dialog.glade \
 	find-dialog.glade \
@@ -290,6 +290,8 @@ CLEANFILES = \
 	$(BUILT_SOURCES)
 
 EXTRA_DIST = \
+	terminal.xml \
+	terminal.gresource.xml \
 	terminal-marshal.list \
 	terminal-type-builtins.c.template \
 	terminal-type-builtins.h.template \
diff --git a/src/terminal-app.h b/src/terminal-app.h
index a383e0a..7c63242 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 
 #define GNOME_TERMINAL_ICON_NAME "utilities-terminal"
 
+#define TERMINAL_RESOURCES_PATH_PREFIX "/org/gnome/terminal/"
+
 #define MONOSPACE_FONT_KEY_NAME                 "monospace-font-name"
 
 /* TerminalApp */
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 23b6858..01cfe8d 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1926,14 +1926,10 @@ terminal_window_init (TerminalWindow *window)
   
   /* Load the UI */
   error = NULL;
-  priv->ui_id = gtk_ui_manager_add_ui_from_file (manager,
-                                                 TERM_PKGDATADIR G_DIR_SEPARATOR_S "terminal.xml",
-                                                 &error);
-  if (error)
-    {
-      g_printerr ("Failed to load UI: %s\n", error->message);
-      g_error_free (error);
-    }
+  priv->ui_id = gtk_ui_manager_add_ui_from_resource (manager,
+                                                     TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal.xml",
+                                                     &error);
+  g_assert_no_error (error);
 
   priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar");
   gtk_box_pack_start (GTK_BOX (main_vbox),
diff --git a/src/terminal.gresource.xml b/src/terminal.gresource.xml
new file mode 100644
index 0000000..c094708
--- /dev/null
+++ b/src/terminal.gresource.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright  2012 Christian Persch
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3, or (at your option)
+  any later version.
+
+  This program is distributed in the hope conf it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+  <gresource prefix="/org/gnome/terminal">
+    <file alias="ui/terminal.xml" compressed="true" preprocess="xml-stripblanks">terminal.xml</file>
+  </gresource>
+</gresources>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]