Commit bd7e87ba authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Bastien Nocera
Browse files

color: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent ddf9d29f
...@@ -5,22 +5,28 @@ cappletname = color ...@@ -5,22 +5,28 @@ cappletname = color
INCLUDES = \ INCLUDES = \
$(PANEL_CFLAGS) \ $(PANEL_CFLAGS) \
$(COLOR_PANEL_CFLAGS) \ $(COLOR_PANEL_CFLAGS) \
-DGNOMECC_UI_DIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DBINDIR="\"$(bindir)\"" \ -DBINDIR="\"$(bindir)\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
$(NULL) $(NULL)
noinst_LTLIBRARIES = libcolor.la noinst_LTLIBRARIES = libcolor.la
BUILT_SOURCES = \
cc-color-resources.h \
cc-color-resources.c
libcolor_la_SOURCES = \ libcolor_la_SOURCES = \
$(BUILT_SOURCES) \
cc-color-panel.c \ cc-color-panel.c \
cc-color-panel.h cc-color-panel.h
libcolor_la_LIBADD = $(PANEL_LIBS) $(COLOR_PANEL_LIBS) libcolor_la_LIBADD = $(PANEL_LIBS) $(COLOR_PANEL_LIBS)
uidir = $(pkgdatadir)/ui resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/color.gresource.xml)
dist_ui_DATA = color.ui 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@ @INTLTOOL_DESKTOP_RULE@
...@@ -28,6 +34,7 @@ desktopdir = $(datadir)/applications ...@@ -28,6 +34,7 @@ desktopdir = $(datadir)/applications
desktop_in_files = gnome-color-panel.desktop.in desktop_in_files = gnome-color-panel.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) 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 -include $(top_srcdir)/git.mk
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include "cc-color-panel.h" #include "cc-color-panel.h"
#include "cc-color-resources.h"
#define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w) #define WID(b, w) (GtkWidget *) gtk_builder_get_object (b, w)
...@@ -2115,11 +2116,12 @@ cc_color_panel_init (CcColorPanel *prefs) ...@@ -2115,11 +2116,12 @@ cc_color_panel_init (CcColorPanel *prefs)
GtkWidget *widget; GtkWidget *widget;
priv = prefs->priv = COLOR_PANEL_PRIVATE (prefs); priv = prefs->priv = COLOR_PANEL_PRIVATE (prefs);
g_resources_register (cc_color_get_resource ());
priv->builder = gtk_builder_new (); priv->builder = gtk_builder_new ();
gtk_builder_add_from_file (priv->builder, gtk_builder_add_from_resource (priv->builder,
GNOMECC_UI_DIR "/color.ui", "/org/gnome/control-center/color/color.ui",
&error); &error);
if (error != NULL) if (error != NULL)
{ {
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/color">
<file preprocess="xml-stripblanks">color.ui</file>
</gresource>
</gresources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment