[goffice] Extend encoding specification from file-openers to plugin services.



commit 935be9670cde8abf801d45b8631e67867bad0d92
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Aug 14 16:19:54 2011 -0600

    Extend encoding specification from file-openers to plugin services.
    
    2011-08-14  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/app/go-plugin-loader-module.c
    	(go_plugin_loader_module_func_file_open): add argument and adjust
    	call to loader_data->module_func_file_open
    	* goffice/app/go-plugin-service.h (plugin_func_file_open):
    	add argument
    	* goffice/app/go-plugin-service.c (_GOPluginServiceFileOpener):
    	add field
    	(go_plugin_service_file_opener_read_xml): load "encoding_dependent"
    	(go_plugin_file_opener_open): adjust call to plugin_func_file_open
    	(go_plugin_file_opener_new): use service_file_opener->encoding_dependent

 AUTHORS                               |    1 +
 ChangeLog                             |   13 +++++++++++++
 NEWS                                  |    1 +
 goffice/app/file.h                    |    2 +-
 goffice/app/go-plugin-loader-module.c |   17 ++++++++++++++---
 goffice/app/go-plugin-service.c       |   11 ++++++++---
 goffice/app/go-plugin-service.h       |    2 +-
 7 files changed, 39 insertions(+), 8 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index 020c3ca..dc10032 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -3,6 +3,7 @@ Jean Brefort, Core charting engine.
 Emmanuel Pacaud, Many plot types for charting engine.
 Morten Welinder, Gnumeric hacker and leak plugging demi-god.
 Chris Lahey, number format engine, and powerpoint/escher code
+Andreas J. Guelzow, Gnumeric hacker
 
 NOTE : Keep this in sync with the about dialog and the webpage.
 NOTE : Get an about dialog and a webpage :-)
diff --git a/ChangeLog b/ChangeLog
index 4378dab..48f05a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-08-14  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* goffice/app/go-plugin-loader-module.c
+	(go_plugin_loader_module_func_file_open): add argument and adjust
+	call to loader_data->module_func_file_open
+	* goffice/app/go-plugin-service.h (plugin_func_file_open):
+	add argument
+	* goffice/app/go-plugin-service.c (_GOPluginServiceFileOpener):
+	add field
+	(go_plugin_service_file_opener_read_xml): load "encoding_dependent"
+	(go_plugin_file_opener_open): adjust call to plugin_func_file_open
+	(go_plugin_file_opener_new): use service_file_opener->encoding_dependent
+
 2011-08-14  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/data/go-data-impl.h: add new is_valid method.
diff --git a/NEWS b/NEWS
index a707aea..b03fded 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
 	* Fix interpretation of marked-up scientific number format. [#656056]
 	* Fix fraction rendering for unspecified denominators. [#656043]
 	* Fix date format on Windows. [#655573]
+	* Extend encoding specification from file-openers to plugin services.
 
 Jean:
 	* Port to gtk+-3.0.
diff --git a/goffice/app/file.h b/goffice/app/file.h
index c028940..34fd301 100644
--- a/goffice/app/file.h
+++ b/goffice/app/file.h
@@ -87,7 +87,7 @@ void         go_file_opener_open (GOFileOpener const *fo, gchar const *opt_enc,
 
 char const *go_file_opener_get_id		  (GOFileOpener const *fo);
 char const *go_file_opener_get_description	  (GOFileOpener const *fo);
-gboolean    go_file_opener_is_encoding_dependent (GOFileOpener const *fo);
+gboolean    go_file_opener_is_encoding_dependent  (GOFileOpener const *fo);
 gboolean    go_file_opener_can_probe		  (GOFileOpener const *fo,
 						   GOFileProbeLevel pl);
 GSList const *go_file_opener_get_suffixes	  (GOFileOpener const *fo);
diff --git a/goffice/app/go-plugin-loader-module.c b/goffice/app/go-plugin-loader-module.c
index c73edb8..329304e 100644
--- a/goffice/app/go-plugin-loader-module.c
+++ b/goffice/app/go-plugin-loader-module.c
@@ -10,6 +10,7 @@
 #include "module-plugin-defs.h"
 
 #include <goffice/app/file.h>
+#include <goffice/app/file-priv.h>
 #include <goffice/app/go-plugin.h>
 #include <goffice/app/go-plugin-service.h>
 #include <goffice/app/go-plugin-loader.h>
@@ -228,7 +229,8 @@ static void
 go_plugin_loader_module_func_file_open (GOFileOpener const *fo, GOPluginService *service,
 					 GOIOContext *io_context,
 					 gpointer   FIXME_FIXME_workbook_view,
-					 GsfInput  *input)
+					GsfInput  *input,
+					char const *enc)
 {
 	ServiceLoaderDataFileOpener *loader_data;
 
@@ -236,8 +238,17 @@ go_plugin_loader_module_func_file_open (GOFileOpener const *fo, GOPluginService
 	g_return_if_fail (input != NULL);
 
 	loader_data = g_object_get_data (G_OBJECT (service), "loader_data");
-	loader_data->module_func_file_open (fo, io_context,
-		FIXME_FIXME_workbook_view, input);
+	if (fo->encoding_dependent) {
+		void (*module_func_file_open) (GOFileOpener const *fo, char const *enc,
+					       GOIOContext *io_context,
+					       gpointer FIXME_FIXME_workbook_view,
+					       GsfInput *input);
+		module_func_file_open = (gpointer)(loader_data->module_func_file_open);
+		module_func_file_open (fo, enc, io_context,
+				       FIXME_FIXME_workbook_view, input);
+	} else
+		loader_data->module_func_file_open (fo, io_context,
+						    FIXME_FIXME_workbook_view, input);
 }
 
 static char *
diff --git a/goffice/app/go-plugin-service.c b/goffice/app/go-plugin-service.c
index 80a9569..8a437f3 100644
--- a/goffice/app/go-plugin-service.c
+++ b/goffice/app/go-plugin-service.c
@@ -217,6 +217,7 @@ struct _GOPluginServiceFileOpener {
 
 	gint priority;
 	gboolean has_probe;
+	gboolean encoding_dependent;
 	gchar *description;
 	GSList *suffixes;	/* list of char * */
 	GSList *mimes;		/* list of char * */
@@ -266,6 +267,7 @@ go_plugin_service_file_opener_read_xml (GOPluginService *service, xmlNode *tree,
 {
 	int priority;
 	gboolean has_probe;
+	gboolean encoding_dependent;
 	xmlNode *information_node;
 	gchar *description;
 
@@ -277,6 +279,8 @@ go_plugin_service_file_opener_read_xml (GOPluginService *service, xmlNode *tree,
 
 	if (!go_xml_node_get_bool (tree, "probe", &has_probe))
 		has_probe = TRUE;
+	if (!go_xml_node_get_bool (tree, "encoding_dependent", &encoding_dependent))
+		encoding_dependent = FALSE;
 
 	information_node = go_xml_get_child_by_name (tree, "information");
 	if (information_node != NULL) {
@@ -327,6 +331,7 @@ go_plugin_service_file_opener_read_xml (GOPluginService *service, xmlNode *tree,
 
 		service_file_opener->priority = priority;
 		service_file_opener->has_probe = has_probe;
+		service_file_opener->encoding_dependent	= encoding_dependent;
 		service_file_opener->description = description;
 		service_file_opener->suffixes	= suffixes;
 		service_file_opener->mimes	= mimes;
@@ -470,7 +475,7 @@ go_plugin_file_opener_probe (GOFileOpener const *fo, GsfInput *input,
 }
 
 static void
-go_plugin_file_opener_open (GOFileOpener const *fo, gchar const *unused_enc,
+go_plugin_file_opener_open (GOFileOpener const *fo, gchar const *enc,
 			     GOIOContext *io_context,
 			     gpointer FIXME_FIXME_workbook_view,
 			     GsfInput *input)
@@ -491,7 +496,7 @@ go_plugin_file_opener_open (GOFileOpener const *fo, gchar const *unused_enc,
 	}
 
 	g_return_if_fail (service_file_opener->cbs.plugin_func_file_open != NULL);
-	service_file_opener->cbs.plugin_func_file_open (fo, pfo->service, io_context, FIXME_FIXME_workbook_view, input);
+	service_file_opener->cbs.plugin_func_file_open (fo, pfo->service, io_context, FIXME_FIXME_workbook_view, input, enc);
 }
 
 static void
@@ -531,7 +536,7 @@ go_plugin_file_opener_new (GOPluginService *service)
 		service_file_opener->description,
 		go_str_slist_dup (service_file_opener->suffixes),
 		go_str_slist_dup (service_file_opener->mimes),
-		FALSE, NULL, NULL);
+		service_file_opener->encoding_dependent, NULL, NULL);
 	fo->service = service;
 	g_free (opener_id);
 
diff --git a/goffice/app/go-plugin-service.h b/goffice/app/go-plugin-service.h
index 1a2e4dd..b7d6391 100644
--- a/goffice/app/go-plugin-service.h
+++ b/goffice/app/go-plugin-service.h
@@ -41,7 +41,7 @@ typedef struct {
 	void     (*plugin_func_file_open) (
 	         GOFileOpener const *fo, GOPluginService *service,
 	         GOIOContext *io_context, gpointer fixme_workbook_view,
-		 GsfInput *input);
+		 GsfInput *input, char const *enc);
 } GOPluginServiceFileOpenerCallbacks;
 
 



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