[gnome-control-center] shell: use a GResource for GtkBuilder UI definition



commit d2cb481c54bc651d00d82b973a960a1b8cacf8cc
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 4 17:10:52 2013 +0100

    shell: use a GResource for GtkBuilder UI definition
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691132

 shell/Makefile.am            |   21 ++++++++++++++-------
 shell/gnome-control-center.c |    2 +-
 shell/shell.gresource.xml    |    6 ++++++
 3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index c1fae4f..844c417 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -5,7 +5,12 @@ INCLUDES =					\
 
 bin_PROGRAMS = gnome-control-center
 
+BUILT_SOURCES =			\
+	cc-shell-resources.c	\
+	cc-shell-resources.h
+
 gnome_control_center_SOURCES =			\
+	$(BUILT_SOURCES)			\
 	control-center.c			\
 	cc-shell-log.c				\
 	cc-shell-log.h				\
@@ -66,12 +71,13 @@ if BUILD_BLUETOOTH
 gnome_control_center_LDADD += $(top_builddir)/panels/bluetooth/libbluetooth.la
 endif
 
-AM_CPPFLAGS =							\
-	-DGNOMELOCALEDIR="\"$(datadir)/locale\""		\
-	-DUIDIR="\"$(uidir)\""
+AM_CPPFLAGS = -DGNOMELOCALEDIR="\"$(datadir)/locale\""
 
-uidir = $(pkgdatadir)/ui
-ui_DATA = shell.ui
+resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/shell.gresource.xml)
+cc-shell-resources.c: shell.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_shell $<
+cc-shell-resources.h: shell.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_shell $<
 
 sysdir = $(datadir)/applications
 sys_in_files = gnome-control-center.desktop.in
@@ -85,12 +91,13 @@ gnome_control_center_completion.bash: gnome_control_center_completion.bash.in li
 	$(AM_V_GEN) cat $< | sed "s,@PANELS@,`$(srcdir)/list-panel.sh $(top_srcdir)`," > $@
 
 EXTRA_DIST =					\
-	$(ui_DATA)				\
+	$(resource_files)			\
+	shell.gresource.xml			\
 	gnome-control-center.desktop.in.in	\
 	$(completion_in_files)			\
 	list-panel.sh
 
-CLEANFILES = $(completion_DATA)
+CLEANFILES = $(BUILT_SOURCES) $(completion_DATA)
 DISTCLEANFILES = gnome-control-center.desktop gnome-control-center.desktop.in
 
 -include $(top_srcdir)/git.mk
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 6c961d5..e69215d 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -1236,7 +1236,7 @@ gnome_control_center_init (GnomeControlCenter *self)
   /* load the user interface */
   priv->builder = gtk_builder_new ();
 
-  if (!gtk_builder_add_from_file (priv->builder, UIDIR "/shell.ui", &err))
+  if (!gtk_builder_add_from_resource (priv->builder, "/org/gnome/control-center/shell/shell.ui", &err))
     {
       g_critical ("Could not build interface: %s", err->message);
       g_error_free (err);
diff --git a/shell/shell.gresource.xml b/shell/shell.gresource.xml
new file mode 100644
index 0000000..1e65228
--- /dev/null
+++ b/shell/shell.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/shell">
+    <file preprocess="xml-stripblanks">shell.ui</file>
+  </gresource>
+</gresources>



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