[goffice] plot_distrib: embed stuff like plot_xy



commit 56d0e48d234b8e297b25381dd8bf92c2fcabdc10
Author: Morten Welinder <terra gnome org>
Date:   Sat Dec 3 20:04:49 2011 -0500

    plot_distrib: embed stuff like plot_xy

 ChangeLog                                          |    2 +
 pixmaps/Makefile.am                                |    5 ---
 plugins/plot_distrib/.gitignore                    |    1 +
 plugins/plot_distrib/Makefile.am                   |   37 +++++++++++++++++---
 .../plot_distrib}/chart_boxplot_1_1.png            |  Bin 1819 -> 1819 bytes
 .../plot_distrib}/chart_boxplot_1_1.svg            |    0
 .../plot_distrib}/chart_boxplot_1_2.png            |  Bin 1971 -> 1971 bytes
 .../plot_distrib}/chart_boxplot_1_2.svg            |    0
 .../plot_distrib}/chart_boxplot_2_1.png            |  Bin 2226 -> 2226 bytes
 .../plot_distrib}/chart_boxplot_2_1.svg            |    0
 .../plot_distrib}/chart_boxplot_2_2.png            |  Bin 2372 -> 2372 bytes
 .../plot_distrib}/chart_boxplot_2_2.svg            |    0
 .../plot_distrib}/chart_histogram_1_1.png          |  Bin 1798 -> 1798 bytes
 .../plot_distrib}/chart_histogram_1_1.svg          |    0
 .../plot_distrib}/chart_histogram_1_2.png          |  Bin 1918 -> 1918 bytes
 .../plot_distrib}/chart_histogram_1_2.svg          |    0
 .../plot_distrib}/chart_histogram_1_3.png          |  Bin 2321 -> 2321 bytes
 .../plot_distrib}/chart_histogram_1_3.svg          |    0
 .../plot_distrib}/chart_histogram_1_4.png          |  Bin 2493 -> 2493 bytes
 .../plot_distrib}/chart_histogram_1_4.svg          |    0
 .../plot_distrib}/chart_histogram_2_1.png          |  Bin 1891 -> 1891 bytes
 .../plot_distrib}/chart_histogram_2_1.svg          |    0
 .../plot_distrib}/chart_prob_1_1.png               |  Bin 2358 -> 2358 bytes
 .../plot_distrib}/chart_prob_1_1.svg               |    0
 plugins/plot_distrib/gog-boxplot.c                 |   12 +++----
 plugins/plot_distrib/gog-histogram.c               |   19 +++-------
 plugins/plot_distrib/plot-types.xml.in             |   18 +++++-----
 plugins/plot_distrib/plugin.c                      |    5 +++
 28 files changed, 60 insertions(+), 39 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 46cf40c..80df221 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-12-03  Morten Welinder  <terra gnome org>
 
+	* plugins/plot_distrib: embed stuff like plot_xy.
+
 	* goffice/graph/gog-error-bar.c (display_combo_desc): Embed error
 	bar pixmaps.
 
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
index 5c3c6ab..232a4ff 100644
--- a/pixmaps/Makefile.am
+++ b/pixmaps/Makefile.am
@@ -18,11 +18,6 @@ dist_icon_DATA = \
 	chart_pie_2_1.png	chart_pie_2_2.png	chart_pie_2_3.png	\
 	chart_pie_3_1.png	chart_pie_3_2.png	\
 	chart_ring_1_1.png 	chart_ring_1_2.png \
-	chart_boxplot_1_1.png	chart_boxplot_1_2.png \
-	chart_boxplot_2_1.png	chart_boxplot_2_2.png \
-	chart_histogram_1_1.png chart_histogram_2_1.png \
-	chart_histogram_1_3.png chart_histogram_1_4.png \
-	chart_prob_1_1.png \
 	\
 	area.xpm 	\
 	bar.xpm		\
diff --git a/plugins/plot_distrib/.gitignore b/plugins/plot_distrib/.gitignore
index ed61633..569ece7 100644
--- a/plugins/plot_distrib/.gitignore
+++ b/plugins/plot_distrib/.gitignore
@@ -6,3 +6,4 @@ plugin.xml
 .libs
 *.lo
 *.la
+embedded-stuff.c
diff --git a/plugins/plot_distrib/Makefile.am b/plugins/plot_distrib/Makefile.am
index 7ef3df6..158cb49 100644
--- a/plugins/plot_distrib/Makefile.am
+++ b/plugins/plot_distrib/Makefile.am
@@ -22,11 +22,6 @@ if WITH_GTK
 	go-distribution-prefs.c	\
 	go-distribution-prefs.h
 endif
-ui_DATA = \
-	gog-boxplot-prefs.ui \
-	gog-histogram-prefs.ui \
-	gog-double-histogram-prefs.ui
-
 @INTLTOOL_XML_RULE@
 
 # do not use the intl-tool stuff to merge the text back
@@ -34,6 +29,38 @@ ui_DATA = \
 plot-types.xml : plot-types.xml.in
 	cp $< $@
 
+embedded_stuff_raw = \
+	chart_boxplot_1_1.png	\
+	chart_boxplot_1_2.png	\
+	chart_boxplot_2_1.png	\
+	chart_boxplot_2_2.png	\
+	chart_histogram_1_1.png	\
+	chart_histogram_1_2.png	\
+	chart_histogram_1_3.png	\
+	chart_histogram_1_4.png	\
+	chart_histogram_2_1.png	\
+	chart_prob_1_1.png
+
+embedded_stuff_compress = \
+	gog-boxplot-prefs.ui \
+	gog-histogram-prefs.ui \
+	gog-double-histogram-prefs.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:plot_distrib/ \
+		--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) $(ui_DATA)
 DISTCLEANFILES = $(xml_in_files:.xml.in=.xml)
 
diff --git a/pixmaps/chart_boxplot_1_1.png b/plugins/plot_distrib/chart_boxplot_1_1.png
similarity index 100%
rename from pixmaps/chart_boxplot_1_1.png
rename to plugins/plot_distrib/chart_boxplot_1_1.png
diff --git a/pixmaps/chart_boxplot_1_1.svg b/plugins/plot_distrib/chart_boxplot_1_1.svg
similarity index 100%
rename from pixmaps/chart_boxplot_1_1.svg
rename to plugins/plot_distrib/chart_boxplot_1_1.svg
diff --git a/pixmaps/chart_boxplot_1_2.png b/plugins/plot_distrib/chart_boxplot_1_2.png
similarity index 100%
rename from pixmaps/chart_boxplot_1_2.png
rename to plugins/plot_distrib/chart_boxplot_1_2.png
diff --git a/pixmaps/chart_boxplot_1_2.svg b/plugins/plot_distrib/chart_boxplot_1_2.svg
similarity index 100%
rename from pixmaps/chart_boxplot_1_2.svg
rename to plugins/plot_distrib/chart_boxplot_1_2.svg
diff --git a/pixmaps/chart_boxplot_2_1.png b/plugins/plot_distrib/chart_boxplot_2_1.png
similarity index 100%
rename from pixmaps/chart_boxplot_2_1.png
rename to plugins/plot_distrib/chart_boxplot_2_1.png
diff --git a/pixmaps/chart_boxplot_2_1.svg b/plugins/plot_distrib/chart_boxplot_2_1.svg
similarity index 100%
rename from pixmaps/chart_boxplot_2_1.svg
rename to plugins/plot_distrib/chart_boxplot_2_1.svg
diff --git a/pixmaps/chart_boxplot_2_2.png b/plugins/plot_distrib/chart_boxplot_2_2.png
similarity index 100%
rename from pixmaps/chart_boxplot_2_2.png
rename to plugins/plot_distrib/chart_boxplot_2_2.png
diff --git a/pixmaps/chart_boxplot_2_2.svg b/plugins/plot_distrib/chart_boxplot_2_2.svg
similarity index 100%
rename from pixmaps/chart_boxplot_2_2.svg
rename to plugins/plot_distrib/chart_boxplot_2_2.svg
diff --git a/pixmaps/chart_histogram_1_1.png b/plugins/plot_distrib/chart_histogram_1_1.png
similarity index 100%
rename from pixmaps/chart_histogram_1_1.png
rename to plugins/plot_distrib/chart_histogram_1_1.png
diff --git a/pixmaps/chart_histogram_1_1.svg b/plugins/plot_distrib/chart_histogram_1_1.svg
similarity index 100%
rename from pixmaps/chart_histogram_1_1.svg
rename to plugins/plot_distrib/chart_histogram_1_1.svg
diff --git a/pixmaps/chart_histogram_1_2.png b/plugins/plot_distrib/chart_histogram_1_2.png
similarity index 100%
rename from pixmaps/chart_histogram_1_2.png
rename to plugins/plot_distrib/chart_histogram_1_2.png
diff --git a/pixmaps/chart_histogram_1_2.svg b/plugins/plot_distrib/chart_histogram_1_2.svg
similarity index 100%
rename from pixmaps/chart_histogram_1_2.svg
rename to plugins/plot_distrib/chart_histogram_1_2.svg
diff --git a/pixmaps/chart_histogram_1_3.png b/plugins/plot_distrib/chart_histogram_1_3.png
similarity index 100%
rename from pixmaps/chart_histogram_1_3.png
rename to plugins/plot_distrib/chart_histogram_1_3.png
diff --git a/pixmaps/chart_histogram_1_3.svg b/plugins/plot_distrib/chart_histogram_1_3.svg
similarity index 100%
rename from pixmaps/chart_histogram_1_3.svg
rename to plugins/plot_distrib/chart_histogram_1_3.svg
diff --git a/pixmaps/chart_histogram_1_4.png b/plugins/plot_distrib/chart_histogram_1_4.png
similarity index 100%
rename from pixmaps/chart_histogram_1_4.png
rename to plugins/plot_distrib/chart_histogram_1_4.png
diff --git a/pixmaps/chart_histogram_1_4.svg b/plugins/plot_distrib/chart_histogram_1_4.svg
similarity index 100%
rename from pixmaps/chart_histogram_1_4.svg
rename to plugins/plot_distrib/chart_histogram_1_4.svg
diff --git a/pixmaps/chart_histogram_2_1.png b/plugins/plot_distrib/chart_histogram_2_1.png
similarity index 100%
rename from pixmaps/chart_histogram_2_1.png
rename to plugins/plot_distrib/chart_histogram_2_1.png
diff --git a/pixmaps/chart_histogram_2_1.svg b/plugins/plot_distrib/chart_histogram_2_1.svg
similarity index 100%
rename from pixmaps/chart_histogram_2_1.svg
rename to plugins/plot_distrib/chart_histogram_2_1.svg
diff --git a/pixmaps/chart_prob_1_1.png b/plugins/plot_distrib/chart_prob_1_1.png
similarity index 100%
rename from pixmaps/chart_prob_1_1.png
rename to plugins/plot_distrib/chart_prob_1_1.png
diff --git a/pixmaps/chart_prob_1_1.svg b/plugins/plot_distrib/chart_prob_1_1.svg
similarity index 100%
rename from pixmaps/chart_prob_1_1.svg
rename to plugins/plot_distrib/chart_prob_1_1.svg
diff --git a/plugins/plot_distrib/gog-boxplot.c b/plugins/plot_distrib/gog-boxplot.c
index 287c0cb..d8157ed 100644
--- a/plugins/plot_distrib/gog-boxplot.c
+++ b/plugins/plot_distrib/gog-boxplot.c
@@ -109,15 +109,13 @@ display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
 static gpointer
 gog_box_plot_pref (GogObject *obj,
 		   GogDataAllocator *dalloc, GOCmdContext *cc)
-{
-	GtkWidget  *w;
+{	
 	GogBoxPlot *boxplot = GOG_BOX_PLOT (obj);
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_plot_distrib"));
-	char	 *path = g_build_filename (dir, "gog-boxplot-prefs.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_distrib/gog-boxplot-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
+	GtkWidget *w;
 
-	g_free (path);
         if (gui == NULL)
                 return NULL;
 
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index 9ede760..bd7514a 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -310,12 +310,9 @@ gog_histogram_plot_populate_editor (GogObject *item,
 {
 	GtkWidget  *w;
 	GogHistogramPlot *hist = GOG_HISTOGRAM_PLOT (item);
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_plot_distrib"));
-	char	 *path = g_build_filename (dir, "gog-histogram-prefs.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
-
-	g_free (path);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_distrib/gog-histogram-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
         if (gui != NULL) {
 		w = go_gtk_builder_get_widget (gui, "vertical");
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), hist->vertical);
@@ -431,13 +428,9 @@ gog_double_histogram_plot_populate_editor (GogObject	*gobj,
 	GtkTable *table;
 	GtkWidget *w;
 	GogDataset *set = GOG_DATASET (gobj);
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_plot_distrib"));
-	char	 *path = g_build_filename (dir, "gog-double-histogram-prefs.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
-
-	g_free (path);
-
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_distrib/gog-double-histogram-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 	if (gui != NULL) {
 		table = GTK_TABLE (gtk_builder_get_object (gui, "double-histogram-prefs"));
 		w = GTK_WIDGET (gog_data_allocator_editor (dalloc, set, 0, GOG_DATA_SCALAR));
diff --git a/plugins/plot_distrib/plot-types.xml.in b/plugins/plot_distrib/plot-types.xml.in
index cd6af3c..3d574ea 100644
--- a/plugins/plot_distrib/plot-types.xml.in
+++ b/plugins/plot_distrib/plot-types.xml.in
@@ -5,27 +5,27 @@
 	<Type _name="HBoxPlots" row="1" col="1"
 		engine="GogBoxPlot" family="Statistics"
 		_description="Horizontal Box-Plot."
-		sample_image_file="chart_boxplot_1_1.png">
+		sample_image_file="res:go:plot_distrib/chart_boxplot_1_1.png">
 		<property name="guru-hints">backplane</property>
 	</Type>
 	<Type _name="VBoxPlots" row="1" col="2"
 		engine="GogBoxPlot" family="Statistics"
 		_description="Vertical Box-Plot."
-		sample_image_file="chart_boxplot_1_2.png">
+		sample_image_file="res:go:plot_distrib/chart_boxplot_1_2.png">
 		<property name="vertical">true</property>
 		<property name="guru-hints">backplane</property>
 	</Type>
 	<Type _name="HBoxPlotOutliers" row="2" col="1"
 		engine="GogBoxPlot" family="Statistics"
 		_description="Horizontal Box-Plot showing outliers."
-		sample_image_file="chart_boxplot_2_1.png">
+		sample_image_file="res:go:plot_distrib/chart_boxplot_2_1.png">
 		<property name="outliers">true</property>
 		<property name="guru-hints">backplane</property>
 	</Type>
 	<Type _name="VBoxPlotOutliers" row="2" col="2"
 		engine="GogBoxPlot" family="Statistics"
 		_description="Vertical Box-Plot showing outliers."
-		sample_image_file="chart_boxplot_2_2.png">
+		sample_image_file="res:go:plot_distrib/chart_boxplot_2_2.png">
 		<property name="outliers">true</property>
 		<property name="vertical">true</property>
 		<property name="guru-hints">backplane</property>
@@ -33,32 +33,32 @@
 	<Type _name="Histogram" row="3" col="1"
 		engine="GogHistogramPlot" family="Statistics"
 		_description="Histogram."
-		sample_image_file="chart_histogram_1_1.png">
+		sample_image_file="res:go:plot_distrib/chart_histogram_1_1.png">
 		<property name="guru-hints">backplane</property>
 	</Type>
 	<Type _name="CumulativeHistogram" row="3" col="2"
 		engine="GogHistogramPlot" family="Statistics"
 		_description="Cumulative histogram."
-		sample_image_file="chart_histogram_2_1.png">
+		sample_image_file="res:go:plot_distrib/chart_histogram_2_1.png">
 		<property name="guru-hints">backplane</property>
 		<property name="cumulative">true</property>
 	</Type>
 <!--	<Type _name="DoubleHistogram" row="3" col="3"
 		engine="GogDoubleHistogramPlot" family="Statistics"
 		_description="Double histogram."
-		sample_image_file="chart_histogram_1_3.png">
+		sample_image_file="res:go:plot_distrib/chart_histogram_1_3.png">
 		<property name="guru-hints">backplane</property>
 	</Type>
 	<Type _name="PopulationPyramid" row="3" col="4"
 		engine="GogDoubleHistogramPlot" family="Statistics"
 		_description="Population pyramid."
-		sample_image_file="chart_histogram_1_4.png">
+		sample_image_file="res:go:plot_distrib/chart_histogram_1_4.png">
 		<property name="guru-hints">backplane</property>
 		<property name="vertical">false</property>
 	</Type> -->
 	<Type _name="ProbabilityPlot" row="4" col="1"
 		engine="GogProbabilityPlot" family="Statistics"
 		_description="Probability plot."
-		sample_image_file="chart_prob_1_1.png">
+		sample_image_file="res:go:plot_distrib/chart_prob_1_1.png">
 	</Type>
 </Types>
diff --git a/plugins/plot_distrib/plugin.c b/plugins/plot_distrib/plugin.c
index c062bba..3431c5c 100644
--- a/plugins/plot_distrib/plugin.c
+++ b/plugins/plot_distrib/plugin.c
@@ -22,6 +22,8 @@
 #include <goffice/goffice-config.h>
 #include <goffice/app/module-plugin-defs.h>
 
+#include "embedded-stuff.c"
+
 GOFFICE_PLUGIN_MODULE_HEADER;
 
 /* Plugin initialization */
@@ -54,9 +56,12 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
 	gog_probability_plot_view_register_type (module);
 	gog_probability_plot_series_register_type (module);
 	gog_probability_plot_series_view_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]