[gnumeric] Remember text import configuration for export. [#142395]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Remember text import configuration for export. [#142395]
- Date: Sun, 10 Jan 2010 05:20:21 +0000 (UTC)
commit af930fabd947c0f69b3eb12f93d86b7d8fcfcdba
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sat Jan 9 22:19:38 2010 -0700
Remember text import configuration for export. [#142395]
2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/stf-export.c (gnm_stf_get_stfe): publish
* src/stf-export.h (gnm_stf_get_stfe): publish
* src/stf-parse.c (stf_read_remember_settings): new
(stf_parse_sheet): call stf_read_remember_settings
2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-stf-export.c (stf_export_dialog_format_page_init):
work around gtk bug #601922
ChangeLog | 9 ++++++++-
NEWS | 1 +
src/dialogs/ChangeLog | 5 +++++
src/dialogs/dialog-stf-export.c | 6 ++++++
src/stf-export.c | 2 +-
src/stf-export.h | 2 ++
src/stf-parse.c | 22 ++++++++++++++++++++++
7 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3cff459..64a22b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2010-01-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/stf-export.c (gnm_stf_get_stfe): publish
+ * src/stf-export.h (gnm_stf_get_stfe): publish
+ * src/stf-parse.c (stf_read_remember_settings): new
+ (stf_parse_sheet): call stf_read_remember_settings
+
+2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/func.c (function_dump_defs): make sure the argument
descriptions precede a SEEALSO. Documentation creation
diff --git a/NEWS b/NEWS
index 44ee01d..e02106d 100644
--- a/NEWS
+++ b/NEWS
@@ -222,6 +222,7 @@ Andreas:
* Fix crash on unknown chart type. [#594041]
* Handle ODF import/export of surface plots originally created in
XL [#594041]
+ * Remember text import configuration for export. [#142395]
Jean:
* Don't use simple GOData when importing xls files. [#594068]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 4e335d9..6c80762 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,10 @@
2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * dialog-stf-export.c (stf_export_dialog_format_page_init):
+ work around gtk bug #601922
+
+2010-01-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* dialog-cell-format.c (cb_fmt_dialog_dialog_buttons): make sure that
the correct sheet is active
diff --git a/src/dialogs/dialog-stf-export.c b/src/dialogs/dialog-stf-export.c
index 59ec446..11706fa 100644
--- a/src/dialogs/dialog-stf-export.c
+++ b/src/dialogs/dialog-stf-export.c
@@ -177,6 +177,12 @@ stf_export_dialog_format_page_init (TextExportState *state)
state->format.quotechar = GTK_COMBO_BOX_ENTRY (glade_xml_get_widget (state->gui, "format_quotechar"));
g_object_get (sobj, "quote", &s, NULL);
+
+#ifdef HAVE_GTK_ENTRY_GET_BUFFER
+ /* We need to work around gtk bug #601922 */
+ gtk_entry_get_buffer (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (state->format.quotechar))));
+#endif
+
gtk_editable_insert_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (state->format.quotechar))),
s, -1, &pos);
g_free (s);
diff --git a/src/stf-export.c b/src/stf-export.c
index 82a87f2..578c4a9 100644
--- a/src/stf-export.c
+++ b/src/stf-export.c
@@ -568,7 +568,7 @@ GSF_CLASS (GnmStfExport, gnm_stf_export,
#include "dialog-stf-export.h"
#include "workbook-view.h"
-static GnmStfExport *
+GnmStfExport *
gnm_stf_get_stfe (GObject *obj)
{
GnmStfExport *stfe = g_object_get_data (obj, "stfe");
diff --git a/src/stf-export.h b/src/stf-export.h
index d03f68b..522074b 100644
--- a/src/stf-export.h
+++ b/src/stf-export.h
@@ -36,6 +36,8 @@ GSList *gnm_stf_export_options_sheet_list_get (const GnmStfExport *stfe);
gboolean gnm_stf_export_can_transliterate (void);
+GnmStfExport *gnm_stf_get_stfe (GObject *obj);
+
gboolean gnm_stf_export (GnmStfExport *export_options);
diff --git a/src/stf-parse.c b/src/stf-parse.c
index 340595f..b47d590 100644
--- a/src/stf-parse.c
+++ b/src/stf-parse.c
@@ -30,6 +30,7 @@
#include <glib/gi18n-lib.h>
#include "gnumeric.h"
#include "stf-parse.h"
+#include "stf-export.h"
#include "workbook.h"
#include "cell.h"
@@ -1213,6 +1214,25 @@ stf_cell_set_text (GnmCell *cell, char const *text)
}
}
+static void
+stf_read_remember_settings (Workbook *book, StfParseOptions_t *po)
+{
+ if (po->parsetype == PARSE_TYPE_CSV) {
+ GnmStfExport *stfe = gnm_stf_get_stfe (G_OBJECT (book));
+ char quote[6];
+ int length = g_unichar_to_utf8 (po->stringindicator, quote);
+ if (length > 5) {
+ quote[0] = '"';
+ quote[1] = '\0';
+ } else quote[length] = '\0';
+
+ g_object_set (G_OBJECT (stfe), "separator", po->sep.chr, "quote", "e, NULL);
+
+ if ((po->terminator != NULL) && (po->terminator->data != NULL))
+ g_object_set (G_OBJECT (stfe), "eol", po->terminator->data, NULL);
+ }
+}
+
gboolean
stf_parse_sheet (StfParseOptions_t *parseoptions,
char const *data, char const *data_end,
@@ -1295,6 +1315,8 @@ stf_parse_sheet (StfParseOptions_t *parseoptions,
if (lines)
stf_parse_general_free (lines);
g_string_chunk_free (lines_chunk);
+ if (result)
+ stf_read_remember_settings (sheet->workbook, parseoptions);
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]