Merge remote-tracking branch 'origin/master' into sheet
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Aug 2016 05:51:36 +0000 (07:51 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Aug 2016 05:51:36 +0000 (07:51 +0200)
Conflicts:
src/ui/gui/psppire-data-window.c

src/ui/gui/main.c
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-data-window.h
src/ui/gui/psppire-syntax-window.c
src/ui/gui/psppire-syntax-window.h
src/ui/gui/psppire.c
src/ui/gui/psppire.h

index 6b908e0fe7a293b7a5bdfcbbfe35d47ac614b8bc..7fa660df84349806386d4c6c3e424ba7e18d4b82 100644 (file)
@@ -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);
 }
 
 
index c0f8ba5344cea4b48baeca0d9f5224bd883126fa..b4c9b09dac21251a56d6bbe2b651742e79dbed18 100644 (file)
@@ -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);
 }
index ee4d8e0cab767d54509194e7401d06471371e5a9..fa983fabf1129a2303e75f68b6a93a104264c16a 100644 (file)
@@ -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
index 13101f9394da34ab08bad3eed75398951d87cc87..38a4a3f4ff94a3f8ddad8ac8be334de9d570c5fa 100644 (file)
@@ -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);
 }
 
 
index 3c6cd1e1194fe83652392c4c9074e7cc20dae14a..ce4beac203488b04625af52088d9bbaef0242064 100644 (file)
@@ -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
 
index 7d9cdf52981c2c424de41ffafd26e4041c08c7b8..20f5130e81895d00bff35c5208ef781a8ea1d697 100644 (file)
@@ -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;
 }
index e65554d13c4c37cf459118f69a04efe2e16f80dc..311e7c19ad4f37ae9f962d86da98044c1606a007 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <glib.h>
 #include <gio/gio.h>
+#include <gtk/gtk.h>
 
 #include <stdbool.h>
 
@@ -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 */