[gnumeric] Provide new saver for uncompressed Gnumeric xml. [#672622]



commit 43a8863c26b4a8ad8f691dc288948db40bd14bd8
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Aug 4 00:39:09 2012 -0600

    Provide new saver for uncompressed Gnumeric xml. [#672622]
    
    2012-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/xml-sax-write.c (gnm_xml_file_save): renamed to
    	gnm_xml_file_save_full
    	(gnm_xml_file_save): new
    	(gnm_xml_file_save_xml): new
    	(gnm_xml_sax_write_init): initialize new saver
    	(gnm_xml_sax_write_shutdown): free new saver
    
    2012-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* plugin.xml.in: adjust format_level

 ChangeLog                            |    9 +++++
 NEWS                                 |    1 +
 plugins/gnome-glossary/ChangeLog     |    4 ++
 plugins/gnome-glossary/plugin.xml.in |    2 +-
 src/xml-sax-write.c                  |   58 ++++++++++++++++++++++++++-------
 5 files changed, 60 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fd9ab47..8e189a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/xml-sax-write.c (gnm_xml_file_save): renamed to
+	gnm_xml_file_save_full
+	(gnm_xml_file_save): new
+	(gnm_xml_file_save_xml): new
+	(gnm_xml_sax_write_init): initialize new saver
+	(gnm_xml_sax_write_shutdown): free new saver
+
 2012-08-03  Jean Brefort  <jean brefort normalesup org>
 
 	* configure.in: require libgsf >= 1.14.24.
diff --git a/NEWS b/NEWS
index 3754eaa..3bbe87e 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Andreas:
 	* Some basic custom-shape support in ODF import.
 	* Map captions onto text rectangles on ODF import.
 	* Add new autofilter op. [#647401]
+	* Provide new saver for uncompressed Gnumeric xml. [#672622]
 
 Jean:
 	* Fix component references issues. [#680190]
diff --git a/plugins/gnome-glossary/ChangeLog b/plugins/gnome-glossary/ChangeLog
index 6dbb592..7a7ade3 100644
--- a/plugins/gnome-glossary/ChangeLog
+++ b/plugins/gnome-glossary/ChangeLog
@@ -1,3 +1,7 @@
+2012-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* plugin.xml.in: adjust format_level
+
 2012-07-15  Morten Welinder <terra gnome org>
 
 	* Release 1.11.5
diff --git a/plugins/gnome-glossary/plugin.xml.in b/plugins/gnome-glossary/plugin.xml.in
index 3ead6dc..eac0b55 100644
--- a/plugins/gnome-glossary/plugin.xml.in
+++ b/plugins/gnome-glossary/plugin.xml.in
@@ -9,7 +9,7 @@
 		<attribute name="module_name" value="gnome_glossary"/>
 	</loader>
 	<services>
-		<service type="file_saver" id="po" file_extension="po" format_level="auto">
+		<service type="file_saver" id="po" file_extension="po" format_level="write_only">
 			<information>
 				<_description>Gnome Glossary PO file format</_description>
 			</information>
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index 5615633..ecdae71 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -1400,22 +1400,14 @@ gnm_xml_io_conventions (void)
 }
 
 static void
-gnm_xml_file_save (GOFileSaver const *fs, GOIOContext *io_context,
-		   gconstpointer wb_view, GsfOutput *output)
+gnm_xml_file_save_full (G_GNUC_UNUSED GOFileSaver const *fs, 
+			G_GNUC_UNUSED GOIOContext *io_context,
+			gconstpointer wb_view, GsfOutput *output, 
+			gboolean compress)
 {
 	GnmOutputXML state;
-	char const  *extension = NULL;
 	GsfOutput   *gzout = NULL;
 	GnmLocale   *locale;
-	gboolean     compress;
-
-	/* If the suffix is .xml disable compression */
-	if (NULL != gsf_output_name (output))
-		extension = gsf_extension_pointer (gsf_output_name (output));
-	if (NULL != extension && g_ascii_strcasecmp (extension, "xml") == 0)
-		compress = FALSE;
-	else
-		compress = (gnm_conf_get_core_xml_compression_level () > 0);
 
 	if (compress) {
 		gzout  = gsf_output_gzip_new (output, NULL);
@@ -1475,6 +1467,31 @@ gnm_xml_file_save (GOFileSaver const *fs, GOIOContext *io_context,
 	}
 }
 
+static void
+gnm_xml_file_save (GOFileSaver const *fs, GOIOContext *io_context,
+		   gconstpointer wb_view, GsfOutput *output)
+{
+	gboolean compress;
+	char const  *extension = NULL;
+
+	/* If the suffix is .xml disable compression */
+	if (NULL != gsf_output_name (output))
+		extension = gsf_extension_pointer (gsf_output_name (output));
+	if (NULL != extension && g_ascii_strcasecmp (extension, "xml") == 0)
+		compress = FALSE;
+	else
+		compress = (gnm_conf_get_core_xml_compression_level () > 0);
+	
+	gnm_xml_file_save_full (fs, io_context, wb_view, output, compress);
+}
+
+static void
+gnm_xml_file_save_xml (GOFileSaver const *fs, GOIOContext *io_context,
+		   gconstpointer wb_view, GsfOutput *output)
+{
+	gnm_xml_file_save_full (fs, io_context, wb_view, output, FALSE);
+}
+
 /**************************************************************************/
 
 typedef struct {
@@ -1484,7 +1501,8 @@ typedef struct {
 } XMLCellCopyState;
 
 static void
-cb_xml_write_cell_region_cells (GnmCellCopy *cc, gconstpointer ignore,
+cb_xml_write_cell_region_cells (GnmCellCopy *cc, 
+				G_GNUC_UNUSED gconstpointer ignore,
 				XMLCellCopyState *state)
 {
 	state->pp.eval.col = state->cr->base.col + cc->offset.col;
@@ -1598,6 +1616,7 @@ gnm_cellregion_to_xml (GnmCellRegion const *cr)
 }
 
 #define XML_SAX_ID "Gnumeric_XmlIO:sax"
+#define XML_SAX_ID_0 "Gnumeric_XmlIO:sax:0"
 
 void
 gnm_xml_sax_write_init (void)
@@ -1613,10 +1632,23 @@ gnm_xml_sax_write_init (void)
 
 	go_file_saver_register_as_default (saver, 50);
 	g_object_unref (saver);
+
+	saver = go_file_saver_new
+		(XML_SAX_ID_0,
+		 "xml",
+		 _("Gnumeric XML uncompressed (*.xml)"),
+		 GO_FILE_FL_AUTO, gnm_xml_file_save_xml);
+	g_object_set (G_OBJECT (saver),
+		      "mime-type", "application/xml",
+		      NULL);
+
+	go_file_saver_register (saver);
+	g_object_unref (saver);
 }
 
 void
 gnm_xml_sax_write_shutdown (void)
 {
 	go_file_saver_unregister (go_file_saver_for_id (XML_SAX_ID));
+	go_file_saver_unregister (go_file_saver_for_id (XML_SAX_ID_0));
 }



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