shell: use a GResource for GtkBuilder UI definition

https://bugzilla.gnome.org/show_bug.cgi?id=691132
This commit is contained in:
Cosimo Cecchi 2013-01-04 17:10:52 +01:00
parent 57adcbe951
commit d2cb481c54
3 changed files with 21 additions and 8 deletions

View file

@ -5,7 +5,12 @@ INCLUDES = \
bin_PROGRAMS = gnome-control-center bin_PROGRAMS = gnome-control-center
BUILT_SOURCES = \
cc-shell-resources.c \
cc-shell-resources.h
gnome_control_center_SOURCES = \ gnome_control_center_SOURCES = \
$(BUILT_SOURCES) \
control-center.c \ control-center.c \
cc-shell-log.c \ cc-shell-log.c \
cc-shell-log.h \ cc-shell-log.h \
@ -66,12 +71,13 @@ if BUILD_BLUETOOTH
gnome_control_center_LDADD += $(top_builddir)/panels/bluetooth/libbluetooth.la gnome_control_center_LDADD += $(top_builddir)/panels/bluetooth/libbluetooth.la
endif endif
AM_CPPFLAGS = \ AM_CPPFLAGS = -DGNOMELOCALEDIR="\"$(datadir)/locale\""
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DUIDIR="\"$(uidir)\""
uidir = $(pkgdatadir)/ui resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/shell.gresource.xml)
ui_DATA = shell.ui cc-shell-resources.c: shell.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name cc_shell $<
cc-shell-resources.h: shell.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_shell $<
sysdir = $(datadir)/applications sysdir = $(datadir)/applications
sys_in_files = gnome-control-center.desktop.in sys_in_files = gnome-control-center.desktop.in
@ -85,12 +91,13 @@ gnome_control_center_completion.bash: gnome_control_center_completion.bash.in li
$(AM_V_GEN) cat $< | sed "s,@PANELS@,`$(srcdir)/list-panel.sh $(top_srcdir)`," > $@ $(AM_V_GEN) cat $< | sed "s,@PANELS@,`$(srcdir)/list-panel.sh $(top_srcdir)`," > $@
EXTRA_DIST = \ EXTRA_DIST = \
$(ui_DATA) \ $(resource_files) \
shell.gresource.xml \
gnome-control-center.desktop.in.in \ gnome-control-center.desktop.in.in \
$(completion_in_files) \ $(completion_in_files) \
list-panel.sh list-panel.sh
CLEANFILES = $(completion_DATA) CLEANFILES = $(BUILT_SOURCES) $(completion_DATA)
DISTCLEANFILES = gnome-control-center.desktop gnome-control-center.desktop.in DISTCLEANFILES = gnome-control-center.desktop gnome-control-center.desktop.in
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View file

@ -1236,7 +1236,7 @@ gnome_control_center_init (GnomeControlCenter *self)
/* load the user interface */ /* load the user interface */
priv->builder = gtk_builder_new (); priv->builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (priv->builder, UIDIR "/shell.ui", &err)) if (!gtk_builder_add_from_resource (priv->builder, "/org/gnome/control-center/shell/shell.ui", &err))
{ {
g_critical ("Could not build interface: %s", err->message); g_critical ("Could not build interface: %s", err->message);
g_error_free (err); g_error_free (err);

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/shell">
<file preprocess="xml-stripblanks">shell.ui</file>
</gresource>
</gresources>