gui: Make syntax execution functions take a PsppireDataWindow argument.
[pspp-builds.git] / src / ui / gui / text-data-import-dialog.c
index e5c48fdb217c83684c640520bd993f2d4a20e4b9..ee42b7d8894e43ee57ca0ef51a2b9efa8ddbd3c3 100644 (file)
@@ -232,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);
@@ -258,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)));
@@ -330,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");
@@ -476,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)
@@ -872,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);
 
@@ -1252,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++)
     {
@@ -1595,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++)
     {