From: John Darrington Date: Sun, 14 Aug 2016 05:51:36 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' into sheet X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f062823782af5f98fecb1808136df3d565194698;hp=d3fd659f663602b5564e4c750c0bebe48ff72865;p=pspp Merge remote-tracking branch 'origin/master' into sheet Conflicts: src/ui/gui/psppire-data-window.c --- diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c index 6b908e0fe7..7fa660df84 100644 --- a/src/ui/gui/main.c +++ b/src/ui/gui/main.c @@ -215,16 +215,13 @@ destroy_splash (gpointer ud) 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 (); if (wsplash) { - gtk_window_set_transient_for (GTK_WINDOW (wsplash), GTK_WINDOW (x)); - gtk_application_add_window (GTK_APPLICATION (app), 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)); @@ -240,14 +237,28 @@ on_activate (GApplication * app, gpointer ud) 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); } diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index c0f8ba5344..b4c9b09dac 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -2023,9 +2023,7 @@ create_data_window (void) return GTK_WINDOW (w); } - - -void +GtkWindow * open_data_window (PsppireWindow *victim, const char *file_name, const char *encoding, gpointer hint) { @@ -2042,4 +2040,5 @@ open_data_window (PsppireWindow *victim, const char *file_name, psppire_window_load (PSPPIRE_WINDOW (window), file_name, encoding, hint); gtk_widget_show_all (window); + return GTK_WINDOW (window); } diff --git a/src/ui/gui/psppire-data-window.h b/src/ui/gui/psppire-data-window.h index ee4d8e0cab..fa983fabf1 100644 --- a/src/ui/gui/psppire-data-window.h +++ b/src/ui/gui/psppire-data-window.h @@ -119,7 +119,7 @@ PsppireDataWindow *psppire_data_window_for_data_store (PsppireDataStore *); 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 diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 13101f9394..38a4a3f4ff 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -647,13 +647,15 @@ create_syntax_window (void) 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); } diff --git a/src/ui/gui/psppire-syntax-window.h b/src/ui/gui/psppire-syntax-window.h index 3c6cd1e119..ce4beac203 100644 --- a/src/ui/gui/psppire-syntax-window.h +++ b/src/ui/gui/psppire-syntax-window.h @@ -86,7 +86,7 @@ GType psppire_syntax_window_get_type (void); 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 diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index 7d9cdf5298..20f5130e81 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -195,7 +195,7 @@ psppire_set_lexer (struct lexer *lexer) } -void +GtkWindow * psppire_preload_file (const gchar *file) { const gchar *local_encoding = "UTF-8"; @@ -207,16 +207,18 @@ psppire_preload_file (const gchar *file) const char *filename = fh_get_file_name (fh); int retval = any_reader_detect (fh, NULL); - + + GtkWindow *w = NULL; /* 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; } diff --git a/src/ui/gui/psppire.h b/src/ui/gui/psppire.h index e65554d13c..311e7c19ad 100644 --- a/src/ui/gui/psppire.h +++ b/src/ui/gui/psppire.h @@ -19,6 +19,7 @@ #include #include +#include #include @@ -47,7 +48,7 @@ void psppire_set_lexer (struct lexer *); void register_selection_functions (void); -void psppire_preload_file (const gchar *file); +GtkWindow * psppire_preload_file (const gchar *file); #endif /* PSPPIRE_H */