[gnome-control-center] color: use a GResource for GtkBuilder UI definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] color: use a GResource for GtkBuilder UI definition
- Date: Mon, 7 Jan 2013 10:04:54 +0000 (UTC)
commit bd7e87babe3efc6be79aa8b5d425ad845e2c3be2
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 4 13:35:58 2013 +0100
color: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
panels/color/Makefile.am | 17 ++++++++++++-----
panels/color/cc-color-panel.c | 8 +++++---
panels/color/color.gresource.xml | 6 ++++++
3 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/panels/color/Makefile.am b/panels/color/Makefile.am
index f1c1fa3..dfa96df 100644
--- a/panels/color/Makefile.am
+++ b/panels/color/Makefile.am
@@ -5,22 +5,28 @@ cappletname = color
INCLUDES = \
$(PANEL_CFLAGS) \
$(COLOR_PANEL_CFLAGS) \
- -DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DBINDIR="\"$(bindir)\"" \
- -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
$(NULL)
noinst_LTLIBRARIES = libcolor.la
+BUILT_SOURCES = \
+ cc-color-resources.h \
+ cc-color-resources.c
+
libcolor_la_SOURCES = \
+ $(BUILT_SOURCES) \
cc-color-panel.c \
cc-color-panel.h
libcolor_la_LIBADD = $(PANEL_LIBS) $(COLOR_PANEL_LIBS)
-uidir = $(pkgdatadir)/ui
-dist_ui_DATA = color.ui
+resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/color.gresource.xml)
+cc-color-resources.c: color.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_color $<
+cc-color-resources.h: color.gresource.xml $(resource_files)
+ $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_color $<
@INTLTOOL_DESKTOP_RULE@
@@ -28,6 +34,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-color-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) color.gresource.xml
-include $(top_srcdir)/git.mk
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 431704f..84c1d82 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -27,6 +27,7 @@
#include <gdk/gdkx.h>
#include "cc-color-panel.h"
+#include "cc-color-resources.h"
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
@@ -2115,11 +2116,12 @@ cc_color_panel_init (CcColorPanel *prefs)
GtkWidget *widget;
priv = prefs->priv = COLOR_PANEL_PRIVATE (prefs);
+ g_resources_register (cc_color_get_resource ());
priv->builder = gtk_builder_new ();
- gtk_builder_add_from_file (priv->builder,
- GNOMECC_UI_DIR "/color.ui",
- &error);
+ gtk_builder_add_from_resource (priv->builder,
+ "/org/gnome/control-center/color/color.ui",
+ &error);
if (error != NULL)
{
diff --git a/panels/color/color.gresource.xml b/panels/color/color.gresource.xml
new file mode 100644
index 0000000..0dda0e5
--- /dev/null
+++ b/panels/color/color.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/color">
+ <file preprocess="xml-stripblanks">color.ui</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]