[eog-plugins] exif-display: Embed UI data files with GResource



commit ece06e8f69b2d40a047e1484a8bdd7c534a291b2
Author: Felix Riemann <friemann gnome org>
Date:   Sat Dec 22 17:45:26 2012 +0100

    exif-display: Embed UI data files with GResource

 plugins/exif-display/Makefile.am                   |   29 +++++++++++++++-----
 .../exif-display/eog-exif-display-plugin-setup.c   |    7 +++--
 plugins/exif-display/eog-exif-display-plugin.c     |    8 +++---
 .../eog-exif-display-plugin.gresource.xml          |    7 +++++
 4 files changed, 37 insertions(+), 14 deletions(-)
---
diff --git a/plugins/exif-display/Makefile.am b/plugins/exif-display/Makefile.am
index 0fcb202..d2a099d 100644
--- a/plugins/exif-display/Makefile.am
+++ b/plugins/exif-display/Makefile.am
@@ -12,7 +12,11 @@ INCLUDES = \
 
 plugin_LTLIBRARIES = libexif-display.la
 
+BUILT_SOURCES = \
+	eog-exif-display-plugin-resources.c
+
 libexif_display_la_SOURCES = \
+	${BUILT_SOURCES}				\
 	eog-exif-display-plugin.h			\
 	eog-exif-display-plugin.c			\
 	eog-exif-display-plugin-settings.h		\
@@ -22,16 +26,17 @@ libexif_display_la_SOURCES = \
 libexif_display_la_LDFLAGS = \
 	-avoid-version -module
 
-libexif_display_la_LIBADD = $(EOG_LIBS)			\
+libexif_display_la_LIBADD = \
+	$(EOG_LIBS)		\
 	$(EXIFDISPLAY_LIBS)
 
+eog-exif-display-plugin-resources.c: eog-exif-display-plugin.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/eog-exif-display-plugin.gresource.xml)
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --internal --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/eog-exif-display-plugin.gresource.xml
+
 # Plugin Info
 
 plugin_in_files = exif-display.plugin.desktop.in
 
-UI_FILES = exif-display.ui exif-display-config.ui
-ui_DATA = $(UI_FILES)
-
 %.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(AM_V_GEN)$(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
 plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
@@ -42,11 +47,21 @@ gsettings_SCHEMAS = org.gnome.eog.plugins.exif-display.gschema.xml
 
 EXTRA_DIST = \
 	$(plugin_in_files)	\
-	$(UI_FILES)		\
+	exif-display.ui		\
+	exif-display-config.ui	\
+	eog-exif-display-plugin.gresource.xml	\
 	org.gnome.eog.plugins.exif-display.gschema.xml.in.in
 
-CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
-DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+CLEANFILES = \
+	${BUILT_SOURCES}	\
+	$(plugin_DATA)		\
+	$(gsettings_SCHEMAS)
+
+DISTCLEANFILES = \
+	${BUILT_SOURCES}	\
+	$(plugin_DATA)		\
+	$(gsettings_SCHEMAS)
+
 MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/exif-display/eog-exif-display-plugin-setup.c b/plugins/exif-display/eog-exif-display-plugin-setup.c
index 55f3c72..8cc88ee 100644
--- a/plugins/exif-display/eog-exif-display-plugin-setup.c
+++ b/plugins/exif-display/eog-exif-display-plugin-setup.c
@@ -35,7 +35,8 @@
 
 #include "eog-exif-display-plugin-setup.h"
 
-#define GTKBUILDER_CONFIG_FILE EOG_EXIF_DISPLAY_DATA_DIR"/exif-display-config.ui"
+#define GRESOURCE_PATH "/org/gnome/eog/plugins/exif-display/exif-display-config.ui"
+
 
 static void
 peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
@@ -68,9 +69,9 @@ impl_create_config_widget (PeasGtkConfigurable *configurable)
 
 	config_builder = gtk_builder_new ();
 	gtk_builder_set_translation_domain (config_builder, GETTEXT_PACKAGE);
-	if (!gtk_builder_add_objects_from_file (config_builder, GTKBUILDER_CONFIG_FILE, object_ids, &error))
+	if (!gtk_builder_add_objects_from_resource (config_builder, GRESOURCE_PATH, object_ids, &error))
 	{
-		g_warning ("Couldn't load builder file: %s", error->message);
+		g_warning ("Couldn't load UI resource: %s", error->message);
 		g_error_free (error);
 	}
 
diff --git a/plugins/exif-display/eog-exif-display-plugin.c b/plugins/exif-display/eog-exif-display-plugin.c
index 884f484..ef24d40 100644
--- a/plugins/exif-display/eog-exif-display-plugin.c
+++ b/plugins/exif-display/eog-exif-display-plugin.c
@@ -44,7 +44,7 @@
 #include "eog-exif-display-plugin-setup.h"
 #include "eog-exif-display-plugin.h"
 
-#define GTKBUILDER_FILE EOG_EXIF_DISPLAY_DATA_DIR"/exif-display.ui"
+#define GRESOURCE_PATH "/org/gnome/eog/plugins/exif-display/exif-display.ui"
 
 enum {
 	PROP_O,
@@ -652,10 +652,10 @@ impl_activate (EogWindowActivatable *activatable)
 	plugin->sidebar_builder = gtk_builder_new ();
 	gtk_builder_set_translation_domain (plugin->sidebar_builder,
 					    GETTEXT_PACKAGE);
-	if (!gtk_builder_add_from_file (plugin->sidebar_builder,
-					GTKBUILDER_FILE, &error))
+	if (!gtk_builder_add_from_resource (plugin->sidebar_builder,
+					    GRESOURCE_PATH, &error))
 	{
-		g_warning ("Couldn't load builder file: %s", error->message);
+		g_warning ("Couldn't load UI resource: %s", error->message);
 		g_error_free (error);
 	}
 	plugin->gtkbuilder_widget = GTK_WIDGET (gtk_builder_get_object (plugin->sidebar_builder, "viewport1"));
diff --git a/plugins/exif-display/eog-exif-display-plugin.gresource.xml b/plugins/exif-display/eog-exif-display-plugin.gresource.xml
new file mode 100644
index 0000000..baa16d7
--- /dev/null
+++ b/plugins/exif-display/eog-exif-display-plugin.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/eog/plugins/exif-display">
+    <file compressed="true" preprocess="xml-stripblanks">exif-display-config.ui</file>
+    <file preprocess="xml-stripblanks">exif-display.ui</file>
+  </gresource>
+</gresources>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]