return G_SOURCE_REMOVE;
}
+
static void
-on_activate (GApplication * app, gpointer ud)
+wait_for_splash (GApplication *app, GtkWindow *x)
{
- post_initialise (app);
-
- GtkWindow *x = create_data_window ();
- gtk_application_add_window (GTK_APPLICATION (app), x);
if (wsplash)
{
- gtk_window_set_transient_for (GTK_WINDOW (wsplash), GTK_WINDOW (x));
+ gtk_window_set_transient_for (GTK_WINDOW (wsplash), x);
gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (wsplash));
gtk_window_set_keep_above (GTK_WINDOW (wsplash), TRUE);
gtk_window_present (GTK_WINDOW (wsplash));
static void
-on_open (GApplication * app, GFile ** files, gint n_files, gchar * hint,
+on_activate (GApplication * app, gpointer ud)
+{
+ post_initialise (app);
+
+ GtkWindow *x = create_data_window ();
+ gtk_application_add_window (GTK_APPLICATION (app), x);
+
+ wait_for_splash (app, x);
+}
+
+
+static void
+on_open (GApplication *app, GFile **files, gint n_files, gchar * hint,
gpointer ud)
{
post_initialise (app);
gchar *file = g_file_get_parse_name (files[0]);
- psppire_preload_file (file);
+ GtkWindow *x = psppire_preload_file (file);
g_free (file);
+
+ wait_for_splash (app, x);
}
return GTK_WINDOW (w);
}
-void
+GtkWindow *
open_data_window (PsppireWindow *victim, const char *file_name,
const char *encoding, gpointer hint)
{
psppire_window_load (PSPPIRE_WINDOW (window), file_name, encoding, hint);
gtk_widget_show_all (window);
+ return GTK_WINDOW (window);
}
bool psppire_data_window_is_empty (PsppireDataWindow *);
GtkWindow * create_data_window (void);
-void open_data_window (PsppireWindow *victim, const char *file_name,
+GtkWindow * open_data_window (PsppireWindow *victim, const char *file_name,
const char *encoding, gpointer hint);
G_END_DECLS
gtk_widget_show (w);
}
-void
+GtkWindow *
open_syntax_window (const char *file_name, const gchar *encoding)
{
GtkWidget *se = psppire_syntax_window_new (NULL);
if ( file_name)
load_and_show_syntax_window (se, file_name, encoding);
+
+ return GTK_WINDOW (se);
}
GtkWidget* psppire_syntax_window_new (const char *encoding);
void create_syntax_window (void);
-void open_syntax_window (const char *file_name, const char *encoding);
+GtkWindow * open_syntax_window (const char *file_name, const char *encoding);
G_END_DECLS
}
-void
+GtkWindow *
psppire_preload_file (const gchar *file)
{
const gchar *local_encoding = "UTF-8";
const char *filename = fh_get_file_name (fh);
int retval = any_reader_detect (fh, NULL);
-
+
+ GtkWindow *w ;
/* Check to see if the file is a .sav or a .por file. If not
assume that it is a syntax file */
if (retval == 1)
- open_data_window (NULL, filename, NULL, NULL);
+ w = open_data_window (NULL, filename, NULL, NULL);
else if (retval == 0)
{
create_data_window ();
- open_syntax_window (filename, NULL);
+ w = open_syntax_window (filename, NULL);
}
fh_unref (fh);
+ return w;
}
#include <glib.h>
#include <gio/gio.h>
+#include <gtk/gtk.h>
#include <stdbool.h>
void register_selection_functions (void);
-void psppire_preload_file (const gchar *file);
+GtkWindow * psppire_preload_file (const gchar *file);
#endif /* PSPPIRE_H */