Documentation add subsections for each GRAPH type
[pspp] / src / ui / gui / psppire-window.c
index bc28a15fd1b94a6be46cf1a7f0375159d857d771..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);
@@ -701,7 +700,7 @@ psppire_window_file_chooser_dialog (PsppireWindow *toplevel)
                                 GTK_WINDOW (toplevel),
                                 GTK_FILE_CHOOSER_ACTION_OPEN,
                                 _("Cancel"), GTK_RESPONSE_CANCEL,
-                                _("Save"), GTK_RESPONSE_ACCEPT,
+                                _("Open"), GTK_RESPONSE_ACCEPT,
                                 NULL);
 
   g_object_set (dialog, "local-only", FALSE, NULL);
@@ -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;