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