data-in: Get rid of first_column, last_column arguments.
[pspp] / src / ui / gui / text-data-import-dialog.c
index 5add061365a082a2e90ef4f91719d89c6e0f394e..13c6d96804e48903a72cf37e16699c0e788d0e3b 100644 (file)
@@ -458,7 +458,7 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window)
   stream = fopen (file->file_name, "r");
   if (stream == NULL)
     {
-      msg (ME, _("Could not open \"%s\": %s"),
+      msg (ME, _("Could not open `%s': %s"),
            file->file_name, strerror (errno));
       return false;
     }
@@ -474,10 +474,10 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window)
           if (feof (stream))
             break;
           else if (ferror (stream))
-            msg (ME, _("Error reading \"%s\": %s"),
+            msg (ME, _("Error reading `%s': %s"),
                  file->file_name, strerror (errno));
           else
-            msg (ME, _("Failed to read \"%s\", because it contains a line "
+            msg (ME, _("Failed to read `%s', because it contains a line "
                        "over %d bytes long and therefore appears not to be "
                        "a text file."),
                  file->file_name, MAX_LINE_LEN);
@@ -491,7 +491,7 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window)
 
   if (file->line_cnt == 0)
     {
-      msg (ME, _("\"%s\" is empty."), file->file_name);
+      msg (ME, _("`%s' is empty."), file->file_name);
       fclose (stream);
       destroy_file (ia);
       return false;
@@ -1775,20 +1775,19 @@ parse_field (struct import_assistant *ia,
   tooltip = NULL;
   if (field.string != NULL)
     {
-      msg_disable ();
+      char *error;
 
-      if (!data_in (field, LEGACY_NATIVE, in->type, 0, 0, 0,
-                   ia->formats.dict,
-                    &val, var_get_width (var)))
+      error = data_in (field, LEGACY_NATIVE, in->type, &val,
+                       var_get_width (var),
+                       dict_get_encoding (ia->formats.dict));
+      if (error != NULL)
         {
-          char fmt_string[FMT_STRING_LEN_MAX + 1];
-          fmt_to_string (in, fmt_string);
-          tooltip = xasprintf (_("Field content \"%.*s\" cannot be parsed in "
-                                 "format %s."),
+          tooltip = xasprintf (_("Cannot parse field content `%.*s' as "
+                                 "format %s: %s"),
                                (int) field.length, field.string,
-                               fmt_string);
+                               fmt_name (in->type), error);
+          free (error);
         }
-      msg_enable ();
     }
   else
     {