[gnumeric] store stfe setup in gconf



commit 904600a30d740543a9046b0500f7052333993e9c
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Jan 11 00:41:55 2010 -0700

    store stfe setup in gconf
    
    2010-01-10 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* schemas/gnumeric-dialogs.schemas.in: add items
    	* src/gnumeric-gconf.h (gnm_conf_get_stf_export_separator_node): new
    	(gnm_conf_get_stf_export_separator): new
    	(gnm_conf_set_stf_export_separator): new
    	(gnm_conf_get_stf_export_stringindicator_node): new
    	(gnm_conf_get_stf_export_stringindicator): new
    	(gnm_conf_set_stf_export_stringindicator): new
    	(gnm_conf_get_stf_export_terminator_node): new
    	(gnm_conf_get_stf_export_terminator): new
    	(gnm_conf_set_stf_export_terminator): new
    	* src/gnumeric-gconf.c (gnm_conf_get_stf_export_separator_node): new
    	(gnm_conf_get_stf_export_separator): new
    	(gnm_conf_set_stf_export_separator): new
    	(gnm_conf_get_stf_export_stringindicator_node): new
    	(gnm_conf_get_stf_export_stringindicator): new
    	(gnm_conf_set_stf_export_stringindicator): new
    	(gnm_conf_get_stf_export_terminator_node): new
    	(gnm_conf_get_stf_export_terminator): new
    	(gnm_conf_set_stf_export_terminator): new
    	* src/stf-export.c (gnm_stf_get_stfe): use the gconf info

 ChangeLog                           |   23 ++++++++++
 schemas/gnumeric-dialogs.schemas.in |   33 ++++++++++++++
 src/gnumeric-gconf.c                |   81 +++++++++++++++++++++++++++++++++++
 src/gnumeric-gconf.h                |   12 +++++
 src/stf-export.c                    |   17 ++++++-
 5 files changed, 164 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 64a22b6..50e1124 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2010-01-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* schemas/gnumeric-dialogs.schemas.in: add items
+	* src/gnumeric-gconf.h (gnm_conf_get_stf_export_separator_node): new
+	(gnm_conf_get_stf_export_separator): new
+	(gnm_conf_set_stf_export_separator): new
+	(gnm_conf_get_stf_export_stringindicator_node): new
+	(gnm_conf_get_stf_export_stringindicator): new
+	(gnm_conf_set_stf_export_stringindicator): new
+	(gnm_conf_get_stf_export_terminator_node): new
+	(gnm_conf_get_stf_export_terminator): new
+	(gnm_conf_set_stf_export_terminator): new
+	* src/gnumeric-gconf.c (gnm_conf_get_stf_export_separator_node): new
+	(gnm_conf_get_stf_export_separator): new
+	(gnm_conf_set_stf_export_separator): new
+	(gnm_conf_get_stf_export_stringindicator_node): new
+	(gnm_conf_get_stf_export_stringindicator): new
+	(gnm_conf_set_stf_export_stringindicator): new
+	(gnm_conf_get_stf_export_terminator_node): new
+	(gnm_conf_get_stf_export_terminator): new
+	(gnm_conf_set_stf_export_terminator): new
+	* src/stf-export.c (gnm_stf_get_stfe): use the gconf info
+	
 2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/stf-export.c (gnm_stf_get_stfe): publish
diff --git a/schemas/gnumeric-dialogs.schemas.in b/schemas/gnumeric-dialogs.schemas.in
index 84ee899..5471faf 100644
--- a/schemas/gnumeric-dialogs.schemas.in
+++ b/schemas/gnumeric-dialogs.schemas.in
@@ -554,6 +554,39 @@
         <long>Please use the Print Setup dialog to edit this value.</long>
         </locale>
       </schema>
+      <schema>
+        <key>/schemas/apps/gnumeric/stf/export/stringindicator</key>
+        <applyto>/apps/gnumeric/stf/export/stringindicator</applyto>
+        <owner>Gnumeric</owner>
+        <type>string</type>
+	<default>&quot;</default>
+        <locale name="C">
+        <short>Text Export String Indicator</short>
+        <long>Please use the Text Export dialog to edit this value.</long>
+        </locale>
+      </schema>
+      <schema>
+        <key>/schemas/apps/gnumeric/stf/export/separator</key>
+        <applyto>/apps/gnumeric/stf/export/separator</applyto>
+        <owner>Gnumeric</owner>
+        <type>string</type>
+	<default>,</default>
+        <locale name="C">
+        <short>Text Export Field Separator</short>
+        <long>Please use the Text Export dialog to edit this value.</long>
+        </locale>
+      </schema>
+      <schema>
+        <key>/schemas/apps/gnumeric/stf/export/terminator</key>
+        <applyto>/apps/gnumeric/stf/export/terminator</applyto>
+        <owner>Gnumeric</owner>
+        <type>string</type>
+	<default>\n</default>
+        <locale name="C">
+        <short>Text Export Record Terminator</short>
+        <long>Please use the Text Export dialog to edit this value.</long>
+        </locale>
+      </schema>
    </schemalist>
 </gconfschemafile>
   
diff --git a/src/gnumeric-gconf.c b/src/gnumeric-gconf.c
index 5154403..7458b5d 100644
--- a/src/gnumeric-gconf.c
+++ b/src/gnumeric-gconf.c
@@ -2872,6 +2872,87 @@ gnm_conf_get_printsetup_scale_width_node (void)
 	return get_node (watch_printsetup_scale_width.key);
 }
 
+static struct cb_watch_string watch_stf_export_separator = {
+	0, "stf/export/separator", ",",
+};
+
+const char *
+gnm_conf_get_stf_export_separator (void)
+{
+	if (!watch_stf_export_separator.handler)
+		watch_string (&watch_stf_export_separator);
+	return watch_stf_export_separator.var;
+}
+
+void
+gnm_conf_set_stf_export_separator (const char *x)
+{
+	g_return_if_fail (x != NULL);
+	if (!watch_stf_export_separator.handler)
+		watch_string (&watch_stf_export_separator);
+	set_string (&watch_stf_export_separator, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_separator_node (void)
+{
+	return get_node (watch_stf_export_separator.key);
+}
+
+static struct cb_watch_string watch_stf_export_stringindicator = {
+	0, "stf/export/stringindicator", "\"",
+};
+
+const char *
+gnm_conf_get_stf_export_stringindicator (void)
+{
+	if (!watch_stf_export_stringindicator.handler)
+		watch_string (&watch_stf_export_stringindicator);
+	return watch_stf_export_stringindicator.var;
+}
+
+void
+gnm_conf_set_stf_export_stringindicator (const char *x)
+{
+	g_return_if_fail (x != NULL);
+	if (!watch_stf_export_stringindicator.handler)
+		watch_string (&watch_stf_export_stringindicator);
+	set_string (&watch_stf_export_stringindicator, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_stringindicator_node (void)
+{
+	return get_node (watch_stf_export_stringindicator.key);
+}
+
+static struct cb_watch_string watch_stf_export_terminator = {
+	0, "stf/export/terminator", "\n",
+};
+
+const char *
+gnm_conf_get_stf_export_terminator (void)
+{
+	if (!watch_stf_export_terminator.handler)
+		watch_string (&watch_stf_export_terminator);
+	return watch_stf_export_terminator.var;
+}
+
+void
+gnm_conf_set_stf_export_terminator (const char *x)
+{
+	g_return_if_fail (x != NULL);
+	if (!watch_stf_export_terminator.handler)
+		watch_string (&watch_stf_export_terminator);
+	set_string (&watch_stf_export_terminator, x);
+}
+
+GOConfNode *
+gnm_conf_get_stf_export_terminator_node (void)
+{
+	return get_node (watch_stf_export_terminator.key);
+}
+
 static struct cb_watch_int watch_undo_max_descriptor_width = {
 	0, "undo/max_descriptor_width", 5, 256, 40,
 };
diff --git a/src/gnumeric-gconf.h b/src/gnumeric-gconf.h
index 6143f2b..e5d7d8d 100644
--- a/src/gnumeric-gconf.h
+++ b/src/gnumeric-gconf.h
@@ -373,6 +373,18 @@ GOConfNode *gnm_conf_get_printsetup_scale_width_node (void);
 int gnm_conf_get_printsetup_scale_width (void);
 void gnm_conf_set_printsetup_scale_width (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 *);
+
+GOConfNode *gnm_conf_get_stf_export_stringindicator_node (void);
+const char *gnm_conf_get_stf_export_stringindicator (void);
+void gnm_conf_set_stf_export_stringindicator (const char *);
+
+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_undo_max_descriptor_width_node (void);
 int gnm_conf_get_undo_max_descriptor_width (void);
 void gnm_conf_set_undo_max_descriptor_width (int);
diff --git a/src/stf-export.c b/src/stf-export.c
index 578c4a9..31849ed 100644
--- a/src/stf-export.c
+++ b/src/stf-export.c
@@ -30,6 +30,7 @@
 #include <glib/gi18n-lib.h>
 #include "stf-export.h"
 
+#include "gnumeric-gconf.h"
 #include "sheet.h"
 #include "workbook.h"
 #include "cell.h"
@@ -573,11 +574,23 @@ gnm_stf_get_stfe (GObject *obj)
 {
 	GnmStfExport *stfe = g_object_get_data (obj, "stfe");
 	if (!stfe) {
+		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 ();
+		GString *triggers = g_string_new (NULL);
+		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", ", \t\n\"",
-				     "separator", " ",
+				     "quoting-triggers", triggers->str,
+				     "separator", sep,
+				     "quote", string_indicator,
+				     "eol", terminator,
 				     NULL);
 		g_object_set_data_full (obj, "stfe", stfe, g_object_unref);
+		g_string_free (triggers, TRUE);
 	}
 	return stfe;
 }



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