[gnumeric] Save all settings in stf export. [#685077]



commit 6e1565862b82a571118684359fc5671b16474250
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Nov 10 12:30:47 2012 -0700

    Save all settings in stf export. [#685077]
    
    2012-11-10  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in: add new
    	stf export items
    	* src/gnumeric-conf.h: updated
    	* src/gnumeric-conf.c: updated
    	* src/stf-export.c (gnm_stf_get_stfe): read new preference settings
    
    2012-11-10  Andreas J Guelzow <aguelzow pyrshep ca>
    
    	* handle-conf-options: add min/max for new preference setttings
    
    2012-11-10  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-stf-export.c (stf_export_dialog_finish): save all settings

 ChangeLog                                          |    8 +
 NEWS                                               |    1 +
 .../org.gnome.gnumeric.dialogs.gschema.xml.in.in   |   25 ++++
 src/dialogs/ChangeLog                              |    4 +
 src/dialogs/dialog-stf-export.c                    |   11 +-
 src/gnumeric-conf.c                                |  147 ++++++++++++++++++++
 src/gnumeric-conf.h                                |   20 +++
 src/stf-export.c                                   |   34 ++++-
 tools/ChangeLog                                    |    4 +
 tools/handle-conf-options                          |   10 ++
 10 files changed, 253 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 12e92db..d5428eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-11-10  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in: add new
+	stf export items
+	* src/gnumeric-conf.h: updated
+	* src/gnumeric-conf.c: updated
+	* src/stf-export.c (gnm_stf_get_stfe): read new preference settings
+
+2012-11-10  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/gnumeric-conf.h: updated using tools/handle-conf-options
 	* src/gnumeric-conf.c: updated using tools/handle-conf-options
 
diff --git a/NEWS b/NEWS
index 17739fb..48c54c3 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
 	* Make ODF import handling of strike-through match LO. [#686789]
 	* Fix style handling in ODF export for empty cells with objects. [#687693]
 	* Fix cell overflow in case of marked up scientific format. [#686540]
+	* Save all settings in stf export. [#685077]
 
 Jean:
 	* Fixed indentation in cell format dialog. [#683576]
diff --git a/schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in b/schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in
index c60143d..8d41a6f 100644
--- a/schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in
+++ b/schemas/org.gnome.gnumeric.dialogs.gschema.xml.in.in
@@ -282,6 +282,31 @@
       <_summary>Text Export Record Terminator</_summary>
       <_description>Please use the Text Export dialog to edit this value.</_description>
     </key>
+    <key name="locale" type="s">
+      <default>''</default>
+      <_summary>Text Export Locale</_summary>
+      <_description>Please use the Text Export dialog to edit this value.</_description>
+    </key>
+    <key name="encoding" type="s">
+      <default>''</default>
+      <_summary>Text Export Encoding</_summary>
+      <_description>Please use the Text Export dialog to edit this value.</_description>
+    </key>
+    <key name="quoting" type="i">
+      <default>1</default>
+      <_summary>Text Export String Quoting Rule</_summary>
+      <_description>Please use the Text Export dialog to edit this value.</_description>
+    </key>
+    <key name="format" type="i">
+      <default>0</default>
+      <_summary>Text Export Formating Rule</_summary>
+      <_description>Please use the Text Export dialog to edit this value.</_description>
+    </key>
+    <key name="transliteration" type="b">
+      <default>true</default>
+      <_summary>Text Export Unknown Character Transliteration</_summary>
+      <_description>Please use the Text Export dialog to edit this value.</_description>
+    </key>
   </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gnumeric.searchreplace" path="/org/gnome/gnumeric/searchreplace/">
     <key name="ignore-case" type="b">
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 8005e74..28f5a06 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,7 @@
+2012-11-10  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-stf-export.c (stf_export_dialog_finish): save all settings
+
 2012-11-04  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-sheet-resize.c (cb_ok_clicked): fix sheet focus after resizing.
diff --git a/src/dialogs/dialog-stf-export.c b/src/dialogs/dialog-stf-export.c
index 6da092b..4c7f0e2 100644
--- a/src/dialogs/dialog-stf-export.c
+++ b/src/dialogs/dialog-stf-export.c
@@ -270,7 +270,7 @@ stf_export_dialog_format_page_init (TextExportState *state)
 }
 
 static gboolean
-cb_collect_exported_sheets (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+cb_collect_exported_sheets (GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *iter,
 			    TextExportState *state)
 {
 	gboolean exported;
@@ -364,6 +364,11 @@ stf_export_dialog_finish (TextExportState *state)
 		gnm_conf_set_stf_export_separator (separator);
 		gnm_conf_set_stf_export_stringindicator (quote);
 		gnm_conf_set_stf_export_terminator (eol);
+		gnm_conf_set_stf_export_quoting (quotingmode);
+		gnm_conf_set_stf_export_format (format);
+		gnm_conf_set_stf_export_transliteration (transliteratemode == GNM_STF_TRANSLITERATE_MODE_TRANS);
+		gnm_conf_set_stf_export_locale (locale);
+		gnm_conf_set_stf_export_encoding (charset);
 	}
 
 	/* Which sheets?  */
@@ -391,7 +396,7 @@ set_sheet_selection_count (TextExportState *state, int n)
 }
 
 static gboolean
-cb_set_sheet (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
+cb_set_sheet (GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *iter,
 	      gpointer data)
 {
 	gboolean value;
@@ -524,7 +529,7 @@ cb_sheet_bottom (TextExportState *state)
 }
 
 static void
-cb_sheet_export_toggled (GtkCellRendererToggle *cell,
+cb_sheet_export_toggled (G_GNUC_UNUSED GtkCellRendererToggle *cell,
 			 const gchar *path_string,
 			 TextExportState *state)
 {
diff --git a/src/gnumeric-conf.c b/src/gnumeric-conf.c
index 0af93ef..1c714d7 100644
--- a/src/gnumeric-conf.c
+++ b/src/gnumeric-conf.c
@@ -3793,6 +3793,124 @@ gnm_conf_get_searchreplace_whole_words_only_node (void)
 	return get_watch_node (&watch_searchreplace_whole_words_only);
 }
 
+static struct cb_watch_string watch_stf_export_encoding = {
+	0, "stf/export/encoding",
+	"Text Export Encoding",
+	"Please use the Text Export dialog to edit this value.",
+	"",
+};
+
+const char *
+gnm_conf_get_stf_export_encoding (void)
+{
+	if (!watch_stf_export_encoding.handler)
+		watch_string (&watch_stf_export_encoding);
+	return watch_stf_export_encoding.var;
+}
+
+void
+gnm_conf_set_stf_export_encoding (const char *x)
+{
+	g_return_if_fail (x != NULL);
+	if (!watch_stf_export_encoding.handler)
+		watch_string (&watch_stf_export_encoding);
+	set_string (&watch_stf_export_encoding, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_encoding_node (void)
+{
+	return get_watch_node (&watch_stf_export_encoding);
+}
+
+static struct cb_watch_int watch_stf_export_format = {
+	0, "stf/export/format",
+	"Text Export Formating Rule",
+	"Please use the Text Export dialog to edit this value.",
+	0, 2, 0,
+};
+
+int
+gnm_conf_get_stf_export_format (void)
+{
+	if (!watch_stf_export_format.handler)
+		watch_int (&watch_stf_export_format);
+	return watch_stf_export_format.var;
+}
+
+void
+gnm_conf_set_stf_export_format (int x)
+{
+	if (!watch_stf_export_format.handler)
+		watch_int (&watch_stf_export_format);
+	set_int (&watch_stf_export_format, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_format_node (void)
+{
+	return get_watch_node (&watch_stf_export_format);
+}
+
+static struct cb_watch_string watch_stf_export_locale = {
+	0, "stf/export/locale",
+	"Text Export Locale",
+	"Please use the Text Export dialog to edit this value.",
+	"",
+};
+
+const char *
+gnm_conf_get_stf_export_locale (void)
+{
+	if (!watch_stf_export_locale.handler)
+		watch_string (&watch_stf_export_locale);
+	return watch_stf_export_locale.var;
+}
+
+void
+gnm_conf_set_stf_export_locale (const char *x)
+{
+	g_return_if_fail (x != NULL);
+	if (!watch_stf_export_locale.handler)
+		watch_string (&watch_stf_export_locale);
+	set_string (&watch_stf_export_locale, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_locale_node (void)
+{
+	return get_watch_node (&watch_stf_export_locale);
+}
+
+static struct cb_watch_int watch_stf_export_quoting = {
+	0, "stf/export/quoting",
+	"Text Export String Quoting Rule",
+	"Please use the Text Export dialog to edit this value.",
+	0, 2, 1,
+};
+
+int
+gnm_conf_get_stf_export_quoting (void)
+{
+	if (!watch_stf_export_quoting.handler)
+		watch_int (&watch_stf_export_quoting);
+	return watch_stf_export_quoting.var;
+}
+
+void
+gnm_conf_set_stf_export_quoting (int x)
+{
+	if (!watch_stf_export_quoting.handler)
+		watch_int (&watch_stf_export_quoting);
+	set_int (&watch_stf_export_quoting, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_quoting_node (void)
+{
+	return get_watch_node (&watch_stf_export_quoting);
+}
+
 static struct cb_watch_string watch_stf_export_separator = {
 	0, "stf/export/separator",
 	"Text Export Field Separator",
@@ -3883,6 +4001,35 @@ gnm_conf_get_stf_export_terminator_node (void)
 	return get_watch_node (&watch_stf_export_terminator);
 }
 
+static struct cb_watch_bool watch_stf_export_transliteration = {
+	0, "stf/export/transliteration",
+	"Text Export Unknown Character Transliteration",
+	"Please use the Text Export dialog to edit this value.",
+	TRUE,
+};
+
+gboolean
+gnm_conf_get_stf_export_transliteration (void)
+{
+	if (!watch_stf_export_transliteration.handler)
+		watch_bool (&watch_stf_export_transliteration);
+	return watch_stf_export_transliteration.var;
+}
+
+void
+gnm_conf_set_stf_export_transliteration (gboolean x)
+{
+	if (!watch_stf_export_transliteration.handler)
+		watch_bool (&watch_stf_export_transliteration);
+	set_bool (&watch_stf_export_transliteration, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_transliteration_node (void)
+{
+	return get_watch_node (&watch_stf_export_transliteration);
+}
+
 static struct cb_watch_enum watch_toolbar_style = {
 	0, "toolbar-style",
 	"Toolbar Style",
diff --git a/src/gnumeric-conf.h b/src/gnumeric-conf.h
index b6a894f..c96e0c9 100644
--- a/src/gnumeric-conf.h
+++ b/src/gnumeric-conf.h
@@ -461,6 +461,22 @@ GOConfNode *gnm_conf_get_searchreplace_whole_words_only_node (void);
 gboolean gnm_conf_get_searchreplace_whole_words_only (void);
 void gnm_conf_set_searchreplace_whole_words_only (gboolean);
 
+GOConfNode *gnm_conf_get_stf_export_encoding_node (void);
+const char *gnm_conf_get_stf_export_encoding (void);
+void gnm_conf_set_stf_export_encoding (const char *);
+
+GOConfNode *gnm_conf_get_stf_export_format_node (void);
+int gnm_conf_get_stf_export_format (void);
+void gnm_conf_set_stf_export_format (int);
+
+GOConfNode *gnm_conf_get_stf_export_locale_node (void);
+const char *gnm_conf_get_stf_export_locale (void);
+void gnm_conf_set_stf_export_locale (const char *);
+
+GOConfNode *gnm_conf_get_stf_export_quoting_node (void);
+int gnm_conf_get_stf_export_quoting (void);
+void gnm_conf_set_stf_export_quoting (int);
+
 GOConfNode *gnm_conf_get_stf_export_separator_node (void);
 const char *gnm_conf_get_stf_export_separator (void);
 void gnm_conf_set_stf_export_separator (const char *);
@@ -473,6 +489,10 @@ GOConfNode *gnm_conf_get_stf_export_terminator_node (void);
 const char *gnm_conf_get_stf_export_terminator (void);
 void gnm_conf_set_stf_export_terminator (const char *);
 
+GOConfNode *gnm_conf_get_stf_export_transliteration_node (void);
+gboolean gnm_conf_get_stf_export_transliteration (void);
+void gnm_conf_set_stf_export_transliteration (gboolean);
+
 GtkToolbarStyle gnm_conf_get_toolbar_style (void);
 void gnm_conf_set_toolbar_style (GtkToolbarStyle);
 
diff --git a/src/stf-export.c b/src/stf-export.c
index dd9ef8b..7ce2702 100644
--- a/src/stf-export.c
+++ b/src/stf-export.c
@@ -456,7 +456,7 @@ gnm_stf_format_mode_get_type (void)
 /* ------------------------------------------------------------------------- */
 
 static void
-gnm_stf_export_init (GObject *obj)
+gnm_stf_export_init (G_GNUC_UNUSED GObject *obj)
 {
 }
 
@@ -616,22 +616,40 @@ gnm_stf_get_stfe (GObject *obj)
 		const char * sep = gnm_conf_get_stf_export_separator ();
 		const char * string_indicator = gnm_conf_get_stf_export_stringindicator ();
 		const char * terminator = gnm_conf_get_stf_export_terminator ();
+		const char * locale = gnm_conf_get_stf_export_locale ();
+		const char * encoding = gnm_conf_get_stf_export_encoding ();
+		int quotingmode = gnm_conf_get_stf_export_quoting ();
+		int format = gnm_conf_get_stf_export_format ();
+		int transliteratemode = gnm_conf_get_stf_export_transliteration () ?
+			GNM_STF_TRANSLITERATE_MODE_TRANS : GNM_STF_TRANSLITERATE_MODE_ESCAPE;
 		GString *triggers = g_string_new (NULL);
 
+		if (strlen (locale) == 0)
+			locale = NULL;
+		if (strlen (encoding) == 0)
+			encoding = NULL;
+
 		/* Workaround GConf bug #641807. */
 		if (terminator == NULL || strlen (terminator) == 0)
 			terminator = "\n";
 
-		g_string_append (triggers, " \t");
-		g_string_append (triggers, terminator);
-		g_string_append (triggers, string_indicator);
-		g_string_append (triggers, sep);
+		if (quotingmode == GSF_OUTPUT_CSV_QUOTING_MODE_AUTO) {
+			g_string_append (triggers, " \t");
+			g_string_append (triggers, terminator);
+			g_string_append (triggers, string_indicator);
+			g_string_append (triggers, sep);
+		}
 
 		stfe = g_object_new (GNM_STF_EXPORT_TYPE,
 				     "quoting-triggers", triggers->str,
 				     "separator", sep,
 				     "quote", string_indicator,
 				     "eol", terminator,
+				     "charset", encoding,
+				     "locale", locale,
+		      "quoting-mode", quotingmode,
+		      "transliterate-mode", transliteratemode,
+		      "format", format,
 				     NULL);
 		g_object_set_data_full (obj, "stfe", stfe, g_object_unref);
 		g_string_free (triggers, TRUE);
@@ -640,7 +658,7 @@ gnm_stf_get_stfe (GObject *obj)
 }
 
 static void
-gnm_stf_file_saver_save (GOFileSaver const *fs, GOIOContext *context,
+gnm_stf_file_saver_save (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *context,
 			 GoView const *view, GsfOutput *output)
 {
 	WorkbookView *wbv = WORKBOOK_VIEW (view);
@@ -734,11 +752,11 @@ error:
 }
 
 static gboolean
-gnm_stf_fs_set_export_options (GOFileSaver *fs,
+gnm_stf_fs_set_export_options (G_GNUC_UNUSED GOFileSaver *fs,
 			       GODoc *doc,
 			       const char *options,
 			       GError **err,
-			       gpointer user)
+			       G_GNUC_UNUSED gpointer user)
 {
 	GnmStfExport *stfe = gnm_stf_get_stfe (G_OBJECT (doc));
 	gnm_stf_export_options_sheet_list_clear (stfe);
diff --git a/tools/ChangeLog b/tools/ChangeLog
index f0cc182..ee43cb0 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,5 +1,9 @@
 2012-11-10  Andreas J Guelzow <aguelzow pyrshep ca>
 
+	* handle-conf-options: add min/max for new preference setttings
+
+2012-11-10  Andreas J Guelzow <aguelzow pyrshep ca>
+
 	* handle-conf-options: fix paths
 
 2012-09-06  Morten Welinder <terra gnome org>
diff --git a/tools/handle-conf-options b/tools/handle-conf-options
index a55a5fd..3ab289a 100644
--- a/tools/handle-conf-options
+++ b/tools/handle-conf-options
@@ -360,6 +360,16 @@ my %extra_attributes =
 	 'max' => 2,
      },
 
+     '/org/gnome/gnumeric/stf/export/format' => {
+	 'min' => 0,
+	 'max' => 2,
+     },
+
+     '/org/gnome/gnumeric/stf/export/quoting' => {
+	 'min' => 0,
+	 'max' => 2,
+     },
+
     );
 foreach my $key (keys %extra_attributes) {
     my $newkey = $key;



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