Makefiles: Add $(AM_V_GEN) and $(AM_V_at) to a few more rules.
[pspp] / src / ui / gui / psppire-window.c
index fadc70c85f9c3625dad2e22127a47ded194830ce..8e34c214be3db729a4b5f7fb9d99eb35214e7b2c 100644 (file)
@@ -30,7 +30,7 @@
 #define N_(msgid) msgid
 
 #include "data/any-reader.h"
-#include "data/file-name.h"
+#include "data/file-handle-def.h"
 #include "data/dataset.h"
 #include "libpspp/version.h"
 
@@ -39,7 +39,6 @@
 #include "psppire-encoding-selector.h"
 #include "psppire-syntax-window.h"
 #include "psppire-window-register.h"
-#include "psppire.h"
 
 static void psppire_window_base_init     (PsppireWindowClass *class);
 static void psppire_window_class_init    (PsppireWindowClass *class);
@@ -780,19 +779,22 @@ psppire_window_open (PsppireWindow *de)
        gchar *name =
          gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 
-       gchar *sysname = convert_glib_filename_to_system_filename (name, NULL);
+       const gchar **cs = NULL;
+       g_get_filename_charsets (&cs);
 
         gchar *encoding = psppire_encoding_selector_get_encoding (
           gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
 
-        int retval = any_reader_detect (sysname, NULL);
+       struct file_handle *fh = fh_create_file (NULL, name, cs[0], fh_default_properties ());
+
+        int retval = any_reader_detect (fh, NULL);
        if (retval == 1)
           open_data_window (de, name, encoding, NULL);
        else if (retval == 0)
          open_syntax_window (name, encoding);
 
         g_free (encoding);
-       g_free (sysname);
+       fh_unref (fh);
        g_free (name);
       }
       break;