[gnumeric] Allow for the omission of a string indicator (quote) in configurable text import [#658981]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Allow for the omission of a string indicator (quote) in configurable text import [#658981]
- Date: Wed, 28 Sep 2011 22:06:37 +0000 (UTC)
commit c546fe8e07db93d71ee5fde84ba158c83481972b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Sep 28 16:05:10 2011 -0600
Allow for the omission of a string indicator (quote) in configurable text import [#658981]
2011-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-stf-csv-page.c (csv_page_textindicator_change): allow \0
as string indicator
2011-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/stf-parse.c (stf_parse_options_csv_set_stringindicator): allow \0
as stringindicator
(stf_parse_options_valid): ditto
(stf_parse_csv_cell): ditto
ChangeLog | 7 +++++++
NEWS | 2 ++
src/dialogs/ChangeLog | 5 +++++
src/dialogs/dialog-stf-csv-page.c | 5 ++---
src/stf-parse.c | 12 +++---------
5 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da69cef..d71cb03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/stf-parse.c (stf_parse_options_csv_set_stringindicator): allow \0
+ as stringindicator
+ (stf_parse_options_valid): ditto
+ (stf_parse_csv_cell): ditto
+
2011-09-27 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gui-clipboard.c (target_list_to_entries): deleted and
diff --git a/NEWS b/NEWS
index 9e3a24e..998a920 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ Andreas:
* Fix graph editor crash. [#658223]
* Fix import of non-UTF8 csv files. [#658916]
* Fix copy/paste of graphs to other programs. [#660242]
+ * Allow for the omission of a string indicator (quote) in configurable
+ text import [#658981]
Jean:
* Make things build against gtk+-3.0.
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 1118cbd..f68fb24 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * dialog-stf-csv-page.c (csv_page_textindicator_change): allow \0
+ as string indicator
+
2011-09-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* regression.ui: fix layout
diff --git a/src/dialogs/dialog-stf-csv-page.c b/src/dialogs/dialog-stf-csv-page.c
index 8d63b19..f41610f 100644
--- a/src/dialogs/dialog-stf-csv-page.c
+++ b/src/dialogs/dialog-stf-csv-page.c
@@ -132,9 +132,8 @@ csv_page_textindicator_change (G_GNUC_UNUSED GtkWidget *widget,
{
char *textfieldtext = gtk_editable_get_chars (GTK_EDITABLE (data->csv.csv_textfield), 0, -1);
gunichar str_ind = g_utf8_get_char (textfieldtext);
- if (str_ind != '\0')
- stf_parse_options_csv_set_stringindicator (data->parseoptions,
- str_ind);
+
+ stf_parse_options_csv_set_stringindicator (data->parseoptions, str_ind);
g_free (textfieldtext);
stf_parse_options_csv_set_indicator_2x_is_single (data->parseoptions,
diff --git a/src/stf-parse.c b/src/stf-parse.c
index fd7b2d5..fff81c7 100644
--- a/src/stf-parse.c
+++ b/src/stf-parse.c
@@ -306,7 +306,6 @@ void
stf_parse_options_csv_set_stringindicator (StfParseOptions_t *parseoptions, gunichar const stringindicator)
{
g_return_if_fail (parseoptions != NULL);
- g_return_if_fail (stringindicator != '\0');
parseoptions->stringindicator = stringindicator;
}
@@ -437,13 +436,7 @@ stf_parse_options_valid (StfParseOptions_t *parseoptions)
{
g_return_val_if_fail (parseoptions != NULL, FALSE);
- if (parseoptions->parsetype == PARSE_TYPE_CSV) {
- if (parseoptions->stringindicator == '\0') {
- g_warning ("STF: Cannot have \\0 as string indicator");
- return FALSE;
- }
-
- } else if (parseoptions->parsetype == PARSE_TYPE_FIXED) {
+ if (parseoptions->parsetype == PARSE_TYPE_FIXED) {
if (!parseoptions->splitpositions) {
g_warning ("STF: No splitpositions in struct");
return FALSE;
@@ -597,7 +590,8 @@ stf_parse_csv_cell (GString *text, Source_t *src, StfParseOptions_t *parseoption
cur = g_utf8_next_char (cur);
}
- if (g_utf8_get_char (cur) == parseoptions->stringindicator) {
+ if (parseoptions->stringindicator != 0 &&
+ g_utf8_get_char (cur) == parseoptions->stringindicator) {
cur = g_utf8_next_char (cur);
while (*cur) {
gunichar uc = g_utf8_get_char (cur);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]