[gnome-control-center] region: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:05:49 +0000 (UTC)
commit 887c3ae3d50a5e6462bfbfca4eae5c9dc28e87d0
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 16:04:21 2013 +0100
region: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/region/Makefile.am | 24 +++++++++++++-----------
panels/region/cc-region-panel.c | 9 ++++++---
panels/region/gnome-region-panel-input.c | 6 +++---
panels/region/region.gresource.xml | 7 +++++++
4 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/panels/region/Makefile.am b/panels/region/Makefile.am
index f9eec81..f66f5ef 100644
--- a/panels/region/Makefile.am
+++ b/panels/region/Makefile.am
@@ -5,14 +5,17 @@ INCLUDES = \
$(PANEL_CFLAGS) \
$(REGION_PANEL_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
- -DGNOMECC_UI_DIR="\"$(uidir)\"" \
-I$(srcdir)/../common/ \
$(NULL)
noinst_LTLIBRARIES = libregion.la
+BUILT_SOURCES = \
+ cc-region-resources.c \
+ cc-region-resources.h
+
libregion_la_SOURCES = \
+ $(BUILT_SOURCES) \
cc-region-panel.c \
cc-region-panel.h \
gnome-region-panel-formats.c \
@@ -27,20 +30,19 @@ libregion_la_SOURCES = \
libregion_la_LIBADD = $(PANEL_LIBS) $(REGION_PANEL_LIBS) $(builddir)/../common/liblanguage.la
- INTLTOOL_DESKTOP_RULE@
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/region.gresource.xml)
+cc-region-resources.c: region.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_region $<
+cc-region-resources.h: region.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_region $<
-uidir = $(pkgdatadir)/ui
-ui_DATA = \
- gnome-region-panel.ui \
- gnome-region-panel-input-chooser.ui \
- $(NULL)
+ INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
Desktop_in_files = gnome-region-panel.desktop.in
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
-CLEANFILES = $(Desktop_in_files) $(desktop_DATA)
-EXTRA_DIST = $(ui_DATA)
-
+CLEANFILES = $(Desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
+EXTRA_DIST = $(resource_files) region.gresource.xml
-include $(top_srcdir)/git.mk
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index d7cb828..6e59e7f 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -20,6 +20,8 @@
*/
#include "cc-region-panel.h"
+#include "cc-region-resources.h"
+
#include <gtk/gtk.h>
#include "gnome-region-panel-input.h"
@@ -137,12 +139,13 @@ cc_region_panel_init (CcRegionPanel * self)
GError *error = NULL;
priv = self->priv = REGION_PANEL_PRIVATE (self);
+ g_resources_register (cc_region_get_resource ());
priv->builder = gtk_builder_new ();
- gtk_builder_add_from_file (priv->builder,
- GNOMECC_UI_DIR "/gnome-region-panel.ui",
- &error);
+ gtk_builder_add_from_resource (priv->builder,
+ "/org/gnome/control-center/region/gnome-region-panel.ui",
+ &error);
if (error != NULL) {
g_warning ("Error loading UI file: %s", error->message);
g_error_free (error);
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index bd4f04b..3023eb0 100644
--- a/panels/region/gnome-region-panel-input.c
+++ b/panels/region/gnome-region-panel-input.c
@@ -1390,9 +1390,9 @@ input_chooser_new (GtkWindow *main_window,
GtkTreeIter iter;
builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder,
- GNOMECC_UI_DIR "/gnome-region-panel-input-chooser.ui",
- NULL);
+ gtk_builder_add_from_resource (builder,
+ "/org/gnome/control-center/region/gnome-region-panel-input-chooser.ui",
+ NULL);
chooser = WID ("input_source_chooser");
input_chooser = chooser;
g_object_add_weak_pointer (G_OBJECT (chooser), (gpointer *) &input_chooser);
diff --git a/panels/region/region.gresource.xml b/panels/region/region.gresource.xml
new file mode 100644
index 0000000..02b8d98
--- /dev/null
+++ b/panels/region/region.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/region">
+ <file preprocess="xml-stripblanks">gnome-region-panel.ui</file>
+ <file preprocess="xml-stripblanks">gnome-region-panel-input-chooser.ui</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]