gnucash unstable: Fix transient parent warnings for tip-of-the-day and file dialogs

Geert Janssens gjanssens at code.gnucash.org
Fri Dec 8 17:29:31 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/98d41bc3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/ac89797e (commit)



commit 98d41bc374dffa07a1a7553b70d096002ef8b0c3
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Dec 8 23:29:21 2017 +0100

    Fix transient parent warnings for tip-of-the-day and file dialogs

diff --git a/gnucash/gnome-utils/dialog-file-access.c b/gnucash/gnome-utils/dialog-file-access.c
index 7cd36f3..c641b8a 100644
--- a/gnucash/gnome-utils/dialog-file-access.c
+++ b/gnucash/gnome-utils/dialog-file-access.c
@@ -144,15 +144,15 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus
             gboolean open_readonly = faw->readonly_checkbutton
                                      ? gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(faw->readonly_checkbutton))
                                      : FALSE;
-            gnc_file_open_file( url, open_readonly );
+            gnc_file_open_file (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url, open_readonly);
         }
         else if ( faw->type == FILE_ACCESS_SAVE_AS )
         {
-            gnc_file_do_save_as( url );
+            gnc_file_do_save_as (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url);
         }
         else if ( faw->type == FILE_ACCESS_EXPORT )
         {
-            gnc_file_do_export( url );
+            gnc_file_do_export (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url);
         }
         break;
 
@@ -240,7 +240,7 @@ get_default_database( void )
 }
 
 static void
-gnc_ui_file_access( int type )
+gnc_ui_file_access (GtkWindow *parent, int type)
 {
     FileAccessWindow *faw;
     GtkBuilder* builder;
@@ -275,6 +275,7 @@ gnc_ui_file_access( int type )
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-file-access.glade", "file_access_dialog" );
     faw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "file_access_dialog" ));
+    gtk_window_set_transient_for (GTK_WINDOW (faw->dialog), parent);
     g_object_set_data_full( G_OBJECT(faw->dialog), "FileAccessWindow", faw, g_free );
 
     // Set the style context for this dialog so it can be easily manipulated with css
@@ -446,21 +447,21 @@ gnc_ui_file_access( int type )
 }
 
 void
-gnc_ui_file_access_for_open( void )
+gnc_ui_file_access_for_open (GtkWindow *parent)
 {
-    gnc_ui_file_access( FILE_ACCESS_OPEN );
+    gnc_ui_file_access (parent, FILE_ACCESS_OPEN);
 }
 
 
 void
-gnc_ui_file_access_for_save_as( void )
+gnc_ui_file_access_for_save_as (GtkWindow *parent)
 {
-    gnc_ui_file_access( FILE_ACCESS_SAVE_AS );
+    gnc_ui_file_access (parent, FILE_ACCESS_SAVE_AS);
 }
 
 
 void
-gnc_ui_file_access_for_export( void )
+gnc_ui_file_access_for_export (GtkWindow *parent)
 {
-    gnc_ui_file_access( FILE_ACCESS_EXPORT );
+    gnc_ui_file_access (parent, FILE_ACCESS_EXPORT);
 }
diff --git a/gnucash/gnome-utils/dialog-file-access.h b/gnucash/gnome-utils/dialog-file-access.h
index 8dd61ab..bf8cb38 100644
--- a/gnucash/gnome-utils/dialog-file-access.h
+++ b/gnucash/gnome-utils/dialog-file-access.h
@@ -34,9 +34,9 @@
  *  loading/open and for saving.
  */
 
-void gnc_ui_file_access_for_open( void );
-void gnc_ui_file_access_for_save_as( void );
-void gnc_ui_file_access_for_export( void );
+void gnc_ui_file_access_for_open (GtkWindow *parent);
+void gnc_ui_file_access_for_save_as (GtkWindow *parent);
+void gnc_ui_file_access_for_export (GtkWindow *parent);
 
 /** @} */
 
diff --git a/gnucash/gnome-utils/dialog-totd.c b/gnucash/gnome-utils/dialog-totd.c
index 91e9e16..0aa680e 100644
--- a/gnucash/gnome-utils/dialog-totd.c
+++ b/gnucash/gnome-utils/dialog-totd.c
@@ -34,6 +34,7 @@
 #include "gnc-prefs.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-engine.h"
+#include "gnc-ui.h"
 
 #define GNC_PREFS_GROUP      "dialogs.totd"
 #define GNC_PREF_CURRENT_TIP "current-tip"
@@ -274,7 +275,8 @@ show_handler (const char *class_name, gint component_id,
         return(FALSE);
     }
 
-    gtk_window_present(GTK_WINDOW(totd_dialog->dialog));
+    gtk_window_set_transient_for (GTK_WINDOW (totd_dialog->dialog),
+                                  gnc_ui_get_main_window (NULL));
     LEAVE(" ");
     return(TRUE);
 }
@@ -374,3 +376,17 @@ gnc_totd_dialog (GtkWindow *parent, gboolean startup)
 
     LEAVE("");
 }
+
+
+
+/****************************************************
+ *  Set the totd dialog transient for the currently
+ *  active main window. This will prevent the totd
+ *  dialog from accidentally hiding behind a main
+ *  window.
+ ****************************************************/
+void
+gnc_totd_dialog_reparent (void)
+{
+    gnc_forall_gui_components(DIALOG_TOTD_CM_CLASS, show_handler, NULL);
+}
diff --git a/gnucash/gnome-utils/dialog-totd.h b/gnucash/gnome-utils/dialog-totd.h
index 7a5ea73..3e92936 100644
--- a/gnucash/gnome-utils/dialog-totd.h
+++ b/gnucash/gnome-utils/dialog-totd.h
@@ -26,5 +26,6 @@
 #define DIALOG_TOTD_H
 
 void gnc_totd_dialog (GtkWindow *parent, gboolean startup);
+void gnc_totd_dialog_reparent (void);
 
 #endif
diff --git a/gnucash/gnome-utils/gnc-autosave.c b/gnucash/gnome-utils/gnc-autosave.c
index 557462d..d2e5e54 100644
--- a/gnucash/gnome-utils/gnc-autosave.c
+++ b/gnucash/gnome-utils/gnc-autosave.c
@@ -211,7 +211,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
         else
             g_debug("autosave_timeout_cb: toplevel is not a GNC_WINDOW\n");
 
-        gnc_file_save();
+        gnc_file_save (GTK_WINDOW (toplevel));
 
         gnc_main_window_set_progressbar_window(NULL);
 
diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index 6fea291..12d5e59 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -76,7 +76,8 @@ static gint save_in_progress = 0;
 \********************************************************************/
 
 char *
-gnc_file_dialog (const char * title,
+gnc_file_dialog (GtkWindow *parent,
+                 const char * title,
                  GList * filters,
                  const char * starting_dir,
                  GNCFileDialogType type
@@ -124,7 +125,7 @@ gnc_file_dialog (const char * title,
 
     file_box = gtk_file_chooser_dialog_new(
                    title,
-                   NULL,
+                   parent,
                    action,
                    _("_Cancel"), GTK_RESPONSE_CANCEL,
                    NULL);
@@ -139,9 +140,6 @@ gnc_file_dialog (const char * title,
                                             starting_dir);
 
     gtk_window_set_modal(GTK_WINDOW(file_box), TRUE);
-    /*
-    gtk_window_set_transient_for(GTK_WINDOW(file_box), gnc_ui_get_main_window(NULL));
-    */
 
     if (filters != NULL)
     {
@@ -194,11 +192,11 @@ gnc_file_dialog (const char * title,
 
 
 gboolean
-show_session_error (QofBackendError io_error,
+show_session_error (GtkWindow *parent,
+                    QofBackendError io_error,
                     const char *newfile,
                     GNCFileDialogType type)
 {
-    GtkWindow *parent = gnc_ui_get_main_window (NULL);
     GtkWidget *dialog;
     gboolean uh_oh = TRUE;
     const char *fmt, *label;
@@ -530,13 +528,13 @@ gnc_book_opened (void)
 }
 
 void
-gnc_file_new (void)
+gnc_file_new (GtkWindow *parent)
 {
     QofSession *session;
 
     /* If user attempts to start a new session before saving results of
      * the last one, prompt them to clean up their act. */
-    if (!gnc_file_query_save (TRUE))
+    if (!gnc_file_query_save (parent, TRUE))
         return;
 
     if (gnc_current_session_exist())
@@ -567,9 +565,8 @@ gnc_file_new (void)
 }
 
 gboolean
-gnc_file_query_save (gboolean can_cancel)
+gnc_file_query_save (GtkWindow *parent, gboolean can_cancel)
 {
-    GtkWidget *parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
     QofBook *current_book;
 
     if (!gnc_current_session_exist())
@@ -594,7 +591,7 @@ gnc_file_query_save (gboolean can_cancel)
         time64 oldest_change;
         gint minutes;
 
-        dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
+        dialog = gtk_message_dialog_new(parent,
                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                         GTK_MESSAGE_QUESTION,
                                         GTK_BUTTONS_NONE,
@@ -622,7 +619,7 @@ gnc_file_query_save (gboolean can_cancel)
         switch (response)
         {
         case GTK_RESPONSE_YES:
-            gnc_file_save ();
+            gnc_file_save (parent);
             /* Go check the loop condition. */
             break;
 
@@ -650,7 +647,7 @@ gnc_file_query_save (gboolean can_cancel)
 #define RESPONSE_READONLY 4
 
 static gboolean
-gnc_post_file_open (const char * filename, gboolean is_readonly)
+gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readonly)
 {
     QofSession *current_session, *new_session;
     QofBook *new_book;
@@ -676,7 +673,8 @@ RESTART:
     newfile = gnc_uri_normalize_uri ( filename, TRUE );
     if (!newfile)
     {
-        show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
+        show_session_error (parent,
+                            ERR_FILEIO_FILE_NOT_FOUND, filename,
                             GNC_FILE_DIALOG_OPEN);
         return FALSE;
     }
@@ -742,14 +740,14 @@ RESTART:
     if (ERR_BACKEND_BAD_URL == io_err)
     {
         gchar *directory;
-        show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
+        show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
         io_err = ERR_BACKEND_NO_ERR;
         if (g_file_test (filename, G_FILE_TEST_IS_DIR))
             directory = g_strdup (filename);
         else
             directory = gnc_get_default_directory (GNC_PREFS_GROUP_OPEN_SAVE);
 
-        filename = gnc_file_dialog (NULL, NULL, directory,
+        filename = gnc_file_dialog (parent, NULL, NULL, directory,
                                     GNC_FILE_DIALOG_OPEN);
         qof_session_destroy (new_session);
         new_session = NULL;
@@ -774,10 +772,6 @@ RESTART:
                      );
         int rc;
 
-        GtkWindow *parent = gnc_get_splash_screen();
-        if (!parent)
-            parent = gnc_ui_get_main_window(NULL);
-
         if (! gnc_uri_is_file_uri (newfile)) /* Hide the db password in error messages */
             displayname = gnc_uri_normalize_uri ( newfile, FALSE);
         else
@@ -830,14 +824,14 @@ RESTART:
              * database so that the user will get a window that
              * they can click "Exit" on.
              */
-            gnc_file_new ();
+            gnc_file_new (parent);
             break;
         }
     }
     /* if the database doesn't exist, ask the user ... */
     else if ((ERR_BACKEND_NO_SUCH_DB == io_err))
     {
-        if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN))
+        if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN))
         {
             /* user told us to create a new database. Do it. We
             	     * shouldn't have to worry about locking or clobbering,
@@ -859,7 +853,7 @@ RESTART:
 
     else
     {
-        uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
+        uh_oh = show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
     }
 
     if (!uh_oh)
@@ -906,14 +900,14 @@ RESTART:
             }
         }
 
-        uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
+        uh_oh = show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
         /* Attempt to update the database if it's too old */
         if ( !uh_oh && io_err == ERR_SQL_DB_TOO_OLD )
         {
             gnc_window_show_progress(_("Re-saving user data..."), 0.0);
             qof_session_safe_save(new_session, gnc_window_show_progress);
             io_err = qof_session_get_error(new_session);
-            uh_oh = show_session_error(io_err, newfile, GNC_FILE_DIALOG_SAVE);
+            uh_oh = show_session_error(parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
         }
         /* Database is either too old and couldn't (or user didn't
          * want it to) be updated or it's too new. Mark it as
@@ -932,7 +926,7 @@ RESTART:
          * The backend forgot to set an error. So make one up. */
         if (!uh_oh && !new_root)
         {
-            uh_oh = show_session_error (ERR_BACKEND_MISC, newfile,
+            uh_oh = show_session_error (parent, ERR_BACKEND_MISC, newfile,
                                         GNC_FILE_DIALOG_OPEN);
         }
 
@@ -948,7 +942,7 @@ RESTART:
                 uh_oh = TRUE;
 
                 // XXX: should pull out the file name here */
-                gnc_error_dialog (gnc_ui_get_main_window (NULL), msg, "");
+                gnc_error_dialog (parent, msg, "");
                 g_free (msg);
             }
             if (template_root != NULL)
@@ -1044,14 +1038,14 @@ RESTART:
  *       paths, never db uris.
  */
 gboolean
-gnc_file_open (void)
+gnc_file_open (GtkWindow *parent)
 {
     const gchar * newfile;
     gchar *last = NULL;
     gchar *default_dir = NULL;
     gboolean result;
 
-    if (!gnc_file_query_save (TRUE))
+    if (!gnc_file_query_save (parent, TRUE))
         return FALSE;
 
     if ( last && gnc_uri_is_file_uri ( last ) )
@@ -1063,11 +1057,11 @@ gnc_file_open (void)
     else
         default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
 
-    newfile = gnc_file_dialog (_("Open"), NULL, default_dir, GNC_FILE_DIALOG_OPEN);
+    newfile = gnc_file_dialog (parent, _("Open"), NULL, default_dir, GNC_FILE_DIALOG_OPEN);
     g_free ( last );
     g_free ( default_dir );
 
-    result = gnc_post_file_open ( newfile, /*is_readonly*/ FALSE );
+    result = gnc_post_file_open (parent, newfile, /*is_readonly*/ FALSE );
 
     /* This dialogue can show up early in the startup process. If the
      * user fails to pick a file (by e.g. hitting the cancel button), we
@@ -1079,14 +1073,14 @@ gnc_file_open (void)
 }
 
 gboolean
-gnc_file_open_file (const char * newfile, gboolean open_readonly)
+gnc_file_open_file (GtkWindow *parent, const char * newfile, gboolean open_readonly)
 {
     if (!newfile) return FALSE;
 
-    if (!gnc_file_query_save (TRUE))
+    if (!gnc_file_query_save (parent, TRUE))
         return FALSE;
 
-    return gnc_post_file_open (newfile, open_readonly);
+    return gnc_post_file_open (parent, newfile, open_readonly);
 }
 
 /* Note: this dialog will only be used when dbi is not enabled
@@ -1094,7 +1088,7 @@ gnc_file_open_file (const char * newfile, gboolean open_readonly)
  *       never db uris
  */
 void
-gnc_file_export (void)
+gnc_file_export (GtkWindow *parent)
 {
     const char *filename;
     char *default_dir = NULL;        /* Default to last open */
@@ -1112,13 +1106,14 @@ gnc_file_export (void)
     else
         default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_EXPORT);
 
-    filename = gnc_file_dialog (_("Save"), NULL, default_dir,
+    filename = gnc_file_dialog (parent,
+                                _("Save"), NULL, default_dir,
                                 GNC_FILE_DIALOG_SAVE);
     g_free ( last );
     g_free ( default_dir );
     if (!filename) return;
 
-    gnc_file_do_export( filename );
+    gnc_file_do_export (parent, filename);
 
     LEAVE (" ");
 }
@@ -1155,7 +1150,7 @@ check_file_path (const char *path)
 
 
 void
-gnc_file_do_export(const char * filename)
+gnc_file_do_export(GtkWindow *parent, const char * filename)
 {
     QofSession *current_session, *new_session;
     gboolean ok;
@@ -1178,7 +1173,7 @@ gnc_file_do_export(const char * filename)
     norm_file = gnc_uri_normalize_uri ( filename, TRUE );
     if (!norm_file)
     {
-        show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
+        show_session_error (parent, ERR_FILEIO_FILE_NOT_FOUND, filename,
                             GNC_FILE_DIALOG_EXPORT);
         return;
     }
@@ -1206,7 +1201,7 @@ gnc_file_do_export(const char * filename)
     {
 	if (check_file_path (path))
 	{
-	    show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile,
+	    show_session_error (parent, ERR_FILEIO_RESERVED_WRITE, newfile,
 				GNC_FILE_DIALOG_SAVE);
 	    return;
 	}
@@ -1220,7 +1215,7 @@ gnc_file_do_export(const char * filename)
     if (strlen (oldfile) && (strcmp(oldfile, newfile) == 0))
     {
         g_free (newfile);
-        show_session_error (ERR_FILEIO_WRITE_ERROR, filename,
+        show_session_error (parent, ERR_FILEIO_WRITE_ERROR, filename,
                             GNC_FILE_DIALOG_EXPORT);
         return;
     }
@@ -1254,7 +1249,7 @@ gnc_file_do_export(const char * filename)
     /* if file appears to be locked, ask the user ... */
     if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
     {
-        if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_EXPORT))
+        if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_EXPORT))
         {
             /* user told us to ignore locks. So ignore them. */
             qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
@@ -1288,7 +1283,7 @@ gnc_file_do_export(const char * filename)
 static gboolean been_here_before = FALSE;
 
 void
-gnc_file_save (void)
+gnc_file_save (GtkWindow *parent)
 {
     QofBackendError io_err;
     const char * newfile;
@@ -1302,19 +1297,19 @@ gnc_file_save (void)
 
     if (!strlen (qof_session_get_url (session)))
     {
-        gnc_file_save_as ();
+        gnc_file_save_as (parent);
         return;
     }
 
     if (qof_book_is_readonly(qof_session_get_book(session)))
     {
-        gint response = gnc_ok_cancel_dialog(gnc_ui_get_main_window (NULL),
+        gint response = gnc_ok_cancel_dialog(parent,
                                              GTK_RESPONSE_CANCEL,
                                              _("The database was opened read-only. "
                                                "Do you want to save it to a different place?"));
         if (response == GTK_RESPONSE_OK)
         {
-            gnc_file_save_as ();
+            gnc_file_save_as (parent);
         }
         return;
     }
@@ -1334,11 +1329,11 @@ gnc_file_save (void)
     if (ERR_BACKEND_NO_ERR != io_err)
     {
         newfile = qof_session_get_url(session);
-        show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
+        show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
 
         if (been_here_before) return;
         been_here_before = TRUE;
-        gnc_file_save_as ();   /* been_here prevents infinite recursion */
+        gnc_file_save_as (parent);   /* been_here prevents infinite recursion */
         been_here_before = FALSE;
         return;
     }
@@ -1354,7 +1349,7 @@ gnc_file_save (void)
  *       never db uris. See gnc_file_do_save_as for that.
  */
 void
-gnc_file_save_as (void)
+gnc_file_save_as (GtkWindow *parent)
 {
     const gchar *filename;
     gchar *default_dir = NULL;        /* Default to last open */
@@ -1372,19 +1367,20 @@ gnc_file_save_as (void)
     else
         default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
 
-    filename = gnc_file_dialog (_("Save"), NULL, default_dir,
+    filename = gnc_file_dialog (parent,
+                                _("Save"), NULL, default_dir,
                                 GNC_FILE_DIALOG_SAVE);
     g_free ( last );
     g_free ( default_dir );
     if (!filename) return;
 
-    gnc_file_do_save_as( filename );
+    gnc_file_do_save_as (parent, filename);
 
     LEAVE (" ");
 }
 
 void
-gnc_file_do_save_as (const char* filename)
+gnc_file_do_save_as (GtkWindow *parent, const char* filename)
 {
     QofSession *new_session;
     QofSession *session;
@@ -1409,7 +1405,7 @@ gnc_file_do_save_as (const char* filename)
     norm_file = gnc_uri_normalize_uri ( filename, TRUE );
     if (!norm_file)
     {
-        show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
+        show_session_error (parent, ERR_FILEIO_FILE_NOT_FOUND, filename,
                             GNC_FILE_DIALOG_SAVE);
         return;
     }
@@ -1437,7 +1433,7 @@ gnc_file_do_save_as (const char* filename)
     {
 	if (check_file_path (path))
 	{
-	    show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile,
+	    show_session_error (parent, ERR_FILEIO_RESERVED_WRITE, newfile,
 				GNC_FILE_DIALOG_SAVE);
 	    return;
 	}
@@ -1452,7 +1448,7 @@ gnc_file_do_save_as (const char* filename)
     if (strlen (oldfile) && (strcmp(oldfile, newfile) == 0))
     {
         g_free (newfile);
-        gnc_file_save ();
+        gnc_file_save (parent);
         return;
     }
 
@@ -1495,7 +1491,7 @@ gnc_file_do_save_as (const char* filename)
     /* if file appears to be locked, ask the user ... */
     else if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
     {
-        if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
+        if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE))
         {
             /* user told us to ignore locks. So ignore them. */
             qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
@@ -1507,7 +1503,7 @@ gnc_file_do_save_as (const char* filename)
              (ERR_BACKEND_NO_SUCH_DB == io_err) ||
              (ERR_SQL_DB_TOO_OLD == io_err))
     {
-        if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
+        if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE))
         {
             /* user told us to create a new database. Do it. */
             qof_session_begin (new_session, newfile, FALSE, TRUE, FALSE);
@@ -1521,7 +1517,7 @@ gnc_file_do_save_as (const char* filename)
     io_err = qof_session_get_error (new_session);
     if (ERR_BACKEND_NO_ERR != io_err)
     {
-        show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
+        show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
         xaccLogDisable();
         qof_session_destroy (new_session);
         xaccLogEnable();
@@ -1567,7 +1563,7 @@ gnc_file_do_save_as (const char* filename)
         /* Well, poop. The save failed, so the new session is invalid and we
          * need to restore the old one.
          */
-        show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
+        show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
         qof_event_suspend();
         qof_session_swap_data( new_session, session );
         qof_session_destroy( new_session );
@@ -1596,7 +1592,7 @@ gnc_file_do_save_as (const char* filename)
 }
 
 void
-gnc_file_revert (void)
+gnc_file_revert (GtkWindow *parent)
 {
     QofSession *session;
     const gchar *fileurl, *filename, *tmp;
@@ -1618,7 +1614,7 @@ gnc_file_revert (void)
         return;
 
     qof_book_mark_session_saved (qof_session_get_book (session));
-    gnc_file_open_file (fileurl, qof_book_is_readonly(gnc_get_current_book()));}
+    gnc_file_open_file (parent, fileurl, qof_book_is_readonly(gnc_get_current_book()));}
 
 void
 gnc_file_quit (void)
diff --git a/gnucash/gnome-utils/gnc-file.h b/gnucash/gnome-utils/gnc-file.h
index 538096f..d32a0fb 100644
--- a/gnucash/gnome-utils/gnc-file.h
+++ b/gnucash/gnome-utils/gnc-file.h
@@ -126,30 +126,34 @@ typedef enum
     GNC_FILE_DIALOG_EXPORT
 } GNCFileDialogType;
 
-void gnc_file_new (void);
-gboolean gnc_file_open (void);
-void gnc_file_export(void);
-void gnc_file_save (void);
-void gnc_file_save_as (void);
-void gnc_file_do_export(const char* filename);
-void gnc_file_do_save_as(const char* filename);
-void gnc_file_revert (void);
+void gnc_file_new (GtkWindow *parent);
+gboolean gnc_file_open (GtkWindow *parent);
+void gnc_file_export(GtkWindow *parent);
+void gnc_file_save (GtkWindow *parent);
+void gnc_file_save_as (GtkWindow *parent);
+void gnc_file_do_export(GtkWindow *parent, const char* filename);
+void gnc_file_do_save_as(GtkWindow *parent, const char* filename);
+void gnc_file_revert (GtkWindow *parent);
 
 /** Tell the user about errors in the backends
 
 */
-gboolean show_session_error (QofBackendError io_error,
+gboolean show_session_error (GtkWindow *parent,
+                             QofBackendError io_error,
                              const char *newfile,
                              GNCFileDialogType type);
 
-char * gnc_file_dialog (const char * title,
+char * gnc_file_dialog (GtkWindow *parent,
+                        const char * title,
                         GList * filters,
                         const char * starting_dir,
                         GNCFileDialogType type);
 
-gboolean gnc_file_open_file (const char *filename, gboolean open_readonly);
+gboolean gnc_file_open_file (GtkWindow *parent,
+                             const char *filename,
+                             gboolean open_readonly);
 
-gboolean gnc_file_query_save (gboolean can_cancel);
+gboolean gnc_file_query_save (GtkWindow *parent, gboolean can_cancel);
 
 void gnc_file_quit (void);
 
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 85a934b..efd6573 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -736,7 +736,7 @@ gnc_gui_init(void)
     /* Load css configuration file */
     gnc_add_css_file ();
 
-    gnc_totd_dialog(GTK_WINDOW(main_window), TRUE);
+    gnc_totd_dialog (gnc_get_splash_screen (), TRUE);
 
     LEAVE ("");
     return main_window;
@@ -782,7 +782,7 @@ gnc_shutdown (int exit_status)
     {
         if (!gnome_is_terminating)
         {
-            if (gnc_file_query_save(FALSE))
+            if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
             {
                 gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
                 gnc_gui_shutdown();
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 1ca7ad9..7b6670e 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -1294,7 +1294,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
     switch (response)
     {
     case GTK_RESPONSE_APPLY:
-        gnc_file_save();
+        gnc_file_save (GTK_WINDOW (window));
         return FALSE;
 
     case GTK_RESPONSE_CLOSE:
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.c b/gnucash/gnome-utils/gnc-plugin-file-history.c
index 4b68e95..de91110 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.c
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.c
@@ -696,7 +696,8 @@ gnc_plugin_file_history_cmd_open_file (GtkAction *action,
     filename = g_object_get_data(G_OBJECT(action), FILENAME_STRING);
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
     /* also opens new account page */
-    gnc_file_open_file (filename, /*open_readonly*/ FALSE);
+    gnc_file_open_file (GTK_WINDOW (data->window),
+                        filename, /*open_readonly*/ FALSE);
     gnc_window_set_progressbar_window (NULL);
 }
 
diff --git a/gnucash/gnome-utils/gtkbuilder/dialog-totd.glade b/gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
index 09aa5b6..4515ebc 100644
--- a/gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
+++ b/gnucash/gnome-utils/gtkbuilder/dialog-totd.glade
@@ -3,7 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="totd_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes">GnuCash Tip Of The Day</property>
diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index 66258b1..5f9a873 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -58,6 +58,7 @@
 #include "gnc-path.h"
 #include "gnc-gui-query.h"
 #include "gnc-tree-view-account.h"
+#include "gnc-ui.h"
 #include "gnc-ui-util.h"
 #include "io-example-account.h"
 #include "top-level.h"
@@ -1317,7 +1318,7 @@ static void
 after_assistant(void)
 {
     qof_book_mark_session_dirty(gnc_get_current_book());
-    gnc_ui_file_access_for_save_as();
+    gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (NULL));
 }
 
 static void
diff --git a/gnucash/gnome/dialog-new-user.c b/gnucash/gnome/dialog-new-user.c
index bf5eaf2..3cf6a9a 100644
--- a/gnucash/gnome/dialog-new-user.c
+++ b/gnucash/gnome/dialog-new-user.c
@@ -67,7 +67,7 @@ after_hierarchy_assistant(void)
     gnc_set_first_startup (FALSE);
 
     qof_book_mark_session_dirty(gnc_get_current_book());
-    gnc_ui_file_access_for_save_as();
+    gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (NULL));
 }
 
 void
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index 96cbecb..248c494 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -422,7 +422,7 @@ gnc_plugin_basic_commands_class_init (GncPluginBasicCommandsClass *klass)
 /** Initialize a new instance of a basic commands plugin.  This
  *  function currently does nothing.
  *
- *  @param page The new object instance created by the object
+ *  @param plugin The new object instance created by the object
  *  system. */
 static void
 gnc_plugin_basic_commands_init (GncPluginBasicCommands *plugin)
@@ -456,7 +456,7 @@ gnc_main_window_cmd_file_new (GtkAction *action, GncMainWindowActionData *data)
     if (!gnc_main_window_all_finish_pending())
         return;
 
-    gnc_file_new ();
+    gnc_file_new (GTK_WINDOW (data->window));
 }
 
 static void
@@ -469,9 +469,9 @@ gnc_main_window_cmd_file_open (GtkAction *action, GncMainWindowActionData *data)
 
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
 #ifdef HAVE_DBI_DBI_H
-    gnc_ui_file_access_for_open();
+    gnc_ui_file_access_for_open (GTK_WINDOW (data->window));
 #else
-    gnc_file_open ();
+    gnc_file_open (GTK_WINDOW (data->window));
 #endif
     gnc_window_set_progressbar_window (NULL);
 }
@@ -485,7 +485,7 @@ gnc_main_window_cmd_file_save (GtkAction *action, GncMainWindowActionData *data)
         return;
 
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
-    gnc_file_save ();
+    gnc_file_save (GTK_WINDOW (data->window));
     gnc_window_set_progressbar_window (NULL);
 }
 
@@ -499,9 +499,9 @@ gnc_main_window_cmd_file_save_as (GtkAction *action, GncMainWindowActionData *da
 
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
 #ifdef HAVE_DBI_DBI_H
-    gnc_ui_file_access_for_save_as();
+    gnc_ui_file_access_for_save_as (GTK_WINDOW (data->window));
 #else
-    gnc_file_save_as ();
+    gnc_file_save_as (GTK_WINDOW (data->window));
 #endif
     gnc_window_set_progressbar_window (NULL);
 }
@@ -515,7 +515,7 @@ gnc_main_window_cmd_file_revert (GtkAction *action, GncMainWindowActionData *dat
         return;
 
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
-    gnc_file_revert();
+    gnc_file_revert(GTK_WINDOW (data->window));
     gnc_window_set_progressbar_window (NULL);
 }
 
@@ -526,7 +526,7 @@ gnc_main_window_cmd_file_export_accounts (GtkAction *action, GncMainWindowAction
 
     gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
 #ifdef HAVE_DBI_DBI_H
-    gnc_ui_file_access_for_export();
+    gnc_ui_file_access_for_export (GTK_WINDOW (data->window));
 #else
     gnc_file_export ();
 #endif
diff --git a/gnucash/gnome/top-level.c b/gnucash/gnome/top-level.c
index 16d7f49..6d6ee93 100644
--- a/gnucash/gnome/top-level.c
+++ b/gnucash/gnome/top-level.c
@@ -295,6 +295,8 @@ cleanup:
         g_error_free(error);
     if (file_guid)
         g_free(file_guid);
+
+    gnc_totd_dialog_reparent ();
 }
 
 
diff --git a/gnucash/gnucash-bin.c b/gnucash/gnucash-bin.c
index 1569a41..0152a3a 100644
--- a/gnucash/gnucash-bin.c
+++ b/gnucash/gnucash-bin.c
@@ -646,7 +646,7 @@ inner_main (void *closure, int argc, char **argv)
     if (!nofile && (fn = get_file_to_load()))
     {
         gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
-        gnc_file_open_file(fn, /*open_readonly*/ FALSE);
+        gnc_file_open_file(gnc_get_splash_screen(), fn, /*open_readonly*/ FALSE);
         g_free(fn);
     }
     else if (gnc_prefs_get_bool(GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP))
diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c
index fd62912..b7cbbdd 100644
--- a/gnucash/import-export/aqb/gnc-file-aqb-import.c
+++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c
@@ -68,7 +68,8 @@ typedef GWEN_SYNCIO GWEN_IO_LAYER;
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
 void
-gnc_file_aqbanking_import(const gchar *aqbanking_importername,
+gnc_file_aqbanking_import(GtkWindow *parent,
+                          const gchar *aqbanking_importername,
                           const gchar *aqbanking_profilename,
                           gboolean execute_transactions)
 {
@@ -96,7 +97,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
 
     /* Select a file */
     default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_AQBANKING);
-    selected_filename = gnc_file_dialog(_("Select a file to import"),
+    selected_filename = gnc_file_dialog(parent, _("Select a file to import"),
                                         NULL, default_dir,
                                         GNC_FILE_DIALOG_IMPORT);
     g_free(default_dir);
@@ -141,7 +142,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
     if (!importer)
     {
         g_warning("Import module %s not found", aqbanking_importername);
-        gnc_error_dialog(NULL, "%s",
+        gnc_error_dialog(parent, "%s",
                          _("Import module for DTAUS import not found."));
         goto cleanup;
     }
@@ -229,7 +230,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
     /* Before importing the results, if this is a new book, let user specify
      * book options, since they affect how transactions are created */
     if (gnc_is_new_book())
-        gnc_new_book_option_display (GTK_WIDGET (gnc_ui_get_main_window(NULL)));
+        gnc_new_book_option_display (GTK_WIDGET (parent));
 
     /* Import the results */
     ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS,
@@ -319,7 +320,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
             if (!successful)
             {
                 g_warning("%s", errstr->str);
-                gnc_error_dialog(NULL,
+                gnc_error_dialog(parent,
                                  _("An error occurred while executing jobs: %d of %d failed. "
                                    "Please check the log window or gnucash.trace for the exact "
                                    "error message.\n\n%s")
@@ -329,13 +330,13 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
             {
                 if (num_jobs == 0)
                 {
-                    gnc_info_dialog(NULL,
+                    gnc_info_dialog(parent,
                                     _("No jobs to be send.")
                                    );
                 }
                 else
                 {
-                    gnc_info_dialog(NULL, ngettext
+                    gnc_info_dialog(parent, ngettext
                                     ("The job was executed successfully, but as a precaution "
                                      "please check the log window for potential errors.",
                                      "All %d jobs were executed successfully, but as a precaution "
diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.h b/gnucash/import-export/aqb/gnc-file-aqb-import.h
index 85e8d96..a09d069 100644
--- a/gnucash/import-export/aqb/gnc-file-aqb-import.h
+++ b/gnucash/import-export/aqb/gnc-file-aqb-import.h
@@ -57,7 +57,8 @@ G_BEGIN_DECLS
  * transactions as online jobs over aqbanking/HBCI.  If FALSE, just import the
  * transactions and that's it.
  */
-void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
+void gnc_file_aqbanking_import (GtkWindow *parent,
+                                const gchar *aqbanking_importername,
                                 const gchar *aqbanking_formatname,
                                 gboolean exec_as_aqbanking_jobs);
 
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
index 7ac5dfe..fa0d886 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
@@ -664,7 +664,8 @@ gnc_plugin_ab_cmd_mt940_import(GtkAction *action, GncMainWindowActionData *data)
     gchar *format = gnc_prefs_get_string(GNC_PREFS_GROUP_AQBANKING,
                                          GNC_PREF_FORMAT_SWIFT940);
     gnc_main_window = data->window;
-    gnc_file_aqbanking_import("swift", format ? format : "swift-mt940", FALSE);
+    gnc_file_aqbanking_import (GTK_WINDOW (gnc_main_window),
+                               "swift", format ? format : "swift-mt940", FALSE);
     g_free(format);
 }
 
@@ -674,7 +675,8 @@ gnc_plugin_ab_cmd_mt942_import(GtkAction *action, GncMainWindowActionData *data)
     gchar *format = gnc_prefs_get_string(GNC_PREFS_GROUP_AQBANKING,
                                          GNC_PREF_FORMAT_SWIFT942);
     gnc_main_window = data->window;
-    gnc_file_aqbanking_import("swift", format ? format : "swift-mt942", FALSE);
+    gnc_file_aqbanking_import (GTK_WINDOW (gnc_main_window),
+                               "swift", format ? format : "swift-mt942", FALSE);
     g_free(format);
 }
 
@@ -684,7 +686,8 @@ gnc_plugin_ab_cmd_dtaus_import(GtkAction *action, GncMainWindowActionData *data)
     gchar *format = gnc_prefs_get_string(GNC_PREFS_GROUP_AQBANKING,
                                          GNC_PREF_FORMAT_DTAUS);
     gnc_main_window = data->window;
-    gnc_file_aqbanking_import("dtaus", format ? format : "default", FALSE);
+    gnc_file_aqbanking_import (GTK_WINDOW (gnc_main_window),
+                               "dtaus", format ? format : "default", FALSE);
     g_free(format);
 }
 
@@ -695,7 +698,8 @@ gnc_plugin_ab_cmd_dtaus_importsend(GtkAction *action,
     gchar *format = gnc_prefs_get_string(GNC_PREFS_GROUP_AQBANKING,
                                          GNC_PREF_FORMAT_DTAUS);
     gnc_main_window = data->window;
-    gnc_file_aqbanking_import("dtaus", format ? format : "default", TRUE);
+    gnc_file_aqbanking_import (GTK_WINDOW (gnc_main_window),
+                               "dtaus", format ? format : "default", TRUE);
     g_free(format);
 }
 
diff --git a/gnucash/import-export/bi-import/dialog-bi-import-gui.c b/gnucash/import-export/bi-import/dialog-bi-import-gui.c
index 92ad615..c7f302e 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import-gui.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import-gui.c
@@ -176,7 +176,7 @@ gnc_plugin_bi_import_showGUI (GtkWindow *parent)
 }
 
 static gchar *
-gnc_plugin_bi_import_getFilename(void)
+gnc_plugin_bi_import_getFilename(GtkWindow *parent)
 {
     // prepare file import dialog
     gchar *filename = NULL;
@@ -191,7 +191,7 @@ gnc_plugin_bi_import_getFilename(void)
     gtk_file_filter_set_name (filter, "text files (*.txt)");
     gtk_file_filter_add_pattern (filter, "*.txt");
     filters = g_list_append( filters, filter );
-    filename = gnc_file_dialog(_("Import Bills or Invoices from csv"), filters, NULL, GNC_FILE_DIALOG_IMPORT);
+    filename = gnc_file_dialog(parent, _("Import Bills or Invoices from csv"), filters, NULL, GNC_FILE_DIALOG_IMPORT);
 
     return filename;
 }
@@ -279,7 +279,7 @@ void gnc_bi_import_gui_buttonOpen_cb (GtkWidget *widget, gpointer data)
     gchar *filename = NULL;
     BillImportGui *gui = data;
 
-    filename = gnc_plugin_bi_import_getFilename();
+    filename = gnc_plugin_bi_import_getFilename (gnc_ui_get_gtk_window (widget));
     if (filename)
     {
         //printf("Setting filename"); // debug
diff --git a/gnucash/import-export/customer-import/dialog-customer-import-gui.c b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
index d4d5c68..a416086 100644
--- a/gnucash/import-export/customer-import/dialog-customer-import-gui.c
+++ b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
@@ -154,7 +154,7 @@ gnc_plugin_customer_import_showGUI(void)
 }
 
 static gchar *
-gnc_plugin_customer_import_getFilename(void)
+gnc_plugin_customer_import_getFilename (GtkWindow *parent)
 {
     // prepare file import dialog
     gchar *filename;
@@ -169,7 +169,8 @@ gnc_plugin_customer_import_getFilename(void)
     gtk_file_filter_set_name (filter, "text files (*.txt)");
     gtk_file_filter_add_pattern (filter, "*.txt");
     filters = g_list_append( filters, filter );
-    filename = gnc_file_dialog(_("Import Customers from csv"), filters, NULL, GNC_FILE_DIALOG_IMPORT);
+    filename = gnc_file_dialog(parent,
+                               _("Import Customers from csv"), filters, NULL, GNC_FILE_DIALOG_IMPORT);
 
     return filename;
 }
@@ -256,7 +257,7 @@ void gnc_customer_import_gui_buttonOpen_cb (GtkWidget *widget, gpointer data)
     gchar *filename;
     CustomerImportGui *gui = data;
 
-    filename = gnc_plugin_customer_import_getFilename();
+    filename = gnc_plugin_customer_import_getFilename (gnc_ui_get_gtk_window (widget));
     if (filename)
     {
         gtk_entry_set_text( GTK_ENTRY(gui->entryFilename), filename );
diff --git a/gnucash/import-export/log-replay/gnc-log-replay.c b/gnucash/import-export/log-replay/gnc-log-replay.c
index 0a61a7b..a559a16 100644
--- a/gnucash/import-export/log-replay/gnc-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-log-replay.c
@@ -544,7 +544,7 @@ static void  process_trans_record(  FILE *log_file)
     }
 }
 
-void gnc_file_log_replay (void)
+void gnc_file_log_replay (GtkWindow *parent)
 {
     char *selected_filename;
     char *default_dir;
@@ -574,7 +574,8 @@ void gnc_file_log_replay (void)
     filter = gtk_file_filter_new();
     gtk_file_filter_set_name(filter, "*.log");
     gtk_file_filter_add_pattern(filter, "*.[Ll][Oo][Gg]");
-    selected_filename = gnc_file_dialog(_("Select a .log file to replay"),
+    selected_filename = gnc_file_dialog(parent,
+                                        _("Select a .log file to replay"),
                                         g_list_prepend(NULL, filter),
                                         default_dir,
                                         GNC_FILE_DIALOG_OPEN);
diff --git a/gnucash/import-export/log-replay/gnc-log-replay.h b/gnucash/import-export/log-replay/gnc-log-replay.h
index 8487a08..734a1c5 100644
--- a/gnucash/import-export/log-replay/gnc-log-replay.h
+++ b/gnucash/import-export/log-replay/gnc-log-replay.h
@@ -25,9 +25,11 @@
 #ifndef OFX_IMPORT_H
 #define OFX_IMPORT_H
 
+#include <gtk/gtk.h>
+
 /** The gnc_file_log_replay() routine will pop up a standard file
  *     selection dialogue asking the user to pick a log file to replay. If one
  *     is selected the the .log file is opened and read.  It's contents
  *     are then silently merged in the current log file. */
-void              gnc_file_log_replay (void);
+void              gnc_file_log_replay (GtkWindow *parent);
 #endif
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
index 19247c2..87b54ce 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
@@ -144,7 +144,7 @@ gnc_plugin_log_replay_cmd_new_log_replay (GtkAction *action,
         GncMainWindowActionData *data)
 {
     gnc_suspend_gui_refresh();
-    gnc_file_log_replay ();
+    gnc_file_log_replay (GTK_WINDOW (data->window));
     gnc_resume_gui_refresh();
 }
 
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index 4276e3b..cbfe10a 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -965,7 +965,7 @@ double ofx_get_investment_amount(const struct OfxTransactionData* data)
     }
 }
 
-void gnc_file_ofx_import (void)
+void gnc_file_ofx_import (GtkWindow *parent)
 {
     extern int ofx_PARSER_msg;
     extern int ofx_DEBUG_msg;
@@ -987,7 +987,8 @@ void gnc_file_ofx_import (void)
     DEBUG("gnc_file_ofx_import(): Begin...\n");
 
     default_dir = gnc_get_default_directory(GNC_PREFS_GROUP);
-    selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
+    selected_filename = gnc_file_dialog(parent,
+                                        _("Select an OFX/QFX file to process"),
                                         NULL,
                                         default_dir,
                                         GNC_FILE_DIALOG_IMPORT);
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.h b/gnucash/import-export/ofx/gnc-ofx-import.h
index 0842184..dfc8547 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.h
+++ b/gnucash/import-export/ofx/gnc-ofx-import.h
@@ -25,10 +25,12 @@
 #ifndef OFX_IMPORT_H
 #define OFX_IMPORT_H
 
+#include <gtk/gtk.h>
+
 /** The gnc_file_ofx_import() routine will pop up a standard file
  *     selection dialogue asking the user to pick a OFX/QFX file. If one
  *     is selected the the OFX file is opened and read. It's contents
  *     are merged into the existing session (if any). The current
  *     session continues to remain open for editing. */
-void              gnc_file_ofx_import (void);
+void              gnc_file_ofx_import (GtkWindow *parent);
 #endif
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.c b/gnucash/import-export/ofx/gnc-plugin-ofx.c
index 67d23ca..c456261 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.c
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.c
@@ -141,7 +141,7 @@ static void
 gnc_plugin_ofx_cmd_import (GtkAction *action,
                            GncMainWindowActionData *data)
 {
-    gnc_file_ofx_import ();
+    gnc_file_ofx_import (GTK_WINDOW (data->window));
 }
 
 
diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
index b669a05..18c9fae 100644
--- a/gnucash/import-export/qif-imp/assistant-qif-import.c
+++ b/gnucash/import-export/qif-imp/assistant-qif-import.c
@@ -1365,7 +1365,7 @@ gnc_ui_qif_import_close_cb(GtkAssistant *gtkassistant, gpointer user_data)
     if (!wind->acct_tree_found)
     {
         qof_book_mark_session_dirty(gnc_get_current_book());
-        gnc_ui_file_access_for_save_as();
+        gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (GTK_WIDGET (gtkassistant)));
     }
 
     gnc_close_gui_component_by_data( ASSISTANT_QIF_IMPORT_CM_CLASS, wind );
@@ -1617,7 +1617,8 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
     filter = gtk_file_filter_new();
     gtk_file_filter_set_name(filter, "*.qif");
     gtk_file_filter_add_pattern(filter, "*.[Qq][Ii][Ff]");
-    new_file_name = gnc_file_dialog(_("Select QIF File"),
+    new_file_name = gnc_file_dialog(gnc_ui_get_gtk_window (GTK_WIDGET (button)),
+                                    _("Select QIF File"),
                                     g_list_prepend (NULL, filter),
                                     default_dir,
                                     GNC_FILE_DIALOG_IMPORT);
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index 67743c8..cd47261 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -1486,7 +1486,8 @@ gnc_get_export_filename (SCM choice)
     title = g_strdup_printf (_("Save %s To File"), type);
     default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_REPORT);
 
-    filepath = gnc_file_dialog (title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT);
+    filepath = gnc_file_dialog (gnc_ui_get_main_window (NULL),
+                                title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT);
 
     /* Try to test for extension on file name, add if missing */
     if (g_strrstr(filepath, ".") == NULL)



Summary of changes:
 gnucash/gnome-utils/dialog-file-access.c           |  21 ++--
 gnucash/gnome-utils/dialog-file-access.h           |   6 +-
 gnucash/gnome-utils/dialog-totd.c                  |  18 +++-
 gnucash/gnome-utils/dialog-totd.h                  |   1 +
 gnucash/gnome-utils/gnc-autosave.c                 |   2 +-
 gnucash/gnome-utils/gnc-file.c                     | 120 ++++++++++-----------
 gnucash/gnome-utils/gnc-file.h                     |  28 ++---
 gnucash/gnome-utils/gnc-gnome-utils.c              |   4 +-
 gnucash/gnome-utils/gnc-main-window.c              |   2 +-
 gnucash/gnome-utils/gnc-plugin-file-history.c      |   3 +-
 gnucash/gnome-utils/gtkbuilder/dialog-totd.glade   |   1 -
 gnucash/gnome/assistant-hierarchy.c                |   3 +-
 gnucash/gnome/dialog-new-user.c                    |   2 +-
 gnucash/gnome/gnc-plugin-basic-commands.c          |  18 ++--
 gnucash/gnome/top-level.c                          |   2 +
 gnucash/gnucash-bin.c                              |   2 +-
 gnucash/import-export/aqb/gnc-file-aqb-import.c    |  15 +--
 gnucash/import-export/aqb/gnc-file-aqb-import.h    |   3 +-
 gnucash/import-export/aqb/gnc-plugin-aqbanking.c   |  12 ++-
 .../import-export/bi-import/dialog-bi-import-gui.c |   6 +-
 .../customer-import/dialog-customer-import-gui.c   |   7 +-
 gnucash/import-export/log-replay/gnc-log-replay.c  |   5 +-
 gnucash/import-export/log-replay/gnc-log-replay.h  |   4 +-
 .../log-replay/gnc-plugin-log-replay.c             |   2 +-
 gnucash/import-export/ofx/gnc-ofx-import.c         |   5 +-
 gnucash/import-export/ofx/gnc-ofx-import.h         |   4 +-
 gnucash/import-export/ofx/gnc-plugin-ofx.c         |   2 +-
 .../import-export/qif-imp/assistant-qif-import.c   |   5 +-
 .../report/report-gnome/gnc-plugin-page-report.c   |   3 +-
 29 files changed, 171 insertions(+), 135 deletions(-)



More information about the gnucash-changes mailing list