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

common: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
parent 82f8c136
......@@ -7,13 +7,15 @@ noinst_PROGRAMS = list-languages
AM_CPPFLAGS = \
$(PANEL_CFLAGS) \
$(LIBLANGUAGE_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DUIDIR=\""$(pkgdatadir)/ui"\" \
-DLIBLOCALEDIR=\""$(prefix)/lib/locale"\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DUM_PIXMAP_DIR=\""$(pkgdatadir)/pixmaps"\"
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
BUILT_SOURCES = \
cc-common-resources.c \
cc-common-resources.h
liblanguage_la_SOURCES = \
$(BUILT_SOURCES) \
gdm-languages.h \
gdm-languages.c \
locarchive.h \
......@@ -29,14 +31,16 @@ list_languages_SOURCES = list-languages.c
list_languages_LDADD = liblanguage.la
list_languages_CFLAGS = $(LIBLANGUAGE_CFLAGS)
uidir = $(pkgdatadir)/ui
dist_ui_DATA = \
language-chooser.ui
resource_files = $(shell glib-compile-resources --generate-dependencies $(srcdir)/common.gresource.xml)
cc-common-resources.c: common.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_common $<
cc-common-resources.h: common.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_common $<
rulesdir = $(datadir)/polkit-1/rules.d/
rules_DATA = gnome-control-center.rules
EXTRA_DIST = $(rules_DATA)
EXTRA_DIST = $(rules_DATA) $(resource_files)
CLEANFILES = $(BUILT_SOURCES)
-include $(top_srcdir)/git.mk
......@@ -33,6 +33,7 @@
#include "cc-language-chooser.h"
#include "cc-common-language.h"
#include "cc-common-resources.h"
#include "gdm-languages.h"
gchar *
......@@ -263,7 +264,6 @@ GtkWidget *
cc_language_chooser_new (GtkWidget *parent, gboolean regions)
{
GtkBuilder *builder;
const char *filename;
GError *error = NULL;
GtkWidget *chooser;
GtkWidget *list;
......@@ -275,11 +275,12 @@ cc_language_chooser_new (GtkWidget *parent, gboolean regions)
GtkTreeModel *model;
GtkTreeModel *filter_model;
g_resources_register (cc_common_get_resource ());
builder = gtk_builder_new ();
filename = UIDIR "/language-chooser.ui";
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
filename = "data/language-chooser.ui";
if (!gtk_builder_add_from_file (builder, filename, &error)) {
if (!gtk_builder_add_from_resource (builder,
"/org/gnome/control-center/common/language-chooser.ui",
&error)) {
g_warning ("failed to load language chooser: %s", error->message);
g_error_free (error);
return NULL;
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/common">
<file preprocess="xml-stripblanks">language-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