X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Ftext-data-import-dialog.c;h=215a444c4861ba2d5d2faa0117b0608158af982a;hb=9c3c856e0512309c9c301ee41c2d465dbbe9b8c6;hp=298fd18d95cec244e4f3edf6c0791a52124b987f;hpb=b28e509a8bd42ec40b60184b89457e762e5c4e0b;p=pspp diff --git a/src/ui/gui/text-data-import-dialog.c b/src/ui/gui/text-data-import-dialog.c index 298fd18d95..215a444c48 100644 --- a/src/ui/gui/text-data-import-dialog.c +++ b/src/ui/gui/text-data-import-dialog.c @@ -32,6 +32,7 @@ #include "language/data-io/data-parser.h" #include "language/lexer/lexer.h" #include "libpspp/assertion.h" +#include "libpspp/i18n.h" #include "libpspp/message.h" #include "ui/gui/checkbox-treeview.h" #include "ui/gui/descriptives-dialog.h" @@ -231,8 +232,9 @@ static void pop_watch_cursor (struct import_assistant *); /* Pops up the Text Data Import assistant. */ void -text_data_import_assistant (GtkWindow *parent_window) +text_data_import_assistant (PsppireDataWindow *dw) { + GtkWindow *parent_window = GTK_WINDOW (dw); struct import_assistant *ia; ia = xzalloc (sizeof *ia); @@ -257,7 +259,7 @@ text_data_import_assistant (GtkWindow *parent_window) switch (ia->asst.response) { case GTK_RESPONSE_APPLY: - free (execute_syntax_string (generate_syntax (ia))); + free (execute_syntax_string (dw, generate_syntax (ia))); break; case PSPPIRE_RESPONSE_PASTE: free (paste_syntax_to_window (generate_syntax (ia))); @@ -329,7 +331,7 @@ apply_dict (const struct dictionary *dict, struct string *s) ds_put_cstr (s, "\n "); syntax_gen_value (s, &vl->value, width, format); ds_put_byte (s, ' '); - syntax_gen_string (s, ss_cstr (val_lab_get_label (vl))); + syntax_gen_string (s, ss_cstr (val_lab_get_escaped_label (vl))); } free (labels); ds_put_cstr (s, ".\n"); @@ -475,8 +477,8 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window) destroy_file (ia); return false; } - ds_chomp (line, '\n'); - ds_chomp (line, '\r'); + ds_chomp_byte (line, '\n'); + ds_chomp_byte (line, '\r'); } if (file->line_cnt == 0) @@ -871,7 +873,7 @@ create_lines_tree_view (GtkContainer *parent, struct import_assistant *ia) size_t max_line_length; gint content_width, header_width; size_t i; - gchar *title = _("Text"); + const gchar *title = _("Text"); make_tree_view (ia, 0, &tree_view); @@ -1251,7 +1253,7 @@ choose_column_names (struct import_assistant *ia) struct column *col; size_t name_row; - dict = dict_create (); + dict = dict_create (get_default_encoding ()); name_row = f->variable_names && f->skip_lines ? f->skip_lines : 0; for (col = s->columns; col < &s->columns[s->column_cnt]; col++) { @@ -1594,7 +1596,7 @@ prepare_formats_page (struct import_assistant *ia) push_watch_cursor (ia); - dict = dict_create (); + dict = dict_create (get_default_encoding ()); fg = fmt_guesser_create (); for (column_idx = 0; column_idx < s->column_cnt; column_idx++) { @@ -1768,8 +1770,7 @@ parse_field (struct import_assistant *ia, { char *error; - error = data_in (field, LEGACY_NATIVE, in->type, &val, - var_get_width (var), + error = data_in (field, C_ENCODING, in->type, &val, var_get_width (var), dict_get_encoding (ia->formats.dict)); if (error != NULL) { @@ -1881,7 +1882,7 @@ get_tooltip_location (GtkWidget *widget, gint wx, gint wy, to make the data related to the tool tips part of a GObject that only gets destroyed when all references are released, but this solution appears to be effective too. */ - if (!GTK_WIDGET_MAPPED (widget)) + if (!gtk_widget_get_mapped (widget)) return FALSE; gtk_tree_view_convert_widget_to_bin_window_coords (tree_view,