/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
static gboolean
-load_file (PsppireWindow *de, const gchar *file_name)
+load_file (PsppireWindow *de, const gchar *file_name, gpointer syn)
{
- struct string filename;
- gchar *utf8_file_name;
- const char *mime_type;
- gchar *syntax;
+ const char *mime_type = NULL;
+ gchar *syntax = NULL;
bool ok;
- ds_init_empty (&filename);
-
- utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
-
- syntax_gen_string (&filename, ss_cstr (utf8_file_name));
-
- g_free (utf8_file_name);
+ if (syn == NULL)
+ {
+ gchar *utf8_file_name;
+ struct string filename;
+ ds_init_empty (&filename);
+
+ utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
+
+ syntax_gen_string (&filename, ss_cstr (utf8_file_name));
+
+ g_free (utf8_file_name);
+
+ syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename));
+ ds_destroy (&filename);
- syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename));
- ds_destroy (&filename);
+ }
+ else
+ {
+ syntax = syn;
+ }
ok = execute_syntax (PSPPIRE_DATA_WINDOW (de),
lex_reader_for_string (syntax));
g_free (syntax);
- mime_type = (name_has_por_suffix (file_name)
- ? "application/x-spss-por"
- : "application/x-spss-sav");
-
- add_most_recent (file_name, mime_type);
+ if (ok && syn == NULL)
+ {
+ if (name_has_por_suffix (file_name))
+ mime_type = "application/x-spss-por";
+ else if (name_has_sav_suffix (file_name))
+ mime_type = "application/x-spss-sav";
+
+ add_most_recent (file_name, mime_type);
+ }
return ok;
}
g_free (uri);
- open_data_window (window, file);
+ open_data_window (window, file, NULL);
g_free (file);
}
free (encoding);
- if ( psppire_window_load (PSPPIRE_WINDOW (se), file) )
+ if ( psppire_window_load (PSPPIRE_WINDOW (se), file, NULL) )
gtk_widget_show (se);
else
gtk_widget_destroy (se);
GtkWidget *dw;
if (the_session == NULL)
- the_session = session_create ();
+ the_session = session_create (NULL);
if (ds == NULL)
{
}
void
-open_data_window (PsppireWindow *victim, const char *file_name)
+open_data_window (PsppireWindow *victim, const char *file_name, gpointer hint)
{
GtkWidget *window;
else
window = psppire_data_window_new (NULL);
- psppire_window_load (PSPPIRE_WINDOW (window), file_name);
+ psppire_window_load (PSPPIRE_WINDOW (window), file_name, hint);
gtk_widget_show_all (window);
}