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



commit 6f48e0f4deb6229ecacf139eea537e4c41d72c10
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 4 15:59:30 2013 +0100

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

 panels/privacy/Makefile.am           |   19 ++++++++++++-------
 panels/privacy/cc-privacy-panel.c    |    8 +++++---
 panels/privacy/privacy.gresource.xml |    6 ++++++
 3 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/panels/privacy/Makefile.am b/panels/privacy/Makefile.am
index 345fdac..0e7d98d 100644
--- a/panels/privacy/Makefile.am
+++ b/panels/privacy/Makefile.am
@@ -3,24 +3,28 @@ cappletname = privacy
 INCLUDES = 						\
 	$(PANEL_CFLAGS)					\
 	$(PRIVACY_PANEL_CFLAGS)				\
-	-DGNOMECC_UI_DIR="\"$(uidir)\""			\
 	-DGNOMELOCALEDIR="\"$(datadir)/locale\""	\
-	-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""		\
-	-DDATADIR="\"$(datadir)\""			\
 	-I$(top_srcdir)/panels/common/			\
 	$(NULL)
 
 noinst_LTLIBRARIES = libprivacy.la
 
+BUILT_SOURCES =			\
+	cc-privacy-resources.c	\
+	cc-privacy-resources.h
+
 libprivacy_la_SOURCES =		\
+	$(BUILT_SOURCES)	\
 	cc-privacy-panel.c	\
 	cc-privacy-panel.h
 
 libprivacy_la_LIBADD = $(PANEL_LIBS) $(PRIVACY_PANEL_LIBS)
 
-uidir = $(pkgdatadir)/ui
-dist_ui_DATA = 		\
-	privacy.ui
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/privacy.gresource.xml)
+cc-privacy-resources.c: privacy.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_privacy $<
+cc-privacy-resources.h: privacy.gresource.xml $(resource_files)
+	$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_privacy $<
 
 @INTLTOOL_DESKTOP_RULE@
 
@@ -28,6 +32,7 @@ desktopdir = $(datadir)/applications
 desktop_in_files = gnome-privacy-panel.desktop.in
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
-CLEANFILES = $(desktop_in_files) $(desktop_DATA)
+CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
+EXTRA_DIST = $(resource_files) privacy.gresource.xml
 
 -include $(top_srcdir)/git.mk
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index f5105d9..f137e06 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -20,6 +20,7 @@
  */
 
 #include "cc-privacy-panel.h"
+#include "cc-privacy-resources.h"
 
 #include <egg-list-box/egg-list-box.h>
 #include <gio/gdesktopappinfo.h>
@@ -666,13 +667,14 @@ cc_privacy_panel_init (CcPrivacyPanel *self)
   guint res;
 
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelPrivate);
+  g_resources_register (cc_privacy_get_resource ());
 
   self->priv->builder = gtk_builder_new ();
 
   error = NULL;
-  res = gtk_builder_add_from_file (self->priv->builder,
-                                   GNOMECC_UI_DIR "/privacy.ui",
-                                   &error);
+  res = gtk_builder_add_from_resource (self->priv->builder,
+                                       "/org/gnome/control-center/privacy/privacy.ui",
+                                       &error);
 
   if (res == 0)
     {
diff --git a/panels/privacy/privacy.gresource.xml b/panels/privacy/privacy.gresource.xml
new file mode 100644
index 0000000..e5d37f3
--- /dev/null
+++ b/panels/privacy/privacy.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/privacy">
+    <file preprocess="xml-stripblanks">privacy.ui</file>
+  </gresource>
+</gresources>



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