From: Ben Pfaff Date: Mon, 30 Dec 2019 06:35:16 +0000 (+0000) Subject: psppire-import-assistant: Implement quotation checkbox and combo box. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e20892b7e15cc5a8b9e01dc92d1539fadc1f8a9;p=pspp psppire-import-assistant: Implement quotation checkbox and combo box. This seems to have been overlooked. Bug #57457. --- diff --git a/src/ui/gui/psppire-import-assistant.c b/src/ui/gui/psppire-import-assistant.c index 8270938373..edab2288f2 100644 --- a/src/ui/gui/psppire-import-assistant.c +++ b/src/ui/gui/psppire-import-assistant.c @@ -1024,32 +1024,6 @@ psppire_import_assistant_new (GtkWindow *toplevel) -static void -set_quote_list (GtkComboBox *cb) -{ - GtkListStore *list = gtk_list_store_new (1, G_TYPE_STRING); - GtkTreeIter iter; - gint i; - const gchar *separator[3] = {"'\"", "\'", "\""}; - - for (i = 0; i < 3; i++) - { - const gchar *s = separator[i]; - - /* Add a new row to the model */ - gtk_list_store_append (list, &iter); - gtk_list_store_set (list, &iter, - 0, s, - -1); - - } - - gtk_combo_box_set_model (GTK_COMBO_BOX (cb), GTK_TREE_MODEL (list)); - g_object_unref (list); - - gtk_combo_box_set_entry_text_column (cb, 0); -} - /* Chooses a name for each column on the separators page */ static void choose_column_names (PsppireImportAssistant *ia) @@ -1159,10 +1133,9 @@ separators_page_create (PsppireImportAssistant *ia) ia->custom_cb = get_widget_assert (builder, "custom-cb"); ia->custom_entry = get_widget_assert (builder, "custom-entry"); ia->quote_combo = get_widget_assert (builder, "quote-combo"); - ia->quote_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (ia->quote_combo))); ia->quote_cb = get_widget_assert (builder, "quote-cb"); - set_quote_list (GTK_COMBO_BOX (ia->quote_combo)); + gtk_combo_box_set_active (GTK_COMBO_BOX (ia->quote_combo), 0); if (ia->fields_tree_view == NULL) { @@ -1423,8 +1396,15 @@ separators_append_syntax (const PsppireImportAssistant *ia, struct string *s) } } ds_put_cstr (s, "\"\n"); - if (!ds_is_empty (&ia->quotes)) - syntax_gen_pspp (s, " /QUALIFIER=%sq\n", ds_cstr (&ia->quotes)); + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ia->quote_cb))) + { + GtkComboBoxText *cbt = GTK_COMBO_BOX_TEXT (ia->quote_combo); + gchar *quotes = gtk_combo_box_text_get_active_text (cbt); + if (quotes && *quotes) + syntax_gen_pspp (s, " /QUALIFIER=%sq\n", quotes); + free (quotes); + } } static void diff --git a/src/ui/gui/psppire-import-assistant.h b/src/ui/gui/psppire-import-assistant.h index cdcf8fb73e..3e1d7e8433 100644 --- a/src/ui/gui/psppire-import-assistant.h +++ b/src/ui/gui/psppire-import-assistant.h @@ -96,7 +96,6 @@ struct _PsppireImportAssistant GtkWidget *quote_cb; GtkWidget *quote_combo; - GtkEntry *quote_entry; GtkWidget *fields_tree_view; /* END Page where the user chooses field separators. */ diff --git a/src/ui/gui/text-data-import.ui b/src/ui/gui/text-data-import.ui index 86e6f39906..3cc118610f 100644 --- a/src/ui/gui/text-data-import.ui +++ b/src/ui/gui/text-data-import.ui @@ -514,7 +514,7 @@ 6 6 - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -525,6 +525,11 @@ False + + '" + ' + " + 1