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



commit 214b514fccf51f2649529c3cd9907d14cb8aef56
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 4 15:05:07 2013 +0100

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

 panels/info/Makefile.am        |   19 ++++++++++++-------
 panels/info/cc-info-panel.c    |    8 +++++---
 panels/info/info.gresource.xml |    7 +++++++
 3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/panels/info/Makefile.am b/panels/info/Makefile.am
index 6462743..541fc9e 100644
--- a/panels/info/Makefile.am
+++ b/panels/info/Makefile.am
@@ -3,11 +3,8 @@ cappletname = info
 INCLUDES = 						\
 	$(PANEL_CFLAGS)					\
 	$(INFO_PANEL_CFLAGS)				\
-	-DGNOMECC_UI_DIR="\"$(uidir)\""			\
 	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
-	-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""		\
 	-DDATADIR="\"$(datadir)\""			\
-	-DLIBEXECDIR="\"$(libexecdir)\""		\
 	$(NULL)
 
 noinst_PROGRAMS = test-hostname
@@ -22,7 +19,12 @@ check-local: test-hostname
 
 noinst_LTLIBRARIES = libinfo.la
 
+BUILT_SOURCES =			\
+	cc-info-resources.c	\
+	cc-info-resources.h
+
 libinfo_la_SOURCES =		\
+	$(BUILT_SOURCES)	\
 	cc-info-panel.c		\
 	cc-info-panel.h		\
 	hostname-helper.c	\
@@ -32,8 +34,11 @@ libinfo_la_SOURCES =		\
 
 libinfo_la_LIBADD = $(PANEL_LIBS) $(INFO_PANEL_LIBS)
 
-uidir = $(pkgdatadir)/ui
-dist_ui_DATA = info.ui GnomeLogoVerticalMedium.svg
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/info.gresource.xml)
+cc-info-resources.c: info.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_info $<
+cc-info-resources.h: info.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_info $<
 
 @INTLTOOL_DESKTOP_RULE@
 
@@ -47,7 +52,7 @@ update-from-gsd:
 	FILES="$(SPACEFILES)" DIR="$(SPACEDIR)" $(top_srcdir)/update-from-gsd.sh && changed=true ; \
 	git commit -m "info: Update from gnome-settings-daemon" $(SPACEFILES)
 
-CLEANFILES = $(desktop_in_files) $(desktop_DATA)
-EXTRA_DIST = hostnames-test.txt
+CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
+EXTRA_DIST = hostnames-test.txt $(resource_files) info.gresource.xml
 
 -include $(top_srcdir)/git.mk
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index e17ca24..033cee7 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -22,6 +22,7 @@
 #include <config.h>
 
 #include "cc-info-panel.h"
+#include "cc-info-resources.h"
 
 #include <polkit/polkit.h>
 
@@ -2047,6 +2048,7 @@ cc_info_panel_init (CcInfoPanel *self)
   GtkWidget *widget;
 
   self->priv = INFO_PANEL_PRIVATE (self);
+  g_resources_register (cc_info_get_resource ());
 
   self->priv->builder = gtk_builder_new ();
 
@@ -2056,9 +2058,9 @@ cc_info_panel_init (CcInfoPanel *self)
 
   g_assert (self->priv->session_bus);
 
-  if (gtk_builder_add_from_file (self->priv->builder,
-                                 GNOMECC_UI_DIR "/info.ui",
-                                 &error) == 0)
+  if (gtk_builder_add_from_resource (self->priv->builder,
+                                     "/org/gnome/control-center/info/info.ui",
+                                     &error) == 0)
     {
       g_warning ("Could not load interface file: %s", error->message);
       g_error_free (error);
diff --git a/panels/info/info.gresource.xml b/panels/info/info.gresource.xml
new file mode 100644
index 0000000..fde3333
--- /dev/null
+++ b/panels/info/info.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/info">
+    <file preprocess="xml-stripblanks">info.ui</file>
+    <file>GnomeLogoVerticalMedium.svg</file>
+  </gresource>
+</gresources>



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