[goffice] xy: embed ui files too



commit 73af6617566a7a1a9c48364f6207e3f0c7541886
Author: Morten Welinder <terra gnome org>
Date:   Sat Dec 3 16:13:52 2011 -0500

    xy: embed ui files too

 plugins/plot_xy/Makefile.am        |   27 ++++++++++++++-------------
 plugins/plot_xy/gog-bubble-prefs.c |    8 +++-----
 plugins/plot_xy/gog-xy-dropbar.c   |   11 +++--------
 plugins/plot_xy/gog-xy.c           |   31 +++++++++----------------------
 tools/embedder                     |    4 ++--
 5 files changed, 31 insertions(+), 50 deletions(-)
---
diff --git a/plugins/plot_xy/Makefile.am b/plugins/plot_xy/Makefile.am
index 64e2e41..b2d0a6c 100644
--- a/plugins/plot_xy/Makefile.am
+++ b/plugins/plot_xy/Makefile.am
@@ -1,6 +1,5 @@
 goffice_graph_xydir = $(goffice_plugindir)/plot_xy
 xmldir	 = $(goffice_graph_xydir)
-uidir = $(goffice_graph_xydir)
 
 goffice_graph_xy_LTLIBRARIES = xy.la
 xy_la_LDFLAGS = -module $(GOFFICE_PLUGIN_FLAGS)
@@ -19,20 +18,14 @@ xml_DATA = $(xml_in_files:.xml.in=.xml)
 
 if WITH_GTK
 xy_la_SOURCES  += gog-bubble-prefs.c
-dist_ui_DATA = \
-	gog-bubble-prefs.ui	\
-	gog-xy-prefs.ui	\
-	gog-xy-color-prefs.ui	\
-	gog-xy-series-prefs.ui	\
-	gog-xy-dropbar-prefs.ui
 endif
 
-# do not use the intl-tool stuff to merge the text back
-# its simpler to just use gettext directly
+# Do not use the intl-tool stuff to merge the text back;
+# it's simpler to just use gettext directly
 plot-types.xml : plot-types.xml.in
 	cp $< $@
 
-embedded_stuff = \
+embedded_stuff_raw = \
 	chart_bubble_1_1.png	\
 	chart_bubble_1_2.png	\
 	chart_colored_1_1.png	\
@@ -49,15 +42,23 @@ embedded_stuff = \
 	chart_scatter_4_3.png	\
 	chart_scatter_4_4.png
 
+embedded_stuff_compress = \
+	gog-bubble-prefs.ui	\
+	gog-xy-prefs.ui	\
+	gog-xy-color-prefs.ui	\
+	gog-xy-series-prefs.ui	\
+	gog-xy-dropbar-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_xy/ \
 		--static \
 		--register-function=register_embedded_stuff \
 		--unregister-function=unregister_embedded_stuff \
-		--register-file-function=go_rsm_register_file \
-		--unregister-file-function=go_rsm_unregister_file \
-		NOCOMPRESS $(embedded_stuff) \
+		NOCOMPRESS $(embedded_stuff_raw) \
+		COMPRESS $(embedded_stuff_compress) \
 		>$(abs_builddir)/$@
 
 BUILT_SOURCES =	embedded-stuff.c
diff --git a/plugins/plot_xy/gog-bubble-prefs.c b/plugins/plot_xy/gog-bubble-prefs.c
index 6aac7f7..216ad2b 100644
--- a/plugins/plot_xy/gog-bubble-prefs.c
+++ b/plugins/plot_xy/gog-bubble-prefs.c
@@ -67,12 +67,10 @@ GtkWidget *
 gog_bubble_plot_pref (GogBubblePlot *bubble, GOCmdContext *cc)
 {
 	GtkWidget  *w;
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_plot_xy"));
-	char	 *path = g_build_filename (dir, "gog-bubble-prefs.ui", NULL);
-	GtkBuilder *gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_xy/gog-bubble-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 
-	g_free (path);
         if (gui == NULL)
                 return NULL;
 
diff --git a/plugins/plot_xy/gog-xy-dropbar.c b/plugins/plot_xy/gog-xy-dropbar.c
index 59b5f08..cdd8fdb 100644
--- a/plugins/plot_xy/gog-xy-dropbar.c
+++ b/plugins/plot_xy/gog-xy-dropbar.c
@@ -128,15 +128,10 @@ gog_xy_dropbar_populate_editor (GogObject *obj,
                              GOCmdContext *cc)
 {
 #ifdef GOFFICE_WITH_GTK
-	GtkBuilder *gui;
-	char const *dir;
-	char *path;
 	GogXYDropBarPlot *dropbar = GOG_XY_DROPBAR_PLOT (obj);
-
-	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_xy"));
-	path = g_build_filename (dir, "gog-xy-dropbar-prefs.ui", NULL);
-	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
-	g_free (path);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_xy/gog-xy-dropbar-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 
 	if (gui != NULL) {
 		GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 51bc126..a992f17 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -356,14 +356,9 @@ gog_xy_plot_populate_editor (GogObject *obj,
                              GOCmdContext *cc)
 {
 #ifdef GOFFICE_WITH_GTK
-	GtkBuilder *gui;
-	char const *dir;
-	char *path;
-
-	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_xy"));
-	path = g_build_filename (dir, "gog-xy-prefs.ui", NULL);
-	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
-	g_free (path);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_xy/gog-xy-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 
 	if (gui != NULL) {
 		GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
@@ -744,14 +739,9 @@ gog_xy_color_plot_populate_editor (GogObject *obj,
 				   GOCmdContext *cc)
 {
 #ifdef GOFFICE_WITH_GTK
-	GtkBuilder *gui;
-	char const *dir;
-	char *path;
-
-	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_xy"));
-	path = g_build_filename (dir, "gog-xy-color-prefs.ui", NULL);
-	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
-	g_free (path);
+	GtkBuilder *gui =
+		go_gtk_builder_new ("res:go:plot_xy/gog-xy-color-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 
 	if (gui != NULL) {
 		GtkWidget *w = go_gtk_builder_get_widget (gui, "hide-outliers");
@@ -2101,12 +2091,9 @@ gog_xy_series_populate_editor (GogObject *obj,
 {
 	GogXYSeries *series;
 	GtkWidget *w;
-	char const *dir = go_plugin_get_dir_name (
-		go_plugins_get_plugin_by_id ("GOffice_plot_xy"));
-	char *path = g_build_filename (dir, "gog-xy-series-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_xy/gog-xy-series-prefs.ui",
+				    GETTEXT_PACKAGE, cc);
 
 	(GOG_OBJECT_CLASS(series_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
 
diff --git a/tools/embedder b/tools/embedder
index 62117e9..905ff2d 100644
--- a/tools/embedder
+++ b/tools/embedder
@@ -11,8 +11,8 @@ my $WIDTH = 70;
 my $regfunc = undef;
 my $unregfunc = undef;
 my $regfuncstatic = 0;
-my $regfilefunc = undef;
-my $unregfilefunc = undef;
+my $regfilefunc = "go_rsm_register_file";
+my $unregfilefunc = "go_rsm_unregister_file";
 my $id_prefix = "";
 my @includes;
 



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