[gnome-control-center] universal-access: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] universal-access: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:06:05 +0000 (UTC)
commit f7ae09c561c831a3a7a5e6e094dbc78e5991fb26
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 16:23:40 2013 +0100
universal-access: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/universal-access/Makefile.am | 18 ++++++++++++------
panels/universal-access/cc-ua-panel.c | 11 +++++++----
.../universal-access.gresource.xml | 7 +++++++
panels/universal-access/zoom-options.c | 6 +++---
4 files changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/panels/universal-access/Makefile.am b/panels/universal-access/Makefile.am
index 2beac7a..62a990c 100644
--- a/panels/universal-access/Makefile.am
+++ b/panels/universal-access/Makefile.am
@@ -3,15 +3,18 @@ cappletname = universal-access
INCLUDES = \
$(PANEL_CFLAGS) \
$(UNIVERSAL_ACCESS_PANEL_CFLAGS) \
- -DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
-I$(top_srcdir)/panels/common/ \
$(NULL)
noinst_LTLIBRARIES = libuniversal-access.la
+BUILT_SOURCES = \
+ cc-ua-resources.c \
+ cc-ua-resources.h
+
libuniversal_access_la_SOURCES = \
+ $(BUILT_SOURCES) \
cc-ua-panel.c \
cc-ua-panel.h \
zoom-options.c \
@@ -19,9 +22,11 @@ libuniversal_access_la_SOURCES = \
libuniversal_access_la_LIBADD = $(PANEL_LIBS) $(UNIVERSAL_ACCESS_PANEL_LIBS)
-uidir = $(pkgdatadir)/ui
-dist_ui_DATA = uap.ui zoom-options.ui
-
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/universal-access.gresource.xml)
+cc-ua-resources.c: universal-access.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_universal_access $<
+cc-ua-resources.h: universal-access.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_universal_access $<
@INTLTOOL_DESKTOP_RULE@
@@ -29,6 +34,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-universal-access-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) universal-access.gresource.xml
-include $(top_srcdir)/git.mk
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 7fe2ce8..413a92e 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -27,7 +27,9 @@
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gdesktop-enums.h>
+
#include "cc-ua-panel.h"
+#include "cc-ua-resources.h"
#include "zoom-options.h"
@@ -616,13 +618,14 @@ cc_ua_panel_init (CcUaPanel *self)
NULL };
priv = self->priv = UA_PANEL_PRIVATE (self);
+ g_resources_register (cc_universal_access_get_resource ());
priv->builder = gtk_builder_new ();
- gtk_builder_add_objects_from_file (priv->builder,
- GNOMECC_UI_DIR "/uap.ui",
- objects,
- &err);
+ gtk_builder_add_objects_from_resource (priv->builder,
+ "/org/gnome/control-center/universal-access/uap.ui",
+ objects,
+ &err);
if (err)
{
diff --git a/panels/universal-access/universal-access.gresource.xml b/panels/universal-access/universal-access.gresource.xml
new file mode 100644
index 0000000..bc07b35
--- /dev/null
+++ b/panels/universal-access/universal-access.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/universal-access">
+ <file preprocess="xml-stripblanks">uap.ui</file>
+ <file preprocess="xml-stripblanks">zoom-options.ui</file>
+ </gresource>
+</gresources>
diff --git a/panels/universal-access/zoom-options.c b/panels/universal-access/zoom-options.c
index 318b1fe..875f440 100644
--- a/panels/universal-access/zoom-options.c
+++ b/panels/universal-access/zoom-options.c
@@ -512,9 +512,9 @@ zoom_options_init (ZoomOptions *self)
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ZOOM_TYPE_OPTIONS, ZoomOptionsPrivate);
priv->builder = gtk_builder_new ();
- gtk_builder_add_from_file (priv->builder,
- GNOMECC_UI_DIR "/zoom-options.ui",
- &err);
+ gtk_builder_add_from_resource (priv->builder,
+ "/org/gnome/control-center/universal-access/zoom-options.ui",
+ &err);
if (err)
{
g_warning ("Could not load interface file: %s", err->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]