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

region: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 6f48e0f4
......@@ -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
......@@ -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);
......
......@@ -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);
......
<?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>
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