[goffice] plugins: embed the rest of the ui files



commit b7cf110b895a3ca09649fca799c38636b67cd828
Author: Morten Welinder <terra gnome org>
Date:   Sat Dec 3 20:56:14 2011 -0500

    plugins: embed the rest of the ui files

 ChangeLog                          |    4 ++++
 NEWS                               |    2 +-
 plugins/smoothing/.gitignore       |    1 +
 plugins/smoothing/Makefile.am      |   36 ++++++++++++++++++++++++++----------
 plugins/smoothing/gog-exp-smooth.c |    7 +++----
 plugins/smoothing/gog-moving-avg.c |    7 +++----
 plugins/smoothing/plugin.c         |    5 +++++
 7 files changed, 43 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 748dcb8..a3bbdb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-12-03  Morten Welinder  <terra gnome org>
 
+	* plugins/reg_linear: embed ui files into plugin.
+	* plugins/reg_logfit: embed ui files into plugin.
+	* plugins/smoothing: embed ui files into plugin.
+
 	* plugins/plot_pie: embed stuff like plot_xy.
 	* plugins/plot_radar: embed stuff like plot_xy.
 
diff --git a/NEWS b/NEWS
index 95e2873..2246b32 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Andreas:
 Morten:
 	* Embed library ui files into library.
 	* Embed svg-patterns.xml and error bar image files too.
-	* Embed icons into plugins.
+	* Embed icons and ui files into plugins.
 
 --------------------------------------------------------------------------
 goffice 0.9.1:
diff --git a/plugins/smoothing/.gitignore b/plugins/smoothing/.gitignore
index 30a340f..9ba7be2 100644
--- a/plugins/smoothing/.gitignore
+++ b/plugins/smoothing/.gitignore
@@ -7,3 +7,4 @@ plugin.xml
 *.loT
 .libs
 *.la
+embedded-stuff.c
diff --git a/plugins/smoothing/Makefile.am b/plugins/smoothing/Makefile.am
index 8c52d74..73dae82 100644
--- a/plugins/smoothing/Makefile.am
+++ b/plugins/smoothing/Makefile.am
@@ -1,32 +1,48 @@
 goffice_graph_smoothingdir = $(goffice_plugindir)/smoothing
 xmldir	 = $(goffice_graph_smoothingdir)
-uidir = $(goffice_graph_smoothingdir)
 
 goffice_graph_smoothing_LTLIBRARIES = smoothing.la
 smoothing_la_LDFLAGS = -module $(GOFFICE_PLUGIN_FLAGS)
 smoothing_la_LIBADD = $(GOFFICE_PLUGIN_LIBADD)
 
 smoothing_la_SOURCES =	\
-			gog-moving-avg.c	\
-		    gog-moving-avg.h \
-			gog-exp-smooth.c	\
-		    gog-exp-smooth.h \
-			plugin.c
+	gog-moving-avg.c	\
+	gog-moving-avg.h	\
+	gog-exp-smooth.c	\
+	gog-exp-smooth.h	\
+	plugin.c
 
 xml_in_files = plugin.xml.in types.xml.in
 xml_DATA = $(xml_in_files:.xml.in=.xml)
 
 @INTLTOOL_XML_RULE@
 
-dist_ui_DATA =	\
-			gog-moving-avg.ui	\
-			gog-exp-smooth.ui
-
 # Do not use the intl-tool stuff to merge the text back;
 # it's simpler to just use gettext directly
 types.xml : types.xml.in
 	cp $< $@
 
+embedded_stuff_raw =
+
+embedded_stuff_compress = \
+	gog-moving-avg.ui	\
+	gog-exp-smooth.ui
+
+embedded_stuff = $(embedded_stuff_compress) $(embedded_stuff_raw)
+
+embedded-stuff.c: $(top_srcdir)/tools/embedder $(embedded_stuff)
+	cd $(srcdir) && @PERL@ $(abs_top_srcdir)/tools/embedder \
+		--id-prefix=go:smoothing/ \
+		--static \
+		--register-function=register_embedded_stuff \
+		--unregister-function=unregister_embedded_stuff \
+		NOCOMPRESS $(embedded_stuff_raw) \
+		COMPRESS $(embedded_stuff_compress) \
+		>$(abs_builddir)/$@
+
+BUILT_SOURCES =	embedded-stuff.c
+CLEANFILES = $(BUILT_SOURCES)
+
 EXTRA_DIST = $(xml_in_files)
 DISTCLEANFILES = $(xml_in_files:.xml.in=.xml)
 
diff --git a/plugins/smoothing/gog-exp-smooth.c b/plugins/smoothing/gog-exp-smooth.c
index f6170c0..6e60b9c 100644
--- a/plugins/smoothing/gog-exp-smooth.c
+++ b/plugins/smoothing/gog-exp-smooth.c
@@ -55,10 +55,9 @@ gog_exp_smooth_populate_editor (GogObject *obj,
 {
 	GogExpSmooth *es = GOG_EXP_SMOOTH (obj);
 	GogDataset *set = GOG_DATASET (obj);
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_smoothing"));
-	char	 *path = g_build_filename (dir, "gog-exp-smooth.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:smoothing/gog-exp-smooth.ui",
+				    GETTEXT_PACKAGE, cc);
 	GtkWidget *label, *box, *w = go_gtk_builder_get_widget (gui, "steps");
 	GtkTable *table;
 
diff --git a/plugins/smoothing/gog-moving-avg.c b/plugins/smoothing/gog-moving-avg.c
index 98e704c..36b4afd 100644
--- a/plugins/smoothing/gog-moving-avg.c
+++ b/plugins/smoothing/gog-moving-avg.c
@@ -96,10 +96,9 @@ gog_moving_avg_populate_editor (GogObject *obj,
 				GOCmdContext *cc)
 {
 	GogMovingAvg *ma = GOG_MOVING_AVG (obj);
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_smoothing"));
-	char	 *path = g_build_filename (dir, "gog-moving-avg.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:smoothing/gog-moving-avg.ui",
+				    GETTEXT_PACKAGE, cc);
 	GtkWidget *w = go_gtk_builder_get_widget (gui, "span");
 	gtk_widget_set_tooltip_text (w, _("Number of values from which to calculate an average"));
 	gtk_spin_button_set_range (GTK_SPIN_BUTTON (w), 2, G_MAXINT);
diff --git a/plugins/smoothing/plugin.c b/plugins/smoothing/plugin.c
index bcc64d5..3ceb687 100644
--- a/plugins/smoothing/plugin.c
+++ b/plugins/smoothing/plugin.c
@@ -25,6 +25,8 @@
 #include "gog-moving-avg.h"
 #include "gog-exp-smooth.h"
 
+#include "embedded-stuff.c"
+
 GOFFICE_PLUGIN_MODULE_HEADER;
 
 /* Plugin initialization */
@@ -35,9 +37,12 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
 	GTypeModule *module = go_plugin_get_type_module (plugin);
 	gog_moving_avg_register_type (module);
 	gog_exp_smooth_register_type (module);
+
+	register_embedded_stuff ();
 }
 
 G_MODULE_EXPORT void
 go_plugin_shutdown (GOPlugin *plugin, GOCmdContext *cc)
 {
+	unregister_embedded_stuff ();
 }



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