gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Fri Dec 8 09:52:43 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/ac89797e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a092aecd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0c254c36 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/89867952 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/995c3cf4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d8cc165e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/68103dd0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/12bad5ce (commit)
	 via  https://github.com/Gnucash/gnucash/commit/47d622de (commit)
	 via  https://github.com/Gnucash/gnucash/commit/66817bb9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/84929c8e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ad11afef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e319a167 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fcb4bdac (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e7b7974a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2be5642a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/778b86e2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0a8e5006 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9b0a8723 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a120c48f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/062851a8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4a84fca9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5ca129d8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/649a6a26 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/41656c92 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c6ae007b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/744cdac5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c9c58764 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e011576e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1ef379a7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5aa048e0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a5bf4e00 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d5996586 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/04a48499 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5204100d (commit)



commit ac89797e78715167b08d6a18ce4da7d1308e47e2
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Fri Dec 8 15:49:31 2017 +0100

    Fix transient parent warnings in search callbacks

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 38609e0..12e922f 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -162,13 +162,13 @@ gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
         sw->selected_item_list = g_list_reverse(sw->selected_item_list);
 
         // Call the callback
-        (cb->cb_multiselect_fn)(sw->selected_item_list, sw->user_data);
+        (cb->cb_multiselect_fn)(GTK_WINDOW (sw->dialog), sw->selected_item_list, sw->user_data);
     }
     else
     {
         // No, stick to the single-item callback
         if (cb->cb_fcn)
-            (cb->cb_fcn)(&(sw->selected_item), sw->user_data);
+            (cb->cb_fcn)(GTK_WINDOW (sw->dialog), &(sw->selected_item), sw->user_data);
     }
 }
 
@@ -238,7 +238,7 @@ gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
         return;
     }
 
-    (sw->selected_cb)(sw->selected_item, sw->select_arg);
+    (sw->selected_cb)(GTK_WINDOW (sw->dialog), sw->selected_item, sw->select_arg);
     gnc_search_dialog_destroy (sw);
 }
 
@@ -637,7 +637,7 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
 
     g_return_if_fail (sw->new_item_cb);
 
-    res = (sw->new_item_cb)(sw->user_data);
+    res = (sw->new_item_cb)(GTK_WINDOW (sw->dialog), sw->user_data);
 
     if (res)
     {
@@ -1467,7 +1467,7 @@ get_display_list (QofIdTypeConst type)
 
 
 static void
-do_nothing (gpointer *a, gpointer b)
+do_nothing (GtkWindow *dialog, gpointer *a, gpointer b)
 {
     return;
 }
diff --git a/gnucash/gnome-search/dialog-search.h b/gnucash/gnome-search/dialog-search.h
index e59e5a2..c94eb4f 100644
--- a/gnucash/gnome-search/dialog-search.h
+++ b/gnucash/gnome-search/dialog-search.h
@@ -40,7 +40,7 @@ typedef struct _GNCSearchWindow GNCSearchWindow;
  * result will be a pointer to the selected item (if one is selected)
  * and the callback may change the value.
  */
-typedef void (*GNCSearchCallback) (gpointer *obj_p, gpointer user_data);
+typedef void (*GNCSearchCallback) (GtkWindow *dialog, gpointer *obj_p, gpointer user_data);
 typedef void (*GNCSearchResultCB) (QofQuery *query, gpointer user_data,
                                    gpointer *result);
 
@@ -50,7 +50,7 @@ typedef void (*GNCSearchResultCB) (QofQuery *query, gpointer user_data,
  * will be added to the query, but not selected.  This means the GncGUID
  * must be set.
  */
-typedef gpointer (*GNCSearchNewItemCB) (gpointer user_data);
+typedef gpointer (*GNCSearchNewItemCB) (GtkWindow *dialog, gpointer user_data);
 
 /* Free the general user_data object */
 typedef void (*GNCSearchFree) (gpointer user_data);
@@ -59,15 +59,17 @@ typedef void (*GNCSearchFree) (gpointer user_data);
  * button.  The search dialog will close when this callback function
  * returns.
  */
-typedef void (*GNCSearchSelectedCB) (gpointer selected_object,
+typedef void (*GNCSearchSelectedCB) (GtkWindow *dialog,
+                                     gpointer selected_object,
                                      gpointer user_data);
 
 /** This callback is called when (if) the user clicks the 'select'
  * button.  The search dialog will close when this callback function
  * returns.
  */
-typedef void (*GNCSearchMultiSelectedCB) (GList *list_of_selected_objects,
-        gpointer user_data);
+typedef void (*GNCSearchMultiSelectedCB) (GtkWindow *dialog,
+                                          GList *list_of_selected_objects,
+                                          gpointer user_data);
 
 typedef struct
 {
diff --git a/gnucash/gnome-search/gnc-general-search.c b/gnucash/gnome-search/gnc-general-search.c
index 9bc30c5..c0d4f2b 100644
--- a/gnucash/gnome-search/gnc-general-search.c
+++ b/gnucash/gnome-search/gnc-general-search.c
@@ -39,6 +39,7 @@
 #include "gnc-component-manager.h"
 #include "qof.h"
 #include "gnc-general-search.h"
+#include "gnc-ui.h"
 
 #define GNCGENERALSEARCH_CLASS	"gnc-general-search-widget"
 
@@ -217,7 +218,7 @@ refresh_handler (GHashTable *changes, gpointer data)
 
 /* The user has selected from the search dialog */
 static void
-new_item_selected_cb (gpointer item, gpointer user_data)
+new_item_selected_cb (GtkWindow *dialog, gpointer item, gpointer user_data)
 {
     GNCGeneralSearch *gsl = user_data;
     gnc_general_search_set_selected (gsl, item);
@@ -250,7 +251,7 @@ search_cb(GtkButton * button, gpointer user_data)
         return;
     }
 
-    sw = (priv->search_cb)(gsl->selected_item, priv->user_data);
+    sw = (priv->search_cb)(gnc_ui_get_gtk_window (GTK_WIDGET (button)), gsl->selected_item, priv->user_data);
 
     /* NULL means nothing to 'select' */
     if (sw == NULL)
@@ -284,7 +285,7 @@ search_cb(GtkButton * button, gpointer user_data)
  *   @param comp_iter The iter in the completion's temporary model
  *   that represents the user selected match.
  *
- *   @param cbe A pointer to a currency entry widget. */
+ *   @param gsl A pointer to a currency entry widget. */
 static gboolean
 gnc_gsl_match_selected_cb (GtkEntryCompletion *completion,
                            GtkTreeModel       *comp_model,
diff --git a/gnucash/gnome-search/gnc-general-search.h b/gnucash/gnome-search/gnc-general-search.h
index adba808..dc51463 100644
--- a/gnucash/gnome-search/gnc-general-search.h
+++ b/gnucash/gnome-search/gnc-general-search.h
@@ -51,7 +51,7 @@
  * it actually returns a search-window, then this widget will set up the
  * appropriate callbacks to the search window to obtain selections.
  */
-typedef GNCSearchWindow *(*GNCSearchCB) (gpointer start, gpointer user_data);
+typedef GNCSearchWindow *(*GNCSearchCB) (GtkWindow *parent, gpointer start, gpointer user_data);
 
 typedef struct
 {
diff --git a/gnucash/gnome-utils/dialog-query-view.c b/gnucash/gnome-utils/dialog-query-view.c
index 44543c7..4052b6b 100644
--- a/gnucash/gnome-utils/dialog-query-view.c
+++ b/gnucash/gnome-utils/dialog-query-view.c
@@ -85,7 +85,7 @@ gnc_dialog_query_run_callback (GNCDisplayViewButton *cb, gpointer item,
         return;
 
     if (cb->cb_fcn)
-        (cb->cb_fcn)(item, dqv->user_data);
+        (cb->cb_fcn)(GTK_WINDOW (dqv->dialog), item, dqv->user_data);
 }
 
 static void
diff --git a/gnucash/gnome-utils/dialog-query-view.h b/gnucash/gnome-utils/dialog-query-view.h
index 96676af..88c8375 100644
--- a/gnucash/gnome-utils/dialog-query-view.h
+++ b/gnucash/gnome-utils/dialog-query-view.h
@@ -31,7 +31,7 @@
 
 typedef struct _DialogQueryView DialogQueryView;
 
-typedef void (*GNCDisplayViewCB)(gpointer obj, gpointer user_data);
+typedef void (*GNCDisplayViewCB)(GtkWindow *dialog, gpointer obj, gpointer user_data);
 typedef struct
 {
     const char         *label;
diff --git a/gnucash/gnome/business-gnome-utils.c b/gnucash/gnome/business-gnome-utils.c
index 3114d77..1c917b7 100644
--- a/gnucash/gnome/business-gnome-utils.c
+++ b/gnucash/gnome/business-gnome-utils.c
@@ -189,14 +189,14 @@ typedef struct _invoice_select_info
 } GncISI;
 
 static GNCSearchWindow *
-gnc_invoice_select_search_cb (gpointer start, gpointer isip)
+gnc_invoice_select_search_cb (GtkWindow *parent, gpointer start, gpointer isip)
 {
     GncISI *isi = isip;
 
     if (!isi) return NULL;
     g_assert(isi->book);
 
-    return gnc_invoice_search (NULL, start,
+    return gnc_invoice_search (parent, start,
                                isi->have_owner ? &isi->owner : NULL,
                                isi->book);
 }
diff --git a/gnucash/gnome/dialog-customer.c b/gnucash/gnome/dialog-customer.c
index a7ae632..6000657 100644
--- a/gnucash/gnome/dialog-customer.c
+++ b/gnucash/gnome/dialog-customer.c
@@ -115,8 +115,8 @@ typedef enum
 
 struct _customer_select_window
 {
-    QofBook *	book;
-    QofQuery *	q;
+    QofBook  *book;
+    QofQuery *q;
 };
 
 struct _customer_window
@@ -781,7 +781,7 @@ gnc_ui_customer_new (GtkWindow *parent, QofBook *bookp)
 /* Functions for customer selection widgets */
 
 static void
-invoice_customer_cb (gpointer *cust_p, gpointer user_data)
+invoice_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
 {
     struct _customer_select_window *sw = user_data;
     GncOwner owner;
@@ -795,12 +795,12 @@ invoice_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_invoice_search (NULL, NULL, &owner, sw->book);
+    gnc_invoice_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-order_customer_cb (gpointer *cust_p, gpointer user_data)
+order_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
 {
     struct _customer_select_window *sw = user_data;
     GncOwner owner;
@@ -814,12 +814,12 @@ order_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_order_search (NULL, NULL, &owner, sw->book);
+    gnc_order_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-jobs_customer_cb (gpointer *cust_p, gpointer user_data)
+jobs_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
 {
     struct _customer_select_window *sw = user_data;
     GncOwner owner;
@@ -833,12 +833,12 @@ jobs_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_job_search (NULL, NULL, &owner, sw->book);
+    gnc_job_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-payment_customer_cb (gpointer *cust_p, gpointer user_data)
+payment_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
 {
     struct _customer_select_window *sw = user_data;
     GncOwner owner;
@@ -852,12 +852,12 @@ payment_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_ui_payment_new (NULL, &owner, sw->book);
+    gnc_ui_payment_new (dialog, &owner, sw->book);
     return;
 }
 
 static void
-edit_customer_cb (gpointer *cust_p, gpointer user_data)
+edit_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
 {
     GncCustomer *cust;
 
@@ -867,20 +867,20 @@ edit_customer_cb (gpointer *cust_p, gpointer user_data)
     if (!cust)
         return;
 
-    gnc_ui_customer_edit (NULL, cust);
+    gnc_ui_customer_edit (dialog, cust);
 
     return;
 }
 
 static gpointer
-new_customer_cb (gpointer user_data)
+new_customer_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _customer_select_window *sw = user_data;
     CustomerWindow *cw;
 
     g_return_val_if_fail (sw, NULL);
 
-    cw = gnc_ui_customer_new (NULL, sw->book);
+    cw = gnc_ui_customer_new (dialog, sw->book);
     return cw_get_customer (cw);
 }
 
@@ -967,18 +967,18 @@ gnc_customer_search (GtkWindow *parent, GncCustomer *start, QofBook *book)
 }
 
 GNCSearchWindow *
-gnc_customer_search_select (gpointer start, gpointer book)
+gnc_customer_search_select (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_customer_search (NULL, start, book);
+    return gnc_customer_search (parent, start, book);
 }
 
 GNCSearchWindow *
-gnc_customer_search_edit (gpointer start, gpointer book)
+gnc_customer_search_edit (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_customer_edit (NULL, start);
+        gnc_ui_customer_edit (parent, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-customer.h b/gnucash/gnome/dialog-customer.h
index b5c4832..eaca3fa 100644
--- a/gnucash/gnome/dialog-customer.h
+++ b/gnucash/gnome/dialog-customer.h
@@ -43,7 +43,7 @@ GNCSearchWindow *gnc_customer_search (GtkWindow *parent, GncCustomer *start, Qof
  * select() provides a Select Dialog and returns it.
  * edit() opens the existing customer for editing and returns NULL.
  */
-GNCSearchWindow * gnc_customer_search_select (gpointer start, gpointer book);
-GNCSearchWindow * gnc_customer_search_edit (gpointer start, gpointer book);
+GNCSearchWindow * gnc_customer_search_select (GtkWindow *parent, gpointer start, gpointer book);
+GNCSearchWindow * gnc_customer_search_edit (GtkWindow *parent, gpointer start, gpointer book);
 
 #endif /* GNC_DIALOG_CUSTOMER_H_ */
diff --git a/gnucash/gnome/dialog-employee.c b/gnucash/gnome/dialog-employee.c
index 556e9bd..c587bd0 100644
--- a/gnucash/gnome/dialog-employee.c
+++ b/gnucash/gnome/dialog-employee.c
@@ -68,8 +68,8 @@ typedef enum
 
 struct _employee_select_window
 {
-    QofBook *	book;
-    QofQuery *	q;
+    QofBook  *book;
+    QofQuery *q;
 };
 
 struct _employee_window
@@ -601,7 +601,7 @@ gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee)
 /* Functions for employee selection widgets */
 
 static void
-invoice_employee_cb (gpointer *employee_p, gpointer user_data)
+invoice_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
 {
     struct _employee_select_window *sw = user_data;
     GncOwner owner;
@@ -615,12 +615,12 @@ invoice_employee_cb (gpointer *employee_p, gpointer user_data)
         return;
 
     gncOwnerInitEmployee (&owner, employee);
-    gnc_invoice_search (NULL, NULL, &owner, sw->book);
+    gnc_invoice_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-payment_employee_cb (gpointer *employee_p, gpointer user_data)
+payment_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
 {
     struct _employee_select_window *sw = user_data;
     GncOwner owner;
@@ -634,12 +634,12 @@ payment_employee_cb (gpointer *employee_p, gpointer user_data)
         return;
 
     gncOwnerInitEmployee (&owner, employee);
-    gnc_ui_payment_new (NULL, &owner, sw->book);
+    gnc_ui_payment_new (dialog, &owner, sw->book);
     return;
 }
 
 static void
-edit_employee_cb (gpointer *employee_p, gpointer user_data)
+edit_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
 {
     GncEmployee *employee;
 
@@ -650,19 +650,19 @@ edit_employee_cb (gpointer *employee_p, gpointer user_data)
     if (!employee)
         return;
 
-    gnc_ui_employee_edit (NULL, employee);
+    gnc_ui_employee_edit (dialog, employee);
     return;
 }
 
 static gpointer
-new_employee_cb (gpointer user_data)
+new_employee_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _employee_select_window *sw = user_data;
     EmployeeWindow *ew;
 
     g_return_val_if_fail (user_data, NULL);
 
-    ew = gnc_ui_employee_new (NULL, sw->book);
+    ew = gnc_ui_employee_new (dialog, sw->book);
     return ew_get_employee (ew);
 }
 
@@ -744,18 +744,18 @@ gnc_employee_search (GtkWindow *parent, GncEmployee *start, QofBook *book)
 }
 
 GNCSearchWindow *
-gnc_employee_search_select (gpointer start, gpointer book)
+gnc_employee_search_select (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_employee_search (NULL, start, book);
+    return gnc_employee_search (parent, start, book);
 }
 
 GNCSearchWindow *
-gnc_employee_search_edit (gpointer start, gpointer book)
+gnc_employee_search_edit (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_employee_edit (NULL, start);
+        gnc_ui_employee_edit (parent, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-employee.h b/gnucash/gnome/dialog-employee.h
index 653fe34..05f22e8 100644
--- a/gnucash/gnome/dialog-employee.h
+++ b/gnucash/gnome/dialog-employee.h
@@ -43,7 +43,7 @@ GNCSearchWindow * gnc_employee_search (GtkWindow *parent, GncEmployee *start, Qo
  * select() provides a Select Dialog and returns it.
  * edit() opens the existing vendor for editing and returns NULL.
  */
-GNCSearchWindow * gnc_employee_search_select (gpointer start, gpointer book);
-GNCSearchWindow * gnc_employee_search_edit (gpointer start, gpointer book);
+GNCSearchWindow * gnc_employee_search_select (GtkWindow *parent, gpointer start, gpointer book);
+GNCSearchWindow * gnc_employee_search_edit (GtkWindow *parent, gpointer start, gpointer book);
 
 #endif /* GNC_DIALOG_EMPLOYEE_H_ */
diff --git a/gnucash/gnome/dialog-find-transactions.c b/gnucash/gnome/dialog-find-transactions.c
index a25325b..48ffa2e 100644
--- a/gnucash/gnome/dialog-find-transactions.c
+++ b/gnucash/gnome/dialog-find-transactions.c
@@ -41,9 +41,10 @@
 
 struct _ftd_data
 {
-    QofQuery *		q;
-    QofQuery *		ledger_q;
-    GNCSearchWindow *	sw;
+    QofQuery        *q;
+    QofQuery        *ledger_q;
+    GNCSearchWindow *sw;
+    GtkWindow       *parent;
 };
 
 static void
@@ -69,7 +70,7 @@ do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
     if (new_ledger)
     {
         page = gnc_plugin_page_register_new_ledger (ledger);
-        gnc_main_window_open_page (NULL, page);
+        gnc_main_window_open_page (GNC_MAIN_WINDOW(ftd->parent), page);
     }
 
     qof_query_destroy (ftd->q);
@@ -222,6 +223,8 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
         ftd->q = start_q;		/* save this to destroy it later */
     }
 
+    ftd->parent = parent;
+
     ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
                                         params, NULL, start_q, show_q,
                                         NULL, do_find_cb, NULL,
diff --git a/gnucash/gnome/dialog-find-transactions2.c b/gnucash/gnome/dialog-find-transactions2.c
index 7dafc47..93514bd 100644
--- a/gnucash/gnome/dialog-find-transactions2.c
+++ b/gnucash/gnome/dialog-find-transactions2.c
@@ -41,9 +41,10 @@
 
 struct _ftd_data
 {
-    QofQuery *		q;
-    QofQuery *		ledger_q;
-    GNCSearchWindow *	sw;
+    QofQuery        *q;
+    QofQuery        *ledger_q;
+    GNCSearchWindow *sw;
+    GtkWindow       *parent;
 };
 
 static void
@@ -70,7 +71,7 @@ do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
     if (new_ledger)
     {
         page = gnc_plugin_page_register2_new_ledger (ledger);
-        gnc_main_window_open_page (NULL, page);
+        gnc_main_window_open_page (GNC_MAIN_WINDOW(ftd->parent), page);
     }
 
     qof_query_destroy (ftd->q);
@@ -223,6 +224,8 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
         ftd->q = start_q;		/* save this to destroy it later */
     }
 
+    ftd->parent = parent;
+
     ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
                                         params, NULL, start_q, show_q,
                                         NULL, do_find_cb, NULL,
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index d0813b0..b766c6f 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -120,10 +120,10 @@ typedef enum
 
 struct _invoice_select_window
 {
-    QofBook *	book;
-    GncOwner *	owner;
-    QofQuery *	q;
-    GncOwner	owner_def;
+    QofBook  *book;
+    GncOwner *owner;
+    QofQuery *q;
+    GncOwner  owner_def;
 };
 
 #define UNUSED_VAR     __attribute__ ((unused))
@@ -757,6 +757,7 @@ struct post_invoice_params
     char *memo;             /* Memo for posting transaction */
     Account *acc;           /* Account to post to */
     gboolean accumulate;    /* Whether to accumulate splits */
+    GtkWindow *parent;
 };
 
 static void
@@ -1278,7 +1279,7 @@ gnc_invoice_job_changed_cb (GtkWidget *widget, gpointer data)
 }
 
 static GNCSearchWindow *
-gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
+gnc_invoice_select_job_cb (GtkWindow *parent, gpointer jobp, gpointer user_data)
 {
     GncJob *j = jobp;
     InvoiceWindow *iw = user_data;
@@ -1294,7 +1295,7 @@ gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
     else
         gncOwnerCopy (&(iw->owner), &owner);
 
-    return gnc_job_search (GTK_WINDOW(iw_get_window(iw)), j, &owner, iw->book);
+    return gnc_job_search (parent, j, &owner, iw->book);
 }
 
 static void
@@ -1340,7 +1341,7 @@ gnc_invoice_update_job_choice (InvoiceWindow *iw)
 }
 
 static GNCSearchWindow *
-gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
+gnc_invoice_select_proj_job_cb (GtkWindow *parent, gpointer jobp, gpointer user_data)
 {
     GncJob *j = jobp;
     InvoiceWindow *iw = user_data;
@@ -1356,7 +1357,7 @@ gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
     else
         gncOwnerCopy (&(iw->proj_cust), &owner);
 
-    return gnc_job_search (GTK_WINDOW(iw_get_window(iw)), j, &owner, iw->book);
+    return gnc_job_search (parent, j, &owner, iw->book);
 }
 
 static int
@@ -2681,7 +2682,8 @@ gnc_ui_invoice_edit (GtkWindow *parent, GncInvoice *invoice)
         type = EDIT_INVOICE;
 
     iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
-                               invoice, gncInvoiceGetOwner (invoice), GNC_MAIN_WINDOW(parent));
+                               invoice, gncInvoiceGetOwner (invoice),
+                               GNC_MAIN_WINDOW(gnc_ui_get_main_window (GTK_WIDGET (parent))));
 
     return iw;
 }
@@ -2798,47 +2800,67 @@ gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook *book)
 /* Functions for invoice selection widgets */
 
 static void
-edit_invoice_direct (gpointer invoice, gpointer user_data)
+edit_invoice_direct (GtkWindow *dialog, gpointer invoice, gpointer user_data)
 {
     g_return_if_fail (invoice);
-    gnc_ui_invoice_edit (NULL, invoice);
+    gnc_ui_invoice_edit (gnc_ui_get_main_window (GTK_WIDGET (dialog)), invoice);
 }
 
 static void
-edit_invoice_cb (gpointer inv, gpointer user_data)
+edit_invoice_cb (GtkWindow *dialog, gpointer inv, gpointer user_data)
 {
     GncInvoice *invoice = inv;
     g_return_if_fail (invoice && user_data);
-    edit_invoice_direct (invoice, user_data);
+    edit_invoice_direct (dialog, invoice, user_data);
+}
+
+
+struct multi_edit_invoice_data
+{
+    gpointer user_data;
+    GtkWindow *parent;
+};
+
+static void
+multi_edit_invoice_one (gpointer inv, gpointer user_data)
+{
+    struct multi_edit_invoice_data *meid = user_data;
+    edit_invoice_cb (meid->parent, inv, meid->user_data);
 }
 
 static void
-multi_edit_invoice_cb (GList *invoice_list, gpointer user_data)
+multi_edit_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
 {
-    g_list_foreach(invoice_list, edit_invoice_cb, user_data);
+    struct multi_edit_invoice_data meid;
+
+    meid.user_data = user_data;
+    meid.parent = dialog;
+    g_list_foreach (invoice_list, multi_edit_invoice_one, &meid);
 }
 
 static void
-pay_invoice_direct (gpointer inv, gpointer user_data)
+pay_invoice_direct (GtkWindow *dialog, gpointer inv, gpointer user_data)
 {
     GncInvoice *invoice = inv;
 
     g_return_if_fail (invoice);
-    gnc_ui_payment_new_with_invoice (NULL, gncInvoiceGetOwner (invoice),
+    gnc_ui_payment_new_with_invoice (dialog, gncInvoiceGetOwner (invoice),
                                      gncInvoiceGetBook (invoice), invoice);
 }
 
 static void
-pay_invoice_cb (gpointer *invoice_p, gpointer user_data)
+pay_invoice_cb (GtkWindow *dialog, gpointer *invoice_p, gpointer user_data)
 {
     g_return_if_fail (invoice_p && user_data);
     if (! *invoice_p)
         return;
-    pay_invoice_direct (*invoice_p, user_data);
+    pay_invoice_direct (dialog, *invoice_p, user_data);
 }
+
 struct multi_duplicate_invoice_data
 {
     GDate date;
+    GtkWindow *parent;
 };
 
 static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
@@ -2853,7 +2875,7 @@ static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
         // In this simplest form, we just use the existing duplication
         // algorithm, only without opening the "edit invoice" window for editing
         // the number etc. for each of the invoices.
-        InvoiceWindow *iw = gnc_ui_invoice_duplicate(NULL, old_invoice, FALSE, &dup_user_data->date);
+        InvoiceWindow *iw = gnc_ui_invoice_duplicate(dup_user_data->parent, old_invoice, FALSE, &dup_user_data->date);
         // FIXME: Now we could use this invoice and manipulate further data.
         g_assert(iw);
         new_invoice = iw_get_invoice(iw);
@@ -2862,7 +2884,7 @@ static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
 }
 
 static void
-multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
+multi_duplicate_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
 {
     g_return_if_fail (invoice_list);
     switch (g_list_length(invoice_list))
@@ -2873,7 +2895,7 @@ multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
     {
         // Duplicate exactly one invoice
         GncInvoice *old_invoice = invoice_list->data;
-        gnc_ui_invoice_duplicate(NULL, old_invoice, TRUE, NULL);
+        gnc_ui_invoice_duplicate(dialog, old_invoice, TRUE, NULL);
         return;
     }
     default:
@@ -2884,7 +2906,8 @@ multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
 
         // Default date: Today
         gnc_gdate_set_time64(&dup_user_data.date, gnc_time (NULL));
-        dialog_ok = gnc_dup_date_dialog (NULL, _("Date of duplicated entries"), &dup_user_data.date);
+        dup_user_data.parent = dialog;
+        dialog_ok = gnc_dup_date_dialog (GTK_WIDGET(dialog), _("Date of duplicated entries"), &dup_user_data.date);
         if (!dialog_ok)
         {
             // User pressed cancel, so don't duplicate anything here.
@@ -2904,7 +2927,7 @@ static void post_one_invoice_cb(gpointer data, gpointer user_data)
 {
     GncInvoice *invoice = data;
     struct post_invoice_params *post_params = user_data;
-    InvoiceWindow *iw = gnc_ui_invoice_edit(NULL, invoice);
+    InvoiceWindow *iw = gnc_ui_invoice_edit(post_params->parent, invoice);
     gnc_invoice_post(iw, post_params);
 }
 
@@ -2921,7 +2944,7 @@ static void gnc_invoice_is_posted(gpointer inv, gpointer test_value)
 
 
 static void
-multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
+multi_post_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
 {
     struct post_invoice_params post_params;
     gboolean test;
@@ -2930,7 +2953,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
     if (g_list_length(invoice_list) == 0)
         return;
     // Get the posting parameters for these invoices
-    iw = gnc_ui_invoice_edit(NULL, invoice_list->data);
+    iw = gnc_ui_invoice_edit(dialog, invoice_list->data);
     test = FALSE;
     gnc_suspend_gui_refresh (); // Turn off GUI refresh for the duration.
     // Check if any of the selected invoices have already been posted.
@@ -2948,6 +2971,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
                                  &post_params.memo, &post_params.acc,
                                  &post_params.accumulate))
         return;
+    post_params.parent = dialog;
 
     // Turn off GUI refresh for the duration.  This is more than just an
     // optimization.  If the search that got us here is based on the "posted"
@@ -2958,30 +2982,41 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
     gnc_resume_gui_refresh ();
 }
 
-static void print_one_invoice_cb(gpointer data, gpointer user_data)
+static void print_one_invoice_cb(GtkWindow *dialog, gpointer data, gpointer user_data)
 {
     GncInvoice *invoice = data;
-    gnc_invoice_window_print_invoice(NULL, invoice); // that's all!
+    gnc_invoice_window_print_invoice (dialog, invoice);
+}
+
+static void
+multi_print_invoice_one (gpointer data, gpointer user_data)
+{
+    struct multi_edit_invoice_data *meid = user_data;
+    print_one_invoice_cb (meid->parent, data, meid->user_data);
 }
 
 static void
-multi_print_invoice_cb (GList *invoice_list, gpointer user_data)
+multi_print_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
 {
+    struct multi_edit_invoice_data meid;
+
     if (g_list_length(invoice_list) == 0)
         return;
 
-    g_list_foreach(invoice_list, print_one_invoice_cb, user_data);
+    meid.user_data = user_data;
+    meid.parent = dialog;
+    g_list_foreach (invoice_list, multi_print_invoice_one, &meid);
 }
 
 static gpointer
-new_invoice_cb (gpointer user_data)
+new_invoice_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _invoice_select_window *sw = user_data;
     InvoiceWindow *iw;
 
     g_return_val_if_fail (user_data, NULL);
 
-    iw = gnc_ui_invoice_new (NULL, sw->owner, sw->book);
+    iw = gnc_ui_invoice_new (dialog, sw->owner, sw->book);
     return iw_get_invoice (iw);
 }
 
@@ -3406,6 +3441,7 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
                       len);
         title = _("Due Invoices Reminder");
     }
+
     dialog = gnc_dialog_query_view_create(parent, param_list, q,
                                           title,
                                           message,
diff --git a/gnucash/gnome/dialog-job.c b/gnucash/gnome/dialog-job.c
index 1badf2b..c18f570 100644
--- a/gnucash/gnome/dialog-job.c
+++ b/gnucash/gnome/dialog-job.c
@@ -63,10 +63,10 @@ typedef enum
 
 struct _job_select_window
 {
-    QofBook *	book;
-    GncOwner *	owner;
-    QofQuery *	q;
-    GncOwner	owner_def;
+    QofBook  *book;
+    GncOwner *owner;
+    QofQuery *q;
+    GncOwner  owner_def;
 };
 
 struct _job_window
@@ -472,7 +472,7 @@ gnc_ui_job_edit (GtkWindow *parent, GncJob *job)
 /* Search functionality */
 
 static void
-edit_job_cb (gpointer *job_p, gpointer user_data)
+edit_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
 {
     GncJob *job;
 
@@ -483,11 +483,11 @@ edit_job_cb (gpointer *job_p, gpointer user_data)
     if (!job)
         return;
 
-    gnc_ui_job_edit (NULL, job);
+    gnc_ui_job_edit (dialog, job);
 }
 
 static void
-invoice_job_cb (gpointer *job_p, gpointer user_data)
+invoice_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
 {
     struct _job_select_window * sw = user_data;
     GncJob *job;
@@ -500,11 +500,11 @@ invoice_job_cb (gpointer *job_p, gpointer user_data)
         return;
 
     gncOwnerInitJob (&owner, job);
-    gnc_invoice_search (NULL, NULL, &owner, sw->book);
+    gnc_invoice_search (dialog, NULL, &owner, sw->book);
 }
 
 static void
-payment_job_cb (gpointer *job_p, gpointer user_data)
+payment_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
 {
     struct _job_select_window *sw = user_data;
     GncOwner owner;
@@ -518,19 +518,19 @@ payment_job_cb (gpointer *job_p, gpointer user_data)
         return;
 
     gncOwnerInitJob (&owner, job);
-    gnc_ui_payment_new (NULL, &owner, sw->book);
+    gnc_ui_payment_new (dialog, &owner, sw->book);
     return;
 }
 
 static gpointer
-new_job_cb (gpointer user_data)
+new_job_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _job_select_window *sw = user_data;
     JobWindow *jw;
 
     g_return_val_if_fail (user_data, NULL);
 
-    jw = gnc_ui_job_new (NULL, sw->owner, sw->book);
+    jw = gnc_ui_job_new (dialog, sw->owner, sw->book);
     return jw_get_job (jw);
 }
 
@@ -650,7 +650,7 @@ gnc_job_search (GtkWindow *parent, GncJob *start, GncOwner *owner, QofBook *book
 /* Functions for widgets for job selection */
 
 GNCSearchWindow *
-gnc_job_search_select (gpointer start, gpointer book)
+gnc_job_search_select (GtkWindow *parent, gpointer start, gpointer book)
 {
     GncJob *j = start;
     GncOwner owner, *ownerp;
@@ -665,14 +665,14 @@ gnc_job_search_select (gpointer start, gpointer book)
     else
         gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-    return gnc_job_search (NULL, start, &owner, book);
+    return gnc_job_search (parent, start, &owner, book);
 }
 
 GNCSearchWindow *
-gnc_job_search_edit (gpointer start, gpointer book)
+gnc_job_search_edit (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_job_edit (NULL, start);
+        gnc_ui_job_edit (parent, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-job.h b/gnucash/gnome/dialog-job.h
index 429b9cf..4df562c 100644
--- a/gnucash/gnome/dialog-job.h
+++ b/gnucash/gnome/dialog-job.h
@@ -45,7 +45,7 @@ GNCSearchWindow * gnc_job_search (GtkWindow *parent, GncJob *start,
  * select() provides a Select Dialog and returns it.
  * edit() opens the existing customer for editing and returns NULL.
  */
-GNCSearchWindow * gnc_job_search_select (gpointer start, gpointer book);
-GNCSearchWindow * gnc_job_search_edit (gpointer start, gpointer book);
+GNCSearchWindow * gnc_job_search_select (GtkWindow *parent, gpointer start, gpointer book);
+GNCSearchWindow * gnc_job_search_edit (GtkWindow *parent, gpointer start, gpointer book);
 
 #endif /* GNC_DIALOG_JOB_H_ */
diff --git a/gnucash/gnome/dialog-order.c b/gnucash/gnome/dialog-order.c
index 91727a8..f2fd400 100644
--- a/gnucash/gnome/dialog-order.c
+++ b/gnucash/gnome/dialog-order.c
@@ -71,10 +71,10 @@ typedef enum
 
 struct _order_select_window
 {
-    QofBook *	book;
-    GncOwner *	owner;
-    QofQuery *	q;
-    GncOwner	owner_def;
+    QofBook  *book;
+    GncOwner *owner;
+    QofQuery *q;
+    GncOwner  owner_def;
 };
 
 struct _order_window
@@ -817,7 +817,7 @@ gnc_ui_order_new (GtkWindow *parent, GncOwner *ownerp, QofBook *bookp)
 /* Functions for order selection widgets */
 
 static void
-edit_order_cb (gpointer *order_p, gpointer user_data)
+edit_order_cb (GtkWindow *dialog, gpointer *order_p, gpointer user_data)
 {
     GncOrder *order;
 
@@ -826,20 +826,20 @@ edit_order_cb (gpointer *order_p, gpointer user_data)
     order = *order_p;
 
     if (order)
-        gnc_ui_order_edit (NULL, order);
+        gnc_ui_order_edit (dialog, order);
 
     return;
 }
 
 static gpointer
-new_order_cb (gpointer user_data)
+new_order_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _order_select_window *sw = user_data;
     OrderWindow *ow;
 
     g_return_val_if_fail (user_data, NULL);
 
-    ow = gnc_ui_order_new (NULL, sw->owner, sw->book);
+    ow = gnc_ui_order_new (dialog, sw->owner, sw->book);
     return ow_get_order (ow);
 }
 
@@ -961,7 +961,7 @@ gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner *owner, QofBook *
 }
 
 GNCSearchWindow *
-gnc_order_search_select (gpointer start, gpointer book)
+gnc_order_search_select (GtkWindow *parent, gpointer start, gpointer book)
 {
     GncOrder *o = start;
     GncOwner owner, *ownerp;
@@ -976,14 +976,14 @@ gnc_order_search_select (gpointer start, gpointer book)
     else
         gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-    return gnc_order_search (NULL, start, NULL, book);
+    return gnc_order_search (parent, start, NULL, book);
 }
 
 GNCSearchWindow *
-gnc_order_search_edit (gpointer start, gpointer book)
+gnc_order_search_edit (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_order_edit (NULL, start);
+        gnc_ui_order_edit (parent, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-order.h b/gnucash/gnome/dialog-order.h
index 9c458f9..3c9eace 100644
--- a/gnucash/gnome/dialog-order.h
+++ b/gnucash/gnome/dialog-order.h
@@ -45,7 +45,7 @@ GNCSearchWindow * gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner
  * select() provides a Select Dialog and returns it.
  * edit() opens the existing order for editing and returns NULL.
  */
-GNCSearchWindow * gnc_order_search_select (gpointer start, gpointer book);
-GNCSearchWindow * gnc_order_search_edit (gpointer start, gpointer book);
+GNCSearchWindow * gnc_order_search_select (GtkWindow *parent, gpointer start, gpointer book);
+GNCSearchWindow * gnc_order_search_edit (GtkWindow *parent, gpointer start, gpointer book);
 
 #endif /* GNC_DIALOG_ORDER_H_ */
diff --git a/gnucash/gnome/dialog-vendor.c b/gnucash/gnome/dialog-vendor.c
index 3f61c04..9d48ea8 100644
--- a/gnucash/gnome/dialog-vendor.c
+++ b/gnucash/gnome/dialog-vendor.c
@@ -70,8 +70,8 @@ typedef enum
 
 struct _vendor_select_window
 {
-    QofBook *	book;
-    QofQuery *	q;
+    QofBook  *book;
+    QofQuery *q;
 };
 
 struct _vendor_window
@@ -587,7 +587,7 @@ gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor)
 /* Functions for vendor selection widgets */
 
 static void
-invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
+invoice_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
 {
     struct _vendor_select_window *sw = user_data;
     GncOwner owner;
@@ -601,12 +601,12 @@ invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_invoice_search (NULL, NULL, &owner, sw->book);
+    gnc_invoice_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-order_vendor_cb (gpointer *vendor_p, gpointer user_data)
+order_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
 {
     struct _vendor_select_window *sw = user_data;
     GncOwner owner;
@@ -620,12 +620,12 @@ order_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_order_search (NULL, NULL, &owner, sw->book);
+    gnc_order_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
+jobs_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
 {
     struct _vendor_select_window *sw = user_data;
     GncOwner owner;
@@ -639,12 +639,12 @@ jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_job_search (NULL, NULL, &owner, sw->book);
+    gnc_job_search (dialog, NULL, &owner, sw->book);
     return;
 }
 
 static void
-payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
+payment_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
 {
     struct _vendor_select_window *sw = user_data;
     GncOwner owner;
@@ -658,12 +658,12 @@ payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_ui_payment_new (NULL, &owner, sw->book);
+    gnc_ui_payment_new (dialog, &owner, sw->book);
     return;
 }
 
 static void
-edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
+edit_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
 {
     GncVendor *vendor;
 
@@ -674,19 +674,19 @@ edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
     if (!vendor)
         return;
 
-    gnc_ui_vendor_edit (NULL, vendor);
+    gnc_ui_vendor_edit (dialog, vendor);
     return;
 }
 
 static gpointer
-new_vendor_cb (gpointer user_data)
+new_vendor_cb (GtkWindow *dialog, gpointer user_data)
 {
     struct _vendor_select_window *sw = user_data;
     VendorWindow *vw;
 
     g_return_val_if_fail (user_data, NULL);
 
-    vw = gnc_ui_vendor_new (NULL, sw->book);
+    vw = gnc_ui_vendor_new (dialog, sw->book);
     return vw_get_vendor (vw);
 }
 
@@ -769,18 +769,18 @@ gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBook *book)
 }
 
 GNCSearchWindow *
-gnc_vendor_search_select (gpointer start, gpointer book)
+gnc_vendor_search_select (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_vendor_search (NULL, start, book);
+    return gnc_vendor_search (parent, start, book);
 }
 
 GNCSearchWindow *
-gnc_vendor_search_edit (gpointer start, gpointer book)
+gnc_vendor_search_edit (GtkWindow *parent, gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_vendor_edit (NULL, start);
+        gnc_ui_vendor_edit (parent, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-vendor.h b/gnucash/gnome/dialog-vendor.h
index 66d41ff..0835132 100644
--- a/gnucash/gnome/dialog-vendor.h
+++ b/gnucash/gnome/dialog-vendor.h
@@ -43,7 +43,7 @@ GNCSearchWindow * gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBoo
  * select() provides a Select Dialog and returns it.
  * edit() opens the existing vendor for editing and returns NULL.
  */
-GNCSearchWindow * gnc_vendor_search_select (gpointer start, gpointer book);
-GNCSearchWindow * gnc_vendor_search_edit (gpointer start, gpointer book);
+GNCSearchWindow * gnc_vendor_search_select (GtkWindow *parent, gpointer start, gpointer book);
+GNCSearchWindow * gnc_vendor_search_edit (GtkWindow *parent, gpointer start, gpointer book);
 
 #endif /* GNC_DIALOG_VENDOR_H_ */

commit a092aecd568e185e1d24b97afc57ccc90ffe3987
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Dec 6 21:46:20 2017 +0100

    Add transient parent for search dialog

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 63dd1f2..38609e0 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -1300,7 +1300,8 @@ gnc_search_dialog_raise (GNCSearchWindow *sw)
 }
 
 GNCSearchWindow *
-gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
+gnc_search_dialog_create (GtkWindow *parent,
+                          QofIdTypeConst obj_type, const gchar *title,
                           GList *param_list,
                           GList *display_list,
                           QofQuery *start_query, QofQuery *show_start_query,
@@ -1345,6 +1346,7 @@ gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
     gnc_search_dialog_init_widgets (sw, title);
     if (sw->prefs_group)
         gnc_restore_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog));
+    gtk_window_set_transient_for(GTK_WINDOW(sw->dialog), parent);
     gtk_widget_show(sw->dialog);
 
     // Set the style context for this dialog so it can be easily manipulated with css
@@ -1494,7 +1496,7 @@ gnc_search_dialog_test (void)
         display = get_display_list (GNC_ID_SPLIT);
 
 /* FIXME: All this does is leak. */
-    gnc_search_dialog_create (GNC_ID_SPLIT, _("Find Transaction"),
+    gnc_search_dialog_create (NULL, GNC_ID_SPLIT, _("Find Transaction"),
 			      params, display,
 			      NULL, NULL, buttons, NULL, NULL, NULL, NULL,
 			      NULL, NULL, NULL);
diff --git a/gnucash/gnome-search/dialog-search.h b/gnucash/gnome-search/dialog-search.h
index ec3bc28..e59e5a2 100644
--- a/gnucash/gnome-search/dialog-search.h
+++ b/gnucash/gnome-search/dialog-search.h
@@ -103,7 +103,8 @@ typedef struct
  * the dialog will use the obj_type instead.
  */
 GNCSearchWindow *
-gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
+gnc_search_dialog_create (GtkWindow *parent,
+                          QofIdTypeConst obj_type, const gchar *title,
                           GList *param_list,
                           GList *display_list,
                           QofQuery *start_query, QofQuery *show_start_query,
diff --git a/gnucash/gnome/business-gnome-utils.c b/gnucash/gnome/business-gnome-utils.c
index c4a8555..3114d77 100644
--- a/gnucash/gnome/business-gnome-utils.c
+++ b/gnucash/gnome/business-gnome-utils.c
@@ -196,7 +196,7 @@ gnc_invoice_select_search_cb (gpointer start, gpointer isip)
     if (!isi) return NULL;
     g_assert(isi->book);
 
-    return gnc_invoice_search (start,
+    return gnc_invoice_search (NULL, start,
                                isi->have_owner ? &isi->owner : NULL,
                                isi->book);
 }
diff --git a/gnucash/gnome/dialog-customer.c b/gnucash/gnome/dialog-customer.c
index 6bbcac5..a7ae632 100644
--- a/gnucash/gnome/dialog-customer.c
+++ b/gnucash/gnome/dialog-customer.c
@@ -795,7 +795,7 @@ invoice_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_invoice_search (NULL, &owner, sw->book);
+    gnc_invoice_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -814,7 +814,7 @@ order_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_order_search (NULL, &owner, sw->book);
+    gnc_order_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -833,7 +833,7 @@ jobs_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_job_search (NULL, &owner, sw->book);
+    gnc_job_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -896,7 +896,7 @@ free_userdata_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_customer_search (GncCustomer *start, QofBook *book)
+gnc_customer_search (GtkWindow *parent, GncCustomer *start, QofBook *book)
 {
     QofQuery *q, *q2 = NULL;
     QofIdType type = GNC_CUSTOMER_MODULE_NAME;
@@ -959,7 +959,7 @@ gnc_customer_search (GncCustomer *start, QofBook *book)
     sw->book = book;
     sw->q = q;
 
-    return gnc_search_dialog_create (type, _("Find Customer"),
+    return gnc_search_dialog_create (parent, type, _("Find Customer"),
                                      params, columns, q, q2, buttons, NULL,
                                      new_customer_cb, sw, free_userdata_cb,
                                      GNC_PREFS_GROUP_SEARCH, NULL,
@@ -971,7 +971,7 @@ gnc_customer_search_select (gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_customer_search (start, book);
+    return gnc_customer_search (NULL, start, book);
 }
 
 GNCSearchWindow *
diff --git a/gnucash/gnome/dialog-customer.h b/gnucash/gnome/dialog-customer.h
index c3dc03b..b5c4832 100644
--- a/gnucash/gnome/dialog-customer.h
+++ b/gnucash/gnome/dialog-customer.h
@@ -35,7 +35,7 @@ CustomerWindow * gnc_ui_customer_edit (GtkWindow *parent, GncCustomer *cust);
 CustomerWindow * gnc_ui_customer_new (GtkWindow *parent, QofBook *book);
 
 /* Search for customers */
-GNCSearchWindow *gnc_customer_search (GncCustomer *start, QofBook *book);
+GNCSearchWindow *gnc_customer_search (GtkWindow *parent, GncCustomer *start, QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget
diff --git a/gnucash/gnome/dialog-employee.c b/gnucash/gnome/dialog-employee.c
index 665924f..556e9bd 100644
--- a/gnucash/gnome/dialog-employee.c
+++ b/gnucash/gnome/dialog-employee.c
@@ -615,7 +615,7 @@ invoice_employee_cb (gpointer *employee_p, gpointer user_data)
         return;
 
     gncOwnerInitEmployee (&owner, employee);
-    gnc_invoice_search (NULL, &owner, sw->book);
+    gnc_invoice_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -678,7 +678,7 @@ free_employee_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_employee_search (GncEmployee *start, QofBook *book)
+gnc_employee_search (GtkWindow *parent, GncEmployee *start, QofBook *book)
 {
     QofIdType type = GNC_EMPLOYEE_MODULE_NAME;
     struct _employee_select_window *sw;
@@ -735,7 +735,7 @@ gnc_employee_search (GncEmployee *start, QofBook *book)
     sw->book = book;
     sw->q = q;
 
-    return gnc_search_dialog_create (type, _("Find Employee"),
+    return gnc_search_dialog_create (parent, type, _("Find Employee"),
                                      params, columns, q, q2,
                                      buttons, NULL, new_employee_cb,
                                      sw, free_employee_cb,
@@ -748,7 +748,7 @@ gnc_employee_search_select (gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_employee_search (start, book);
+    return gnc_employee_search (NULL, start, book);
 }
 
 GNCSearchWindow *
diff --git a/gnucash/gnome/dialog-employee.h b/gnucash/gnome/dialog-employee.h
index 65551a9..653fe34 100644
--- a/gnucash/gnome/dialog-employee.h
+++ b/gnucash/gnome/dialog-employee.h
@@ -35,7 +35,7 @@ EmployeeWindow * gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee)
 EmployeeWindow * gnc_ui_employee_new (GtkWindow *parent, QofBook *book);
 
 /* Search for an employee */
-GNCSearchWindow * gnc_employee_search (GncEmployee *start, QofBook *book);
+GNCSearchWindow * gnc_employee_search (GtkWindow *parent, GncEmployee *start, QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget
diff --git a/gnucash/gnome/dialog-find-transactions.c b/gnucash/gnome/dialog-find-transactions.c
index 4274890..a25325b 100644
--- a/gnucash/gnome/dialog-find-transactions.c
+++ b/gnucash/gnome/dialog-find-transactions.c
@@ -97,6 +97,7 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
     QofQuery *start_q, *show_q = NULL;
     gboolean num_action =
                 qof_book_use_split_action_for_num_field(gnc_get_current_book());
+    GtkWindow *parent = GTK_WINDOW(gnc_ledger_display_get_parent(orig_ledg));
 
     /* Build parameter list in reverse order */
     if (params == NULL)
@@ -221,7 +222,7 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
         ftd->q = start_q;		/* save this to destroy it later */
     }
 
-    ftd->sw = gnc_search_dialog_create (type, _("Find Transaction"),
+    ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
                                         params, NULL, start_q, show_q,
                                         NULL, do_find_cb, NULL,
                                         ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL,
diff --git a/gnucash/gnome/dialog-find-transactions2.c b/gnucash/gnome/dialog-find-transactions2.c
index 2eb9bd1..7dafc47 100644
--- a/gnucash/gnome/dialog-find-transactions2.c
+++ b/gnucash/gnome/dialog-find-transactions2.c
@@ -98,6 +98,7 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
     QofQuery *start_q, *show_q = NULL;
     gboolean num_action =
                 qof_book_use_split_action_for_num_field(gnc_get_current_book());
+    GtkWindow *parent = GTK_WINDOW(gnc_ledger_display2_get_parent (orig_ledg));
 
     /* Build parameter list in reverse order */
     if (params == NULL)
@@ -222,7 +223,7 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
         ftd->q = start_q;		/* save this to destroy it later */
     }
 
-    ftd->sw = gnc_search_dialog_create (type, _("Find Transaction"),
+    ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
                                         params, NULL, start_q, show_q,
                                         NULL, do_find_cb, NULL,
                                         ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL,
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index efeee18..d0813b0 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -1294,7 +1294,7 @@ gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
     else
         gncOwnerCopy (&(iw->owner), &owner);
 
-    return gnc_job_search (j, &owner, iw->book);
+    return gnc_job_search (GTK_WINDOW(iw_get_window(iw)), j, &owner, iw->book);
 }
 
 static void
@@ -1356,7 +1356,7 @@ gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
     else
         gncOwnerCopy (&(iw->proj_cust), &owner);
 
-    return gnc_job_search (j, &owner, iw->book);
+    return gnc_job_search (GTK_WINDOW(iw_get_window(iw)), j, &owner, iw->book);
 }
 
 static int
@@ -2997,7 +2997,7 @@ free_invoice_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
+gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncOwner *owner, QofBook *book)
 {
     QofIdType type = GNC_INVOICE_MODULE_NAME;
     struct _invoice_select_window *sw;
@@ -3264,7 +3264,7 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
         buttons = inv_buttons;
         break;
     }
-    return gnc_search_dialog_create (type, title, params, columns, q, q2,
+    return gnc_search_dialog_create (parent, type, title, params, columns, q, q2,
                                      buttons, NULL, new_invoice_cb,
                                      sw, free_invoice_cb, GNC_PREFS_GROUP_SEARCH,
                                      label, style_class);
diff --git a/gnucash/gnome/dialog-invoice.h b/gnucash/gnome/dialog-invoice.h
index 2fe4726..93a92fa 100644
--- a/gnucash/gnome/dialog-invoice.h
+++ b/gnucash/gnome/dialog-invoice.h
@@ -63,7 +63,7 @@ InvoiceWindow * gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook
 InvoiceWindow* gnc_ui_invoice_duplicate (GtkWindow* parent, GncInvoice* old_invoice, gboolean open_properties, const GDate* new_date);
 
 /* Search for invoices */
-GNCSearchWindow * gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book);
+GNCSearchWindow * gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncOwner *owner, QofBook *book);
 
 void gnc_business_call_owner_report (GtkWindow* parent, GncOwner *owner, Account *acc);
 
diff --git a/gnucash/gnome/dialog-job.c b/gnucash/gnome/dialog-job.c
index 32acf7c..1badf2b 100644
--- a/gnucash/gnome/dialog-job.c
+++ b/gnucash/gnome/dialog-job.c
@@ -500,7 +500,7 @@ invoice_job_cb (gpointer *job_p, gpointer user_data)
         return;
 
     gncOwnerInitJob (&owner, job);
-    gnc_invoice_search (NULL, &owner, sw->book);
+    gnc_invoice_search (NULL, NULL, &owner, sw->book);
 }
 
 static void
@@ -546,7 +546,7 @@ free_userdata_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
+gnc_job_search (GtkWindow *parent, GncJob *start, GncOwner *owner, QofBook *book)
 {
     QofQuery *q, *q2 = NULL;
     QofIdType type = GNC_JOB_MODULE_NAME;
@@ -640,7 +640,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
     sw->book = book;
     sw->q = q;
 
-    return gnc_search_dialog_create (type, _("Find Job"),
+    return gnc_search_dialog_create (parent, type, _("Find Job"),
                                      params, columns, q, q2, buttons, NULL,
                                      new_job_cb, sw, free_userdata_cb,
                                      GNC_PREFS_GROUP_SEARCH, NULL,
@@ -665,7 +665,7 @@ gnc_job_search_select (gpointer start, gpointer book)
     else
         gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-    return gnc_job_search (start, &owner, book);
+    return gnc_job_search (NULL, start, &owner, book);
 }
 
 GNCSearchWindow *
diff --git a/gnucash/gnome/dialog-job.h b/gnucash/gnome/dialog-job.h
index 864e51a..429b9cf 100644
--- a/gnucash/gnome/dialog-job.h
+++ b/gnucash/gnome/dialog-job.h
@@ -36,8 +36,8 @@ JobWindow * gnc_ui_job_edit (GtkWindow *parent, GncJob *job);
 JobWindow * gnc_ui_job_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
 
 /* Search for Jobs */
-GNCSearchWindow * gnc_job_search (GncJob *start, GncOwner *owner,
-                                  QofBook *book);
+GNCSearchWindow * gnc_job_search (GtkWindow *parent, GncJob *start,
+                                  GncOwner *owner, QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget
diff --git a/gnucash/gnome/dialog-order.c b/gnucash/gnome/dialog-order.c
index d3728c1..91727a8 100644
--- a/gnucash/gnome/dialog-order.c
+++ b/gnucash/gnome/dialog-order.c
@@ -246,7 +246,7 @@ gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data)
         return;
 
     /* Ok, go make an invoice */
-    gnc_invoice_search (NULL, &(ow->owner), ow->book);
+    gnc_invoice_search (gtk_window_get_transient_for(GTK_WINDOW(ow->dialog)), NULL, &(ow->owner), ow->book);
 
     /* refresh the window */
     gnc_order_update_window (ow);
@@ -855,7 +855,7 @@ free_order_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
+gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner *owner, QofBook *book)
 {
     QofIdType type = GNC_ORDER_MODULE_NAME;
     struct _order_select_window *sw;
@@ -953,7 +953,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
     sw->book = book;
     sw->q = q;
 
-    return gnc_search_dialog_create (type, _("Find Order"),
+    return gnc_search_dialog_create (parent, type, _("Find Order"),
                                      params, columns, q, q2,
                                      buttons, NULL, new_order_cb,
                                      sw, free_order_cb, GNC_PREFS_GROUP_SEARCH,
@@ -976,7 +976,7 @@ gnc_order_search_select (gpointer start, gpointer book)
     else
         gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-    return gnc_order_search (start, NULL, book);
+    return gnc_order_search (NULL, start, NULL, book);
 }
 
 GNCSearchWindow *
diff --git a/gnucash/gnome/dialog-order.h b/gnucash/gnome/dialog-order.h
index a02e19e..9c458f9 100644
--- a/gnucash/gnome/dialog-order.h
+++ b/gnucash/gnome/dialog-order.h
@@ -36,7 +36,7 @@ OrderWindow * gnc_ui_order_edit (GtkWindow *parent, GncOrder *order);
 OrderWindow * gnc_ui_order_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
 
 /* Search for orders */
-GNCSearchWindow * gnc_order_search (GncOrder *start, GncOwner *owner,
+GNCSearchWindow * gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner *owner,
                                     QofBook *book);
 
 /*
diff --git a/gnucash/gnome/dialog-vendor.c b/gnucash/gnome/dialog-vendor.c
index 4ffde76..3f61c04 100644
--- a/gnucash/gnome/dialog-vendor.c
+++ b/gnucash/gnome/dialog-vendor.c
@@ -601,7 +601,7 @@ invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_invoice_search (NULL, &owner, sw->book);
+    gnc_invoice_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -620,7 +620,7 @@ order_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_order_search (NULL, &owner, sw->book);
+    gnc_order_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -639,7 +639,7 @@ jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_job_search (NULL, &owner, sw->book);
+    gnc_job_search (NULL, NULL, &owner, sw->book);
     return;
 }
 
@@ -701,7 +701,7 @@ free_vendor_cb (gpointer user_data)
 }
 
 GNCSearchWindow *
-gnc_vendor_search (GncVendor *start, QofBook *book)
+gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBook *book)
 {
     QofIdType type = GNC_VENDOR_MODULE_NAME;
     struct _vendor_select_window *sw;
@@ -761,7 +761,7 @@ gnc_vendor_search (GncVendor *start, QofBook *book)
     sw->book = book;
     sw->q = q;
 
-    return gnc_search_dialog_create (type, _("Find Vendor"),
+    return gnc_search_dialog_create (parent, type, _("Find Vendor"),
                                      params, columns, q, q2, buttons, NULL,
                                      new_vendor_cb, sw, free_vendor_cb,
                                      GNC_PREFS_GROUP_SEARCH, NULL,
@@ -773,7 +773,7 @@ gnc_vendor_search_select (gpointer start, gpointer book)
 {
     if (!book) return NULL;
 
-    return gnc_vendor_search (start, book);
+    return gnc_vendor_search (NULL, start, book);
 }
 
 GNCSearchWindow *
diff --git a/gnucash/gnome/dialog-vendor.h b/gnucash/gnome/dialog-vendor.h
index a4a19be..66d41ff 100644
--- a/gnucash/gnome/dialog-vendor.h
+++ b/gnucash/gnome/dialog-vendor.h
@@ -35,7 +35,7 @@ VendorWindow * gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor);
 VendorWindow * gnc_ui_vendor_new (GtkWindow *parent, QofBook *book);
 
 /* Search for vendors */
-GNCSearchWindow * gnc_vendor_search (GncVendor *start, QofBook *book);
+GNCSearchWindow * gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index a0356f9..01f061d 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -488,7 +488,7 @@ gnc_plugin_business_cmd_customer_find_customer (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     customer = gncOwnerGetCustomer (priv->last_customer);
-    gnc_customer_search (customer, gnc_get_current_book());
+    gnc_customer_search (GTK_WINDOW (mw->window), customer, gnc_get_current_book ());
 }
 
 static void
@@ -520,7 +520,7 @@ gnc_plugin_business_cmd_customer_find_invoice (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
+    gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
 }
 
 static void
@@ -550,7 +550,7 @@ gnc_plugin_business_cmd_customer_find_job (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
+    gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
 }
 
 static void
@@ -605,7 +605,7 @@ gnc_plugin_business_cmd_vendor_find_vendor (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     vendor = gncOwnerGetVendor (priv->last_vendor);
-    gnc_vendor_search (vendor, gnc_get_current_book());
+    gnc_vendor_search (GTK_WINDOW (mw->window), vendor, gnc_get_current_book ());
 }
 
 static void
@@ -637,7 +637,7 @@ gnc_plugin_business_cmd_vendor_find_bill (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
+    gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
 }
 
 static void
@@ -667,7 +667,7 @@ gnc_plugin_business_cmd_vendor_find_job (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
+    gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
 }
 
 static void
@@ -722,7 +722,7 @@ gnc_plugin_business_cmd_employee_find_employee (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     employee = gncOwnerGetEmployee (priv->last_employee);
-    gnc_employee_search (employee, gnc_get_current_book());
+    gnc_employee_search (GTK_WINDOW (mw->window), employee, gnc_get_current_book ());
 }
 
 static void
@@ -754,7 +754,7 @@ gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
+    gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_employee, gnc_get_current_book ());
 }
 
 static void

commit 0c254c36a05c7edd6d2f101c28e918d4291012ac
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sun Dec 3 23:45:40 2017 +0100

    Fix missing transient parent warnings for several business dialogs

diff --git a/gnucash/gnome/business-urls.c b/gnucash/gnome/business-urls.c
index 9ba6240..280cafc 100644
--- a/gnucash/gnome/business-urls.c
+++ b/gnucash/gnome/business-urls.c
@@ -95,7 +95,7 @@ customerCB (const char *location, const char *label,
     /* href="...:customer=<guid>" */
     HANDLE_TYPE ("customer=", GNC_ID_CUSTOMER);
     customer = (GncCustomer *) entity;
-    gnc_ui_customer_edit (customer);
+    gnc_ui_customer_edit (result->parent, customer);
 
     return TRUE;
 }
@@ -110,7 +110,7 @@ vendorCB (const char *location, const char *label,
     /* href="...:vendor=<guid>" */
     HANDLE_TYPE ("vendor=", GNC_ID_VENDOR);
     vendor = (GncVendor *) entity;
-    gnc_ui_vendor_edit (vendor);
+    gnc_ui_vendor_edit (result->parent, vendor);
 
     return TRUE;
 }
@@ -126,7 +126,7 @@ employeeCB (const char *location, const char *label,
     HANDLE_TYPE ("employee=", GNC_ID_EMPLOYEE);
 
     employee = (GncEmployee *) entity;
-    gnc_ui_employee_edit (employee);
+    gnc_ui_employee_edit (result->parent, employee);
 
     return TRUE;
 }
@@ -141,7 +141,7 @@ invoiceCB (const char *location, const char *label,
     /* href="...:invoice=<guid>" */
     HANDLE_TYPE ("invoice=", GNC_ID_INVOICE);
     invoice = (GncInvoice *) entity;
-    gnc_ui_invoice_edit (invoice);
+    gnc_ui_invoice_edit (result->parent, invoice);
 
     return TRUE;
 }
@@ -156,7 +156,7 @@ jobCB (const char *location, const char *label,
     /* href="...:job=<guid>" */
     HANDLE_TYPE ("job=", GNC_ID_JOB);
     job = (GncJob *) entity;
-    gnc_ui_job_edit (job);
+    gnc_ui_job_edit (result->parent, job);
 
     return TRUE;
 }
@@ -306,7 +306,7 @@ ownerreportCB (const char *location, const char *label,
     }
 
     /* Ok, let's run this report */
-    gnc_business_call_owner_report (&owner, acc);
+    gnc_business_call_owner_report (result->parent, &owner, acc);
 
     return TRUE;
 }
diff --git a/gnucash/gnome/dialog-customer.c b/gnucash/gnome/dialog-customer.c
index a352fbc..6bbcac5 100644
--- a/gnucash/gnome/dialog-customer.c
+++ b/gnucash/gnome/dialog-customer.c
@@ -528,7 +528,7 @@ find_handler (gpointer find_data, gpointer user_data)
 }
 
 static CustomerWindow *
-gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
+gnc_customer_new_window (GtkWindow *parent, QofBook *bookp, GncCustomer *cust)
 {
     CustomerWindow *cw;
     GtkBuilder *builder;
@@ -549,6 +549,7 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
                                            find_handler, &customer_guid);
         if (cw)
         {
+            gtk_window_set_transient_for (GTK_WINDOW(cw->dialog), parent);
             gtk_window_present (GTK_WINDOW(cw->dialog));
             return(cw);
         }
@@ -574,6 +575,7 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
     gnc_builder_add_from_file (builder, "dialog-customer.glade", "taxtable_store");
     gnc_builder_add_from_file (builder, "dialog-customer.glade", "customer_dialog");
     cw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "customer_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(cw->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(cw->dialog), "GncCustomerDialog");
@@ -752,26 +754,26 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
 }
 
 CustomerWindow *
-gnc_ui_customer_edit (GncCustomer *cust)
+gnc_ui_customer_edit (GtkWindow *parent, GncCustomer *cust)
 {
     CustomerWindow *cw;
 
     if (!cust) return NULL;
 
-    cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
+    cw = gnc_customer_new_window (parent, gncCustomerGetBook(cust), cust);
 
     return cw;
 }
 
 CustomerWindow *
-gnc_ui_customer_new (QofBook *bookp)
+gnc_ui_customer_new (GtkWindow *parent, QofBook *bookp)
 {
     CustomerWindow *cw;
 
     /* Make sure required options exist */
     if (!bookp) return NULL;
 
-    cw = gnc_customer_new_window (bookp, NULL);
+    cw = gnc_customer_new_window (parent, bookp, NULL);
 
     return cw;
 }
@@ -850,7 +852,7 @@ payment_customer_cb (gpointer *cust_p, gpointer user_data)
         return;
 
     gncOwnerInitCustomer (&owner, cust);
-    gnc_ui_payment_new (&owner, sw->book);
+    gnc_ui_payment_new (NULL, &owner, sw->book);
     return;
 }
 
@@ -865,7 +867,7 @@ edit_customer_cb (gpointer *cust_p, gpointer user_data)
     if (!cust)
         return;
 
-    gnc_ui_customer_edit (cust);
+    gnc_ui_customer_edit (NULL, cust);
 
     return;
 }
@@ -878,7 +880,7 @@ new_customer_cb (gpointer user_data)
 
     g_return_val_if_fail (sw, NULL);
 
-    cw = gnc_ui_customer_new (sw->book);
+    cw = gnc_ui_customer_new (NULL, sw->book);
     return cw_get_customer (cw);
 }
 
@@ -976,7 +978,7 @@ GNCSearchWindow *
 gnc_customer_search_edit (gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_customer_edit (start);
+        gnc_ui_customer_edit (NULL, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-customer.h b/gnucash/gnome/dialog-customer.h
index 26d04fa..c3dc03b 100644
--- a/gnucash/gnome/dialog-customer.h
+++ b/gnucash/gnome/dialog-customer.h
@@ -31,8 +31,8 @@ typedef struct _customer_window CustomerWindow;
 #include "dialog-search.h"
 
 /* Functions to create and edit a customer */
-CustomerWindow * gnc_ui_customer_edit (GncCustomer *cust);
-CustomerWindow * gnc_ui_customer_new (QofBook *book);
+CustomerWindow * gnc_ui_customer_edit (GtkWindow *parent, GncCustomer *cust);
+CustomerWindow * gnc_ui_customer_new (GtkWindow *parent, QofBook *book);
 
 /* Search for customers */
 GNCSearchWindow *gnc_customer_search (GncCustomer *start, QofBook *book);
diff --git a/gnucash/gnome/dialog-employee.c b/gnucash/gnome/dialog-employee.c
index f4d8f80..665924f 100644
--- a/gnucash/gnome/dialog-employee.c
+++ b/gnucash/gnome/dialog-employee.c
@@ -46,6 +46,7 @@
 #include "dialog-employee.h"
 #include "dialog-invoice.h"
 #include "dialog-payment.h"
+#include "business-gnome-utils.h"
 
 #define DIALOG_NEW_EMPLOYEE_CM_CLASS "dialog-new-employee"
 #define DIALOG_EDIT_EMPLOYEE_CM_CLASS "dialog-edit-employee"
@@ -364,7 +365,8 @@ find_handler (gpointer find_data, gpointer user_data)
 }
 
 static EmployeeWindow *
-gnc_employee_new_window (QofBook *bookp,
+gnc_employee_new_window (GtkWindow *parent,
+                         QofBook *bookp,
                          GncEmployee *employee)
 {
     EmployeeWindow *ew;
@@ -388,6 +390,7 @@ gnc_employee_new_window (QofBook *bookp,
                                            find_handler, &employee_guid);
         if (ew)
         {
+            gtk_window_set_transient_for (GTK_WINDOW(ew->dialog), parent);
             gtk_window_present (GTK_WINDOW(ew->dialog));
             return(ew);
         }
@@ -410,6 +413,7 @@ gnc_employee_new_window (QofBook *bookp,
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-employee.glade", "employee_dialog");
     ew->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "employee_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(ew->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(ew->dialog), "GncEmployeeDialog");
@@ -570,26 +574,26 @@ gnc_employee_new_window (QofBook *bookp,
 }
 
 EmployeeWindow *
-gnc_ui_employee_new (QofBook *bookp)
+gnc_ui_employee_new (GtkWindow *parent, QofBook *bookp)
 {
     EmployeeWindow *ew;
 
     /* Make sure required options exist */
     if (!bookp) return NULL;
 
-    ew = gnc_employee_new_window (bookp, NULL);
+    ew = gnc_employee_new_window (parent, bookp, NULL);
 
     return ew;
 }
 
 EmployeeWindow *
-gnc_ui_employee_edit (GncEmployee *employee)
+gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee)
 {
     EmployeeWindow *ew;
 
     if (!employee) return NULL;
 
-    ew = gnc_employee_new_window (gncEmployeeGetBook(employee), employee);
+    ew = gnc_employee_new_window (parent, gncEmployeeGetBook(employee), employee);
 
     return ew;
 }
@@ -630,7 +634,7 @@ payment_employee_cb (gpointer *employee_p, gpointer user_data)
         return;
 
     gncOwnerInitEmployee (&owner, employee);
-    gnc_ui_payment_new (&owner, sw->book);
+    gnc_ui_payment_new (NULL, &owner, sw->book);
     return;
 }
 
@@ -646,7 +650,7 @@ edit_employee_cb (gpointer *employee_p, gpointer user_data)
     if (!employee)
         return;
 
-    gnc_ui_employee_edit (employee);
+    gnc_ui_employee_edit (NULL, employee);
     return;
 }
 
@@ -658,7 +662,7 @@ new_employee_cb (gpointer user_data)
 
     g_return_val_if_fail (user_data, NULL);
 
-    ew = gnc_ui_employee_new (sw->book);
+    ew = gnc_ui_employee_new (NULL, sw->book);
     return ew_get_employee (ew);
 }
 
@@ -751,7 +755,7 @@ GNCSearchWindow *
 gnc_employee_search_edit (gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_employee_edit (start);
+        gnc_ui_employee_edit (NULL, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-employee.h b/gnucash/gnome/dialog-employee.h
index d61647e..65551a9 100644
--- a/gnucash/gnome/dialog-employee.h
+++ b/gnucash/gnome/dialog-employee.h
@@ -31,8 +31,8 @@ typedef struct _employee_window EmployeeWindow;
 #include "dialog-search.h"
 
 /* Functions to edit and create employees */
-EmployeeWindow * gnc_ui_employee_edit (GncEmployee *employee);
-EmployeeWindow * gnc_ui_employee_new (QofBook *book);
+EmployeeWindow * gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee);
+EmployeeWindow * gnc_ui_employee_new (GtkWindow *parent, QofBook *book);
 
 /* Search for an employee */
 GNCSearchWindow * gnc_employee_search (GncEmployee *start, QofBook *book);
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index f799d4e..efeee18 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -207,7 +207,6 @@ struct _invoice_window
 };
 
 /* Forward definitions for CB functions */
-void gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data);
 gboolean gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data);
 DialogQueryView *gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_advance, GncWhichDueType duetype);
@@ -217,7 +216,7 @@ DialogQueryView *gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, do
 #define VOUCHER_WIDTH_PREFIX "voucher_reg"
 
 static void gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget);
-static InvoiceWindow * gnc_ui_invoice_modify (GncInvoice *invoice);
+static InvoiceWindow * gnc_ui_invoice_modify (GtkWindow *parent, GncInvoice *invoice);
 
 /*******************************************************************************/
 /* FUNCTIONS FOR ACCESSING DATA STRUCTURE FIELDS */
@@ -450,7 +449,7 @@ gnc_invoice_window_ok_cb (GtkWidget *widget, gpointer data)
      */
     if ((iw->dialog_type == NEW_INVOICE || iw->dialog_type == DUP_INVOICE)
             && iw->created_invoice)
-        gnc_ui_invoice_edit (iw->created_invoice);
+        gnc_ui_invoice_edit (gnc_ui_get_main_window (iw->dialog), iw->created_invoice);
 
     gnc_close_gui_component (iw->component_id);
 }
@@ -495,29 +494,23 @@ gnc_invoice_window_destroy_cb (GtkWidget *widget, gpointer data)
 }
 
 void
-gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data)
-{
-    gnc_invoice_window_ok_cb (widget, data);
-}
-
-void
-gnc_invoice_window_editCB (GtkWidget *widget, gpointer data)
+gnc_invoice_window_editCB (GtkWindow *parent, gpointer data)
 {
     InvoiceWindow *iw = data;
     GncInvoice *invoice = iw_get_invoice (iw);
 
     if (invoice)
-        gnc_ui_invoice_modify (invoice);
+        gnc_ui_invoice_modify (parent, invoice);
 }
 
 void
-gnc_invoice_window_duplicateInvoiceCB (GtkWidget *widget, gpointer data)
+gnc_invoice_window_duplicateInvoiceCB (GtkWindow *parent, gpointer data)
 {
     InvoiceWindow *iw = data;
     GncInvoice *invoice = iw_get_invoice (iw);
 
     if (invoice)
-        gnc_ui_invoice_duplicate (invoice, TRUE, NULL);
+        gnc_ui_invoice_duplicate (parent, invoice, TRUE, NULL);
 }
 
 void gnc_invoice_window_entryUpCB (GtkWidget *widget, gpointer data)
@@ -648,7 +641,7 @@ gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data)
 }
 
 static void
-gnc_invoice_window_print_invoice(GncInvoice *invoice)
+gnc_invoice_window_print_invoice(GtkWindow *parent, GncInvoice *invoice)
 {
     SCM func, arg, arg2;
     SCM args = SCM_EOL;
@@ -674,13 +667,13 @@ gnc_invoice_window_print_invoice(GncInvoice *invoice)
 
     /* scm_gc_unprotect_object(func); */
     if (report_id >= 0)
-        reportWindow (report_id);
+        reportWindow (report_id, parent);
 }
 void
-gnc_invoice_window_printCB (GtkWidget *unused_widget, gpointer data)
+gnc_invoice_window_printCB (GtkWindow* parent, gpointer data)
 {
     InvoiceWindow *iw = data;
-    gnc_invoice_window_print_invoice(iw_get_invoice (iw));
+    gnc_invoice_window_print_invoice (parent, iw_get_invoice (iw));
 }
 
 static gboolean
@@ -1028,20 +1021,20 @@ void gnc_invoice_window_paste_cb (GtkWidget *widget, gpointer data)
     gnucash_register_paste_clipboard (iw->reg);
 }
 
-void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data)
+void gnc_invoice_window_new_invoice_cb (GtkWindow *parent, gpointer data)
 {
     InvoiceWindow *iw = data;
     if (gncOwnerGetJob (&iw->job))
     {
-        gnc_ui_invoice_new (&iw->job, iw->book);
+        gnc_ui_invoice_new (parent, &iw->job, iw->book);
     }
     else
     {
-        gnc_ui_invoice_new (&iw->owner, iw->book);
+        gnc_ui_invoice_new (parent, &iw->owner, iw->book);
     }
 }
 
-void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
+void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account *acc)
 {
     int id;
     SCM args;
@@ -1079,24 +1072,24 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
     id = scm_to_int (arg);
 
     if (id >= 0)
-        reportWindow (id);
+        reportWindow (id, parent);
 }
 
-void gnc_invoice_window_report_owner_cb (GtkWidget *widget, gpointer data)
+void gnc_invoice_window_report_owner_cb (GtkWindow *parent, gpointer data)
 {
     InvoiceWindow *iw = data;
-    gnc_business_call_owner_report (&iw->owner, NULL);
+    gnc_business_call_owner_report (parent, &iw->owner, NULL);
 }
 
-void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data)
+void gnc_invoice_window_payment_cb (GtkWindow *parent, gpointer data)
 {
     InvoiceWindow *iw = data;
     GncInvoice *invoice = iw_get_invoice(iw);
 
     if (gncOwnerGetJob (&iw->job))
-        gnc_ui_payment_new_with_invoice (&iw->job, iw->book, invoice);
+        gnc_ui_payment_new_with_invoice (parent, &iw->job, iw->book, invoice);
     else
-        gnc_ui_payment_new_with_invoice (&iw->owner, iw->book, invoice);
+        gnc_ui_payment_new_with_invoice (parent, &iw->owner, iw->book, invoice);
 }
 
 /* Sorting callbacks */
@@ -2456,7 +2449,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
 }
 
 static InvoiceWindow *
-gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
+gnc_invoice_window_new_invoice (GtkWindow *parent, InvoiceDialogType dialog_type, QofBook *bookp,
                                 const GncOwner *owner, GncInvoice *invoice)
 {
     InvoiceWindow *iw;
@@ -2483,6 +2476,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
                                            find_handler, &invoice_guid);
         if (iw)
         {
+            gtk_window_set_transient_for (GTK_WINDOW(iw->dialog), parent);
             gtk_window_present (GTK_WINDOW(iw->dialog));
             return(iw);
         }
@@ -2542,6 +2536,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
     gnc_builder_add_from_file (builder, "dialog-invoice.glade", "terms_store");
     gnc_builder_add_from_file (builder, "dialog-invoice.glade", "new_invoice_dialog");
     iw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "new_invoice_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(iw->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(iw->dialog), "GncInvoiceDialog");
@@ -2672,7 +2667,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
 }
 
 InvoiceWindow *
-gnc_ui_invoice_edit (GncInvoice *invoice)
+gnc_ui_invoice_edit (GtkWindow *parent, GncInvoice *invoice)
 {
     InvoiceWindow *iw;
     InvoiceDialogType type;
@@ -2686,18 +2681,18 @@ gnc_ui_invoice_edit (GncInvoice *invoice)
         type = EDIT_INVOICE;
 
     iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
-                               invoice, gncInvoiceGetOwner (invoice), NULL);
+                               invoice, gncInvoiceGetOwner (invoice), GNC_MAIN_WINDOW(parent));
 
     return iw;
 }
 
 static InvoiceWindow *
-gnc_ui_invoice_modify (GncInvoice *invoice)
+gnc_ui_invoice_modify (GtkWindow *parent, GncInvoice *invoice)
 {
     InvoiceWindow *iw;
     if (!invoice) return NULL;
 
-    iw = gnc_invoice_window_new_invoice (MOD_INVOICE, NULL, NULL, invoice);
+    iw = gnc_invoice_window_new_invoice (parent, MOD_INVOICE, NULL, NULL, invoice);
     return iw;
 }
 
@@ -2715,7 +2710,7 @@ set_gncEntry_date(gpointer data, gpointer user_data)
 }
 
 
-InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open_properties, const GDate *new_date)
+InvoiceWindow * gnc_ui_invoice_duplicate (GtkWindow *parent, GncInvoice *old_invoice, gboolean open_properties, const GDate *new_date)
 {
     InvoiceWindow *iw = NULL;
     GncInvoice *new_invoice = NULL;
@@ -2764,12 +2759,12 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
     if (open_properties)
     {
         // Open the "properties" pop-up for the invoice...
-        iw = gnc_invoice_window_new_invoice (DUP_INVOICE, NULL, NULL, new_invoice);
+        iw = gnc_invoice_window_new_invoice (parent, DUP_INVOICE, NULL, NULL, new_invoice);
     }
     else
     {
          // Open the newly created invoice in the "edit" window
-        iw = gnc_ui_invoice_edit (new_invoice);
+        iw = gnc_ui_invoice_edit (parent, new_invoice);
         // Check the ID; set one if necessary
         if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (iw->id_entry)), "") == 0)
         {
@@ -2780,22 +2775,22 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
 }
 
 InvoiceWindow *
-gnc_ui_invoice_new (GncOwner *ownerp, QofBook *bookp)
+gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook *book)
 {
     InvoiceWindow *iw;
-    GncOwner owner;
+    GncOwner inv_owner;
 
-    if (ownerp)
+    if (owner)
     {
-        gncOwnerCopy (ownerp, &owner);
+        gncOwnerCopy (owner, &inv_owner);
     }
     else
-        gncOwnerInitCustomer (&owner, NULL); /* XXX: pass in the owner type? */
+        gncOwnerInitCustomer (&inv_owner, NULL); /* XXX: pass in the owner type? */
 
     /* Make sure required options exist */
-    if (!bookp) return NULL;
+    if (!book) return NULL;
 
-    iw = gnc_invoice_window_new_invoice (NEW_INVOICE, bookp, &owner, NULL);
+    iw = gnc_invoice_window_new_invoice (parent, NEW_INVOICE, book, &inv_owner, NULL);
 
     return iw;
 }
@@ -2806,7 +2801,7 @@ static void
 edit_invoice_direct (gpointer invoice, gpointer user_data)
 {
     g_return_if_fail (invoice);
-    gnc_ui_invoice_edit (invoice);
+    gnc_ui_invoice_edit (NULL, invoice);
 }
 
 static void
@@ -2829,7 +2824,7 @@ pay_invoice_direct (gpointer inv, gpointer user_data)
     GncInvoice *invoice = inv;
 
     g_return_if_fail (invoice);
-    gnc_ui_payment_new_with_invoice (gncInvoiceGetOwner (invoice),
+    gnc_ui_payment_new_with_invoice (NULL, gncInvoiceGetOwner (invoice),
                                      gncInvoiceGetBook (invoice), invoice);
 }
 
@@ -2858,7 +2853,7 @@ static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
         // In this simplest form, we just use the existing duplication
         // algorithm, only without opening the "edit invoice" window for editing
         // the number etc. for each of the invoices.
-        InvoiceWindow *iw = gnc_ui_invoice_duplicate(old_invoice, FALSE, &dup_user_data->date);
+        InvoiceWindow *iw = gnc_ui_invoice_duplicate(NULL, old_invoice, FALSE, &dup_user_data->date);
         // FIXME: Now we could use this invoice and manipulate further data.
         g_assert(iw);
         new_invoice = iw_get_invoice(iw);
@@ -2878,7 +2873,7 @@ multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
     {
         // Duplicate exactly one invoice
         GncInvoice *old_invoice = invoice_list->data;
-        gnc_ui_invoice_duplicate(old_invoice, TRUE, NULL);
+        gnc_ui_invoice_duplicate(NULL, old_invoice, TRUE, NULL);
         return;
     }
     default:
@@ -2909,7 +2904,7 @@ static void post_one_invoice_cb(gpointer data, gpointer user_data)
 {
     GncInvoice *invoice = data;
     struct post_invoice_params *post_params = user_data;
-    InvoiceWindow *iw = gnc_ui_invoice_edit(invoice);
+    InvoiceWindow *iw = gnc_ui_invoice_edit(NULL, invoice);
     gnc_invoice_post(iw, post_params);
 }
 
@@ -2917,7 +2912,7 @@ static void gnc_invoice_is_posted(gpointer inv, gpointer test_value)
 {
     GncInvoice *invoice = inv;
     gboolean *test = (gboolean*)test_value;
-      
+
     if (gncInvoiceIsPosted (invoice))
     {
         *test = TRUE;
@@ -2935,7 +2930,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
     if (g_list_length(invoice_list) == 0)
         return;
     // Get the posting parameters for these invoices
-    iw = gnc_ui_invoice_edit(invoice_list->data);
+    iw = gnc_ui_invoice_edit(NULL, invoice_list->data);
     test = FALSE;
     gnc_suspend_gui_refresh (); // Turn off GUI refresh for the duration.
     // Check if any of the selected invoices have already been posted.
@@ -2947,7 +2942,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
                           _("One or more selected invoices have already been posted.\nRe-check your selection."));
         return;
     }
-    
+
     if (!gnc_dialog_post_invoice(iw, _("Do you really want to post these invoices?"),
                                  &post_params.ddue, &post_params.postdate,
                                  &post_params.memo, &post_params.acc,
@@ -2966,7 +2961,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
 static void print_one_invoice_cb(gpointer data, gpointer user_data)
 {
     GncInvoice *invoice = data;
-    gnc_invoice_window_print_invoice(invoice); // that's all!
+    gnc_invoice_window_print_invoice(NULL, invoice); // that's all!
 }
 
 static void
@@ -2986,7 +2981,7 @@ new_invoice_cb (gpointer user_data)
 
     g_return_val_if_fail (user_data, NULL);
 
-    iw = gnc_ui_invoice_new (sw->owner, sw->book);
+    iw = gnc_ui_invoice_new (NULL, sw->owner, sw->book);
     return iw_get_invoice (iw);
 }
 
diff --git a/gnucash/gnome/dialog-invoice.h b/gnucash/gnome/dialog-invoice.h
index 9823904..2fe4726 100644
--- a/gnucash/gnome/dialog-invoice.h
+++ b/gnucash/gnome/dialog-invoice.h
@@ -47,12 +47,12 @@ typedef enum
 
 
 /* Create and edit an invoice */
-InvoiceWindow * gnc_ui_invoice_edit (GncInvoice *invoice);
-InvoiceWindow * gnc_ui_invoice_new (GncOwner *owner, QofBook *book);
+InvoiceWindow * gnc_ui_invoice_edit (GtkWindow *parent, GncInvoice *invoice);
+InvoiceWindow * gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
 
 /** Create a new invoice as a duplicate of the given existing invoice.
  *
- * \param invoice The invoice which is being duplicated
+ * \param old_invoice The invoice which is being duplicated
  * \param open_properties If TRUE, open the "invoice properties" dialog window after creating the new invoice
  * \param new_date If non-NULL, use this date as the date for the "opening date" and also as date for all invoice entries.
  *
@@ -60,12 +60,12 @@ InvoiceWindow * gnc_ui_invoice_new (GncOwner *owner, QofBook *book);
  * among others the "created_invoice" as a GncInvoice* pointer on the newly
  * created invoice.
  */
-InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *invoice, gboolean open_properties, const GDate *new_date);
+InvoiceWindow* gnc_ui_invoice_duplicate (GtkWindow* parent, GncInvoice* old_invoice, gboolean open_properties, const GDate* new_date);
 
 /* Search for invoices */
 GNCSearchWindow * gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book);
 
-void gnc_business_call_owner_report (GncOwner *owner, Account *acc);
+void gnc_business_call_owner_report (GtkWindow* parent, GncOwner *owner, Account *acc);
 
 void gnc_invoice_window_sort (InvoiceWindow *iw, invoice_sort_type_t sort_code);
 
@@ -90,13 +90,13 @@ GtkWidget *gnc_invoice_get_register(InvoiceWindow *iw);
 /* definitions for CB functions */
 void gnc_invoice_window_destroy_cb (GtkWidget *widget, gpointer data);
 
-void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data);
-void gnc_invoice_window_printCB (GtkWidget *widget, gpointer data);
+void gnc_invoice_window_new_invoice_cb (GtkWindow* parent, gpointer data);
+void gnc_invoice_window_printCB (GtkWindow* parent, gpointer data);
 void gnc_invoice_window_cut_cb (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_copy_cb (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_paste_cb (GtkWidget *widget, gpointer data);
-void gnc_invoice_window_editCB (GtkWidget *widget, gpointer data);
-void gnc_invoice_window_duplicateInvoiceCB (GtkWidget *widget, gpointer data);
+void gnc_invoice_window_editCB (GtkWindow* parent, gpointer data);
+void gnc_invoice_window_duplicateInvoiceCB (GtkWindow* parent, gpointer data);
 void gnc_invoice_window_postCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_unpostCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_recordCB (GtkWidget *widget, gpointer data);
@@ -104,8 +104,8 @@ void gnc_invoice_window_cancelCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_deleteCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_duplicateCB (GtkWidget *widget, gpointer data);
-void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data);
-void gnc_invoice_window_report_owner_cb (GtkWidget *widget, gpointer data);
+void gnc_invoice_window_payment_cb (GtkWindow *parent, gpointer data);
+void gnc_invoice_window_report_owner_cb (GtkWindow *parent, gpointer data);
 
 void gnc_invoice_window_entryUpCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_entryDownCB (GtkWidget *widget, gpointer data);
diff --git a/gnucash/gnome/dialog-job.c b/gnucash/gnome/dialog-job.c
index bc9ef54..32acf7c 100644
--- a/gnucash/gnome/dialog-job.c
+++ b/gnucash/gnome/dialog-job.c
@@ -302,7 +302,7 @@ find_handler (gpointer find_data, gpointer user_data)
 }
 
 static JobWindow *
-gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
+gnc_job_new_window (GtkWindow *parent, QofBook *bookp, GncOwner *owner, GncJob *job)
 {
     JobWindow *jw;
     GtkBuilder *builder;
@@ -321,6 +321,7 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
                                            find_handler, &job_guid);
         if (jw)
         {
+            gtk_window_set_transient_for (GTK_WINDOW(jw->dialog), parent);
             gtk_window_present (GTK_WINDOW(jw->dialog));
             return(jw);
         }
@@ -339,6 +340,7 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
 
     /* Find the dialog */
     jw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "job_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(jw->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(jw->dialog), "GncJobDialog");
@@ -433,17 +435,8 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
     return jw;
 }
 
-GncJob *
-gnc_ui_job_new_return_handle (GncOwner *owner, QofBook *book)
-{
-    JobWindow *jw;
-    if (!book) return NULL;
-    jw = gnc_ui_job_new (owner, book);
-    return jw_get_job (jw);
-}
-
 JobWindow *
-gnc_ui_job_new (GncOwner *ownerp, QofBook *bookp)
+gnc_ui_job_new (GtkWindow *parent, GncOwner *ownerp, QofBook *bookp)
 {
     JobWindow *jw;
     GncOwner owner;
@@ -461,18 +454,18 @@ gnc_ui_job_new (GncOwner *ownerp, QofBook *bookp)
     else
         gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-    jw = gnc_job_new_window (bookp, &owner, NULL);
+    jw = gnc_job_new_window (parent, bookp, &owner, NULL);
     return jw;
 }
 
 JobWindow *
-gnc_ui_job_edit (GncJob *job)
+gnc_ui_job_edit (GtkWindow *parent, GncJob *job)
 {
     JobWindow *jw;
 
     if (!job) return NULL;
 
-    jw = gnc_job_new_window (gncJobGetBook(job), gncJobGetOwner(job), job);
+    jw = gnc_job_new_window (parent, gncJobGetBook(job), gncJobGetOwner(job), job);
     return jw;
 }
 
@@ -490,7 +483,7 @@ edit_job_cb (gpointer *job_p, gpointer user_data)
     if (!job)
         return;
 
-    gnc_ui_job_edit (job);
+    gnc_ui_job_edit (NULL, job);
 }
 
 static void
@@ -525,7 +518,7 @@ payment_job_cb (gpointer *job_p, gpointer user_data)
         return;
 
     gncOwnerInitJob (&owner, job);
-    gnc_ui_payment_new (&owner, sw->book);
+    gnc_ui_payment_new (NULL, &owner, sw->book);
     return;
 }
 
@@ -537,7 +530,7 @@ new_job_cb (gpointer user_data)
 
     g_return_val_if_fail (user_data, NULL);
 
-    jw = gnc_ui_job_new (sw->owner, sw->book);
+    jw = gnc_ui_job_new (NULL, sw->owner, sw->book);
     return jw_get_job (jw);
 }
 
@@ -679,7 +672,7 @@ GNCSearchWindow *
 gnc_job_search_edit (gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_job_edit (start);
+        gnc_ui_job_edit (NULL, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-job.h b/gnucash/gnome/dialog-job.h
index 40da5d8..864e51a 100644
--- a/gnucash/gnome/dialog-job.h
+++ b/gnucash/gnome/dialog-job.h
@@ -32,9 +32,8 @@ typedef struct _job_window JobWindow;
 #include "dialog-search.h"
 
 /* Create or Edit a job */
-GncJob * gnc_ui_job_new_return_handle (GncOwner *owner, QofBook *book);
-JobWindow * gnc_ui_job_edit (GncJob *job);
-JobWindow * gnc_ui_job_new (GncOwner *owner, QofBook *book);
+JobWindow * gnc_ui_job_edit (GtkWindow *parent, GncJob *job);
+JobWindow * gnc_ui_job_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
 
 /* Search for Jobs */
 GNCSearchWindow * gnc_job_search (GncJob *start, GncOwner *owner,
diff --git a/gnucash/gnome/dialog-order.c b/gnucash/gnome/dialog-order.c
index 34e7ad0..d3728c1 100644
--- a/gnucash/gnome/dialog-order.c
+++ b/gnucash/gnome/dialog-order.c
@@ -539,7 +539,7 @@ find_handler (gpointer find_data, gpointer user_data)
 }
 
 static OrderWindow *
-gnc_order_new_window (QofBook *bookp, OrderDialogType type,
+gnc_order_new_window (GtkWindow *parent, QofBook *bookp, OrderDialogType type,
                       GncOrder *order, GncOwner *owner)
 {
     OrderWindow *ow;
@@ -573,6 +573,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
         if (ow)
         {
             gtk_window_present (GTK_WINDOW(ow->dialog));
+            gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
             return(ow);
         }
     }
@@ -591,6 +592,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-order.glade", "order_entry_dialog");
     ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "order_entry_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
@@ -683,7 +685,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
 }
 
 static OrderWindow *
-gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
+gnc_order_window_new_order (GtkWindow *parent, QofBook *bookp, GncOwner *owner)
 {
     OrderWindow *ow;
     GtkBuilder *builder;
@@ -706,6 +708,7 @@ gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
     gnc_builder_add_from_file (builder, "dialog-order.glade", "new_order_dialog");
 
     ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_order_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
@@ -759,7 +762,7 @@ gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
 }
 
 OrderWindow *
-gnc_ui_order_edit (GncOrder *order)
+gnc_ui_order_edit (GtkWindow *parent, GncOrder *order)
 {
     OrderWindow *ow;
     OrderDialogType type;
@@ -773,14 +776,14 @@ gnc_ui_order_edit (GncOrder *order)
             type = VIEW_ORDER;
     }
 
-    ow = gnc_order_new_window (gncOrderGetBook(order), type, order,
+    ow = gnc_order_new_window (parent, gncOrderGetBook(order), type, order,
                                gncOrderGetOwner (order));
 
     return ow;
 }
 
 OrderWindow *
-gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
+gnc_ui_order_new (GtkWindow *parent, GncOwner *ownerp, QofBook *bookp)
 {
     OrderWindow *ow;
     GncOwner owner;
@@ -806,7 +809,7 @@ gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
     /* Make sure required options exist */
     if (!bookp) return NULL;
 
-    ow = gnc_order_window_new_order (bookp, &owner);
+    ow = gnc_order_window_new_order (parent, bookp, &owner);
 
     return ow;
 }
@@ -823,7 +826,7 @@ edit_order_cb (gpointer *order_p, gpointer user_data)
     order = *order_p;
 
     if (order)
-        gnc_ui_order_edit (order);
+        gnc_ui_order_edit (NULL, order);
 
     return;
 }
@@ -836,7 +839,7 @@ new_order_cb (gpointer user_data)
 
     g_return_val_if_fail (user_data, NULL);
 
-    ow = gnc_ui_order_new (sw->owner, sw->book);
+    ow = gnc_ui_order_new (NULL, sw->owner, sw->book);
     return ow_get_order (ow);
 }
 
@@ -980,7 +983,7 @@ GNCSearchWindow *
 gnc_order_search_edit (gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_order_edit (start);
+        gnc_ui_order_edit (NULL, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-order.h b/gnucash/gnome/dialog-order.h
index 2398235..a02e19e 100644
--- a/gnucash/gnome/dialog-order.h
+++ b/gnucash/gnome/dialog-order.h
@@ -32,8 +32,8 @@ typedef struct _order_window OrderWindow;
 #include "dialog-search.h"
 
 /* Create and edit an order */
-OrderWindow * gnc_ui_order_edit (GncOrder *order);
-OrderWindow * gnc_ui_order_new (GncOwner *owner, QofBook *book);
+OrderWindow * gnc_ui_order_edit (GtkWindow *parent, GncOrder *order);
+OrderWindow * gnc_ui_order_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
 
 /* Search for orders */
 GNCSearchWindow * gnc_order_search (GncOrder *start, GncOwner *owner,
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 89557ea..e11d07a 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1117,7 +1117,7 @@ static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
 }
 
 static PaymentWindow *
-new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_info)
+new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_info)
 {
     PaymentWindow *pw;
     GtkBuilder *builder;
@@ -1154,6 +1154,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
         gncOwnerCopy (&pw->tx_info->owner, &(pw->owner));
         gnc_payment_set_owner_type (pw, gncOwnerGetType(&pw->tx_info->owner));
 
+        gtk_window_set_transient_for (GTK_WINDOW(pw->dialog), parent);
         gtk_window_present (GTK_WINDOW(pw->dialog));
         return(pw);
     }
@@ -1173,6 +1174,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
     gnc_builder_add_from_file (builder, "dialog-payment.glade", "owner_type_combo_model");
     gnc_builder_add_from_file (builder, "dialog-payment.glade", "payment_dialog");
     pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(pw->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(pw->dialog), "GncPaymentDialog");
@@ -1364,8 +1366,8 @@ gnc_ui_payment_window_destroy (PaymentWindow *pw)
 }
 
 PaymentWindow *
-gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
-                                 GncInvoice *invoice)
+gnc_ui_payment_new_with_invoice (GtkWindow *parent, const GncOwner *owner,
+                                 QofBook *book, GncInvoice *invoice)
 {
     GNCLot *postlot;
     InitialPaymentInfo *tx_info;
@@ -1395,13 +1397,13 @@ gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
         lot_info->amount = gnc_numeric_zero ();
         tx_info->lots = g_list_prepend (tx_info->lots, lot_info);
     }
-    return new_payment_window (NULL, book, tx_info);
+    return new_payment_window (parent, book, tx_info);
 }
 
 PaymentWindow *
-gnc_ui_payment_new (GncOwner *owner, QofBook *book)
+gnc_ui_payment_new (GtkWindow *parent, GncOwner *owner, QofBook *book)
 {
-    return gnc_ui_payment_new_with_invoice (owner, book, NULL);
+    return gnc_ui_payment_new_with_invoice (parent, owner, book, NULL);
 }
 
 // ///////////////
@@ -1477,7 +1479,7 @@ static char *gen_split_desc (Transaction *txn, Split *split)
     return split_str;
 }
 
-static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
+static Split *select_payment_split (GtkWindow *parent, Transaction *txn)
 {
     /* We require the txn to have one split in an Asset account.
      * The only exception would be a lot link transaction
@@ -1490,7 +1492,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
         if (xaccTransGetTxnType(txn) == TXN_TYPE_LINK)
             return NULL;
 
-        dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+        dialog = gtk_message_dialog_new (parent,
                                          GTK_DIALOG_DESTROY_WITH_PARENT,
                                          GTK_MESSAGE_INFO,
                                          GTK_BUTTONS_CLOSE,
@@ -1513,7 +1515,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
                                 "Please select one, the others will be ignored.\n\n");
         GtkDialog *dialog = GTK_DIALOG(
                             gtk_dialog_new_with_buttons (_("Warning"),
-                                                         GTK_WINDOW(parent),
+                                                         parent,
                                                          GTK_DIALOG_DESTROY_WITH_PARENT,
                                                          _("Continue"), GTK_BUTTONS_OK,
                                                          _("Cancel"), GTK_BUTTONS_CANCEL,
@@ -1569,7 +1571,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
         return payment_splits->data;
 }
 
-static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **post_acct, gboolean *abort)
+static GList *select_txn_lots (GtkWindow *parent, Transaction *txn, Account **post_acct, gboolean *abort)
 {
     gboolean has_no_lot_apar_splits = FALSE;
     SplitList *post_splits = NULL, *no_lot_post_splits = NULL;
@@ -1624,7 +1626,7 @@ static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **po
             split_str = tmp_str2;
         }
 
-        dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+        dialog = gtk_message_dialog_new (parent,
                                          GTK_DIALOG_DESTROY_WITH_PARENT,
                                          GTK_MESSAGE_WARNING,
                                          GTK_BUTTONS_CANCEL,
@@ -1648,7 +1650,7 @@ static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **po
     return txn_lots;
 }
 
-PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWindow* parent, GncOwner *owner, Transaction *txn)
 {
     Split *payment_split = NULL;
     Account *post_acct = NULL;
@@ -1682,7 +1684,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
     tx_info->lots = txn_lots;
     gncOwnerCopy (owner, &tx_info->owner);
 
-    pw = new_payment_window (NULL,
+    pw = new_payment_window (parent,
                             qof_instance_get_book(QOF_INSTANCE(txn)),
                             tx_info);
 
diff --git a/gnucash/gnome/dialog-payment.h b/gnucash/gnome/dialog-payment.h
index 49113da..9927f63 100644
--- a/gnucash/gnome/dialog-payment.h
+++ b/gnucash/gnome/dialog-payment.h
@@ -30,11 +30,12 @@ typedef struct _payment_window PaymentWindow;
 #include "gncInvoice.h"
 
 /* Create a payment window */
-PaymentWindow * gnc_ui_payment_new (GncOwner *owner, QofBook *book);
-PaymentWindow * gnc_ui_payment_new_with_invoice (const GncOwner *owner,
-        QofBook *book,
-        GncInvoice *invoice);
-PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget *parent, GncOwner *owner, Transaction *txn);
+PaymentWindow * gnc_ui_payment_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
+PaymentWindow * gnc_ui_payment_new_with_invoice (GtkWindow *parent,
+                                                 const GncOwner *owner,
+                                                 QofBook *book,
+                                                 GncInvoice *invoice);
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWindow *parent, GncOwner *owner, Transaction *txn);
 
 /** Returns TRUE if the given transaction (to be used with gnc_ui_payment_new_with_txn() )
  * is for a customer, or FALSE if it's from a vendor or employee voucher. */
diff --git a/gnucash/gnome/dialog-vendor.c b/gnucash/gnome/dialog-vendor.c
index 3eda233..4ffde76 100644
--- a/gnucash/gnome/dialog-vendor.c
+++ b/gnucash/gnome/dialog-vendor.c
@@ -395,7 +395,7 @@ find_handler (gpointer find_data, gpointer user_data)
 }
 
 static VendorWindow *
-gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
+gnc_vendor_new_window (GtkWindow *parent, QofBook *bookp, GncVendor *vendor)
 {
     VendorWindow *vw;
     GtkBuilder *builder;
@@ -415,6 +415,7 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
                                            find_handler, &vendor_guid);
         if (vw)
         {
+            gtk_window_set_transient_for (GTK_WINDOW(vw->dialog), parent);
             gtk_window_present (GTK_WINDOW(vw->dialog));
             return(vw);
         }
@@ -440,6 +441,7 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
     gnc_builder_add_from_file (builder, "dialog-vendor.glade", "taxtable_store");
     gnc_builder_add_from_file (builder, "dialog-vendor.glade", "vendor_dialog");
     vw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "vendor_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW(vw->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(vw->dialog), "GncVendorDialog");
@@ -559,25 +561,25 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
 }
 
 VendorWindow *
-gnc_ui_vendor_new (QofBook *bookp)
+gnc_ui_vendor_new (GtkWindow *parent, QofBook *bookp)
 {
     VendorWindow *vw;
 
     /* Make sure required options exist */
     if (!bookp) return NULL;
 
-    vw = gnc_vendor_new_window (bookp, NULL);
+    vw = gnc_vendor_new_window (parent, bookp, NULL);
     return vw;
 }
 
 VendorWindow *
-gnc_ui_vendor_edit (GncVendor *vendor)
+gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor)
 {
     VendorWindow *vw;
 
     if (!vendor) return NULL;
 
-    vw = gnc_vendor_new_window (gncVendorGetBook(vendor), vendor);
+    vw = gnc_vendor_new_window (parent, gncVendorGetBook(vendor), vendor);
 
     return vw;
 }
@@ -656,7 +658,7 @@ payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
         return;
 
     gncOwnerInitVendor (&owner, vendor);
-    gnc_ui_payment_new (&owner, sw->book);
+    gnc_ui_payment_new (NULL, &owner, sw->book);
     return;
 }
 
@@ -672,7 +674,7 @@ edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
     if (!vendor)
         return;
 
-    gnc_ui_vendor_edit (vendor);
+    gnc_ui_vendor_edit (NULL, vendor);
     return;
 }
 
@@ -684,7 +686,7 @@ new_vendor_cb (gpointer user_data)
 
     g_return_val_if_fail (user_data, NULL);
 
-    vw = gnc_ui_vendor_new (sw->book);
+    vw = gnc_ui_vendor_new (NULL, sw->book);
     return vw_get_vendor (vw);
 }
 
@@ -778,7 +780,7 @@ GNCSearchWindow *
 gnc_vendor_search_edit (gpointer start, gpointer book)
 {
     if (start)
-        gnc_ui_vendor_edit (start);
+        gnc_ui_vendor_edit (NULL, start);
 
     return NULL;
 }
diff --git a/gnucash/gnome/dialog-vendor.h b/gnucash/gnome/dialog-vendor.h
index fda57c4..a4a19be 100644
--- a/gnucash/gnome/dialog-vendor.h
+++ b/gnucash/gnome/dialog-vendor.h
@@ -31,8 +31,8 @@ typedef struct _vendor_window VendorWindow;
 #include "dialog-search.h"
 
 /* Create or Edit Vendors */
-VendorWindow * gnc_ui_vendor_edit (GncVendor *vendor);
-VendorWindow * gnc_ui_vendor_new (QofBook *book);
+VendorWindow * gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor);
+VendorWindow * gnc_ui_vendor_new (GtkWindow *parent, QofBook *book);
 
 /* Search for vendors */
 GNCSearchWindow * gnc_vendor_search (GncVendor *start, QofBook *book);
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index b4fd61d..a0356f9 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -471,7 +471,7 @@ gnc_plugin_business_cmd_customer_new_customer (GtkAction *action,
     g_return_if_fail (mw != NULL);
     g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-    gnc_ui_customer_new (gnc_get_current_book());
+    gnc_ui_customer_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
 }
 
 static void
@@ -504,7 +504,7 @@ gnc_plugin_business_cmd_customer_new_invoice (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
+    gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
 }
 
 static void
@@ -535,7 +535,7 @@ gnc_plugin_business_cmd_customer_new_job (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
+    gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
 }
 
 static void
@@ -565,7 +565,7 @@ gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
+    gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
 }
 
 static void
@@ -588,7 +588,7 @@ gnc_plugin_business_cmd_vendor_new_vendor (GtkAction *action,
     g_return_if_fail (mw != NULL);
     g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-    gnc_ui_vendor_new (gnc_get_current_book());
+    gnc_ui_vendor_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
 }
 
 static void
@@ -621,7 +621,7 @@ gnc_plugin_business_cmd_vendor_new_bill (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
+    gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
 }
 
 static void
@@ -652,7 +652,7 @@ gnc_plugin_business_cmd_vendor_new_job (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
+    gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
 }
 
 static void
@@ -682,7 +682,7 @@ gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
+    gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
 }
 
 static void
@@ -705,7 +705,7 @@ gnc_plugin_business_cmd_employee_new_employee (GtkAction *action,
     g_return_if_fail (mw != NULL);
     g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-    gnc_ui_employee_new (gnc_get_current_book());
+    gnc_ui_employee_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
 }
 
 static void
@@ -738,7 +738,7 @@ gnc_plugin_business_cmd_employee_new_expense_voucher (GtkAction *action,
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
     last_window = mw->window;
-    gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
+    gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
 }
 
 static void
@@ -769,7 +769,7 @@ gnc_plugin_business_cmd_employee_process_payment (GtkAction *action,
 
     plugin = GNC_PLUGIN_BUSINESS (mw->data);
     priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-    gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
+    gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
 }
 
 static void
@@ -821,7 +821,7 @@ gnc_plugin_business_cmd_test_search (GtkAction *action,
     gnc_search_dialog_test();
 }
 
-static void gnc_business_assign_payment (GtkWidget *parent,
+static void gnc_business_assign_payment (GtkWindow *parent,
         Transaction *trans,
         GncOwner *owner)
 {
@@ -883,7 +883,7 @@ static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
     else
         owner_p = plugin_business_priv->last_vendor;
 
-    gnc_business_assign_payment (gnc_plugin_page_get_window(plugin_page),
+    gnc_business_assign_payment (GTK_WINDOW (mw->window),
                                  trans, owner_p);
 }
 
@@ -1019,7 +1019,7 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action,
     gnc_account_append_child(root, tax_acct);
 
     // Launch the invoice editor
-    gnc_ui_invoice_edit(invoice);
+    gnc_ui_invoice_edit (GTK_WINDOW (data->window), invoice);
 }
 
 /* This is the list of actions which are switched inactive in a read-only book. */
diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
index c3622e6..ced56d3 100644
--- a/gnucash/gnome/gnc-plugin-page-invoice.c
+++ b/gnucash/gnome/gnc-plugin-page-invoice.c
@@ -648,12 +648,14 @@ gnc_plugin_page_invoice_cmd_new_invoice (GtkAction *action,
         GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_new_invoice_cb(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_new_invoice_cb(parent, priv->iw);
     LEAVE(" ");
 }
 
@@ -673,12 +675,14 @@ gnc_plugin_page_invoice_cmd_print (GtkAction *action,
                                    GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_printCB(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_printCB (parent, priv->iw);
     LEAVE(" ");
 }
 
@@ -729,12 +733,14 @@ gnc_plugin_page_invoice_cmd_edit (GtkAction *action,
                                   GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_editCB(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_editCB (parent, priv->iw);
     LEAVE(" ");
 }
 
@@ -743,12 +749,14 @@ gnc_plugin_page_invoice_cmd_duplicateInvoice (GtkAction *action,
         GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_duplicateInvoiceCB(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_duplicateInvoiceCB(parent, priv->iw);
     LEAVE(" ");
 }
 
@@ -906,12 +914,14 @@ gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action,
         GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_payment_cb(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_payment_cb (parent, priv->iw);
     LEAVE(" ");
 }
 
@@ -920,12 +930,14 @@ gnc_plugin_page_invoice_cmd_company_report (GtkAction *action,
         GncPluginPageInvoice *plugin_page)
 {
     GncPluginPageInvoicePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
     priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-    gnc_invoice_window_report_owner_cb(NULL, priv->iw);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
+    gnc_invoice_window_report_owner_cb (parent, priv->iw);
     LEAVE(" ");
 }
 
diff --git a/gnucash/gnome/gnc-plugin-page-owner-tree.c b/gnucash/gnome/gnc-plugin-page-owner-tree.c
index 80416a8..e9097ed 100644
--- a/gnucash/gnome/gnc-plugin-page-owner-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-owner-tree.c
@@ -775,7 +775,7 @@ gnc_plugin_page_owner_tree_recreate_page (GtkWidget *window,
 }
 
 /* Wrapper function to open the proper edit dialog, depending on the owner type */
-static void gnc_ui_owner_edit (GncOwner *owner)
+static void gnc_ui_owner_edit (GtkWindow *parent, GncOwner *owner)
 {
     if (NULL == owner) return;
 
@@ -786,22 +786,22 @@ static void gnc_ui_owner_edit (GncOwner *owner)
         break;
     case GNC_OWNER_CUSTOMER :
     {
-        gnc_ui_customer_edit (owner->owner.customer);
+        gnc_ui_customer_edit (parent, owner->owner.customer);
         break;
     }
     case GNC_OWNER_JOB :
     {
-        gnc_ui_job_edit (owner->owner.job);
+        gnc_ui_job_edit (parent, owner->owner.job);
         break;
     }
     case GNC_OWNER_VENDOR :
     {
-        gnc_ui_vendor_edit (owner->owner.vendor);
+        gnc_ui_vendor_edit (parent, owner->owner.vendor);
         break;
     }
     case GNC_OWNER_EMPLOYEE :
     {
-        gnc_ui_employee_edit (owner->owner.employee);
+        gnc_ui_employee_edit (parent, owner->owner.employee);
         break;
     }
     }
@@ -842,10 +842,12 @@ gnc_plugin_page_owner_tree_double_click_cb (GtkTreeView        *treeview,
         GncPluginPageOwnerTree *page)
 {
     GncOwner *owner;
+    GtkWindow *parent;
 
     g_return_if_fail (GNC_IS_PLUGIN_PAGE_OWNER_TREE (page));
     owner = gnc_tree_view_owner_get_owner_from_path (GNC_TREE_VIEW_OWNER(treeview), path);
-    gnc_ui_owner_edit (owner);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
+    gnc_ui_owner_edit (parent, owner);
 }
 
 static void
@@ -993,10 +995,12 @@ static void
 gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerTree *page)
 {
     GncPluginPageOwnerTreePrivate *priv;
+    GtkWindow *parent;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_OWNER_TREE(page));
 
     priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE (page);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
 
     switch (priv->owner_type)
     {
@@ -1005,7 +1009,7 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
         break;
     case GNC_OWNER_CUSTOMER :
     {
-        gnc_ui_customer_new (gnc_get_current_book ());
+        gnc_ui_customer_new (parent, gnc_get_current_book ());
         break;
     }
     case GNC_OWNER_JOB :
@@ -1016,12 +1020,12 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
     }
     case GNC_OWNER_VENDOR :
     {
-        gnc_ui_vendor_new (gnc_get_current_book ());
+        gnc_ui_vendor_new (parent, gnc_get_current_book ());
         break;
     }
     case GNC_OWNER_EMPLOYEE :
     {
-        gnc_ui_employee_new (gnc_get_current_book ());
+        gnc_ui_employee_new (parent, gnc_get_current_book ());
         break;
     }
     }
@@ -1030,12 +1034,14 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
 static void
 gnc_plugin_page_owner_tree_cmd_edit_owner (GtkAction *action, GncPluginPageOwnerTree *page)
 {
+    GtkWindow *parent;
     GncOwner *owner = gnc_plugin_page_owner_tree_get_current_owner (page);
     if (NULL == owner) return;
 
     ENTER("action %p, page %p", action, page);
 
-    gnc_ui_owner_edit (owner);
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
+    gnc_ui_owner_edit (parent, owner);
 
     LEAVE(" ");
 }
@@ -1132,6 +1138,7 @@ gnc_plugin_page_owner_tree_cmd_new_invoice (GtkAction *action,
 {
     GncPluginPageOwnerTreePrivate *priv;
     GncOwner current_owner;
+    GtkWindow *parent;
 
     ENTER("action %p, page %p", action, page);
 
@@ -1168,8 +1175,9 @@ gnc_plugin_page_owner_tree_cmd_new_invoice (GtkAction *action,
     }
     }
 
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     if (gncOwnerGetType(&current_owner) != GNC_OWNER_UNDEFINED)
-        gnc_ui_invoice_new (&current_owner, gnc_get_current_book());
+        gnc_ui_invoice_new (parent, &current_owner, gnc_get_current_book ());
 
     LEAVE(" ");
 }
diff --git a/gnucash/gnome/gtkbuilder/dialog-customer.glade b/gnucash/gnome/gtkbuilder/dialog-customer.glade
index 9e58fdf..39be977 100644
--- a/gnucash/gnome/gtkbuilder/dialog-customer.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-customer.glade
@@ -27,7 +27,6 @@
     </columns>
   </object>
   <object class="GtkDialog" id="customer_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">New Customer</property>
     <property name="type_hint">dialog</property>
diff --git a/gnucash/gnome/gtkbuilder/dialog-employee.glade b/gnucash/gnome/gtkbuilder/dialog-employee.glade
index c75e9c3..80647a4 100644
--- a/gnucash/gnome/gtkbuilder/dialog-employee.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-employee.glade
@@ -3,7 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="employee_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">New Employee</property>
     <property name="type_hint">dialog</property>
diff --git a/gnucash/gnome/gtkbuilder/dialog-invoice.glade b/gnucash/gnome/gtkbuilder/dialog-invoice.glade
index cb7315a..d06ffc1 100644
--- a/gnucash/gnome/gtkbuilder/dialog-invoice.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-invoice.glade
@@ -677,7 +677,6 @@
     </columns>
   </object>
   <object class="GtkDialog" id="new_invoice_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">New Invoice</property>
     <property name="type_hint">dialog</property>
@@ -1282,7 +1281,6 @@
     </action-widgets>
   </object>
   <object class="GtkDialog" id="unpost_message_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
diff --git a/gnucash/gnome/gtkbuilder/dialog-job.glade b/gnucash/gnome/gtkbuilder/dialog-job.glade
index fb2c746..9326aa6 100644
--- a/gnucash/gnome/gtkbuilder/dialog-job.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-job.glade
@@ -3,7 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="job_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Job Dialog</property>
     <property name="resizable">False</property>
@@ -232,11 +231,11 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="labelrate">
+                          <object class="GtkLabel" id="label4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">end</property>
-                            <property name="label" translatable="yes">Rate</property>
+                            <property name="label" translatable="yes">Billing ID</property>
                             <property name="justify">right</property>
                           </object>
                           <packing>
@@ -246,11 +245,11 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label4">
+                          <object class="GtkLabel" id="labelrate">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">end</property>
-                            <property name="label" translatable="yes">Billing ID</property>
+                            <property name="label" translatable="yes">Rate</property>
                             <property name="justify">right</property>
                           </object>
                           <packing>
@@ -288,30 +287,30 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkBox" id="rate_entry">
+                          <object class="GtkEntry" id="desc_entry">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <placeholder/>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">●</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">True</property>
+                            <property name="fill">False</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkEntry" id="desc_entry">
+                          <object class="GtkBox" id="rate_entry">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="invisible_char">●</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
diff --git a/gnucash/gnome/gtkbuilder/dialog-order.glade b/gnucash/gnome/gtkbuilder/dialog-order.glade
index 5f64135..f1f584d 100644
--- a/gnucash/gnome/gtkbuilder/dialog-order.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-order.glade
@@ -4,7 +4,6 @@
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkTextBuffer" id="notes_buffer"/>
   <object class="GtkDialog" id="order_entry_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Order Entry</property>
     <property name="default_width">950</property>
@@ -526,7 +525,6 @@
   </object>
   <object class="GtkTextBuffer" id="text_buffer"/>
   <object class="GtkDialog" id="new_order_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">New Order</property>
     <property name="type_hint">dialog</property>
diff --git a/gnucash/gnome/gtkbuilder/dialog-payment.glade b/gnucash/gnome/gtkbuilder/dialog-payment.glade
index b946e15..daf839c 100644
--- a/gnucash/gnome/gtkbuilder/dialog-payment.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-payment.glade
@@ -57,7 +57,6 @@
     </columns>
   </object>
   <object class="GtkDialog" id="payment_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Process Payment</property>
     <property name="default_height">560</property>
diff --git a/gnucash/gnome/gtkbuilder/dialog-vendor.glade b/gnucash/gnome/gtkbuilder/dialog-vendor.glade
index 40fcd1a..15643d3 100644
--- a/gnucash/gnome/gtkbuilder/dialog-vendor.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-vendor.glade
@@ -27,7 +27,6 @@
     </columns>
   </object>
   <object class="GtkDialog" id="vendor_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">New Vendor</property>
     <property name="type_hint">dialog</property>
diff --git a/gnucash/gnome/top-level.c b/gnucash/gnome/top-level.c
index 61d793d..16d7f49 100644
--- a/gnucash/gnome/top-level.c
+++ b/gnucash/gnome/top-level.c
@@ -183,7 +183,7 @@ gnc_html_register_url_cb (const char *location, const char *label,
     }
 
     page = gnc_plugin_page_register_new (account, FALSE);
-    gnc_main_window_open_page (NULL, page);
+    gnc_main_window_open_page (GNC_MAIN_WINDOW (result->parent), page);
     if (split)
     {
         gsr = gnc_plugin_page_register_get_gsr(page);
@@ -213,7 +213,7 @@ gnc_html_price_url_cb (const char *location, const char *label,
         if (!validate_type("price-guid=", location, GNC_ID_PRICE, result, &guid, &entity))
             return FALSE;
 
-        if (!gnc_price_edit_by_guid (NULL, &guid))
+        if (!gnc_price_edit_by_guid (GTK_WIDGET (result->parent), &guid))
         {
             result->error_message = g_strdup_printf (_("No such price: %s"),
                                     location);
diff --git a/gnucash/html/gnc-html-webkit1.c b/gnucash/html/gnc-html-webkit1.c
index 908d165..4bba869 100644
--- a/gnucash/html/gnc-html-webkit1.c
+++ b/gnucash/html/gnc-html-webkit1.c
@@ -881,6 +881,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
         result.base_type = URL_TYPE_FILE;
         result.base_location = NULL;
         result.error_message = NULL;
+        result.parent = GTK_WINDOW (priv->base.parent);
 
         ok = url_handler( location, label, new_window, &result );
         if ( !ok )
diff --git a/gnucash/html/gnc-html-webkit2.c b/gnucash/html/gnc-html-webkit2.c
index 13d5207..5b88474 100644
--- a/gnucash/html/gnc-html-webkit2.c
+++ b/gnucash/html/gnc-html-webkit2.c
@@ -853,6 +853,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
           result.base_type = URL_TYPE_FILE;
           result.base_location = NULL;
           result.error_message = NULL;
+          result.parent = GTK_WINDOW (priv->base.parent);
 
           ok = url_handler( location, label, new_window, &result );
           if ( !ok )
diff --git a/gnucash/html/gnc-html.h b/gnucash/html/gnc-html.h
index 8f32a3b..ffb8aeb 100644
--- a/gnucash/html/gnc-html.h
+++ b/gnucash/html/gnc-html.h
@@ -67,6 +67,9 @@ typedef struct
     URLType base_type;
     gchar* base_location;
 
+    /* The window that triggered this URL request */
+    GtkWindow *parent;
+
     /* The following members are used if the handler fails (returns FALSE). */
     gchar* error_message;
 } GNCURLResult;
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 8ae4f9c..92ad615 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import-gui.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import-gui.c
@@ -44,6 +44,7 @@
 
 struct _bi_import_gui
 {
+    GtkWindow    *parent;
     GtkWidget    *dialog;
     GtkWidget    *tree_view;
     GtkWidget    *entryFilename;
@@ -81,7 +82,7 @@ static void gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar
 static QofLogModule UNUSED_VAR log_module = G_LOG_DOMAIN; //G_LOG_BUSINESS;
 
 BillImportGui *
-gnc_plugin_bi_import_showGUI(void)
+gnc_plugin_bi_import_showGUI (GtkWindow *parent)
 {
     BillImportGui *gui;
     GtkBuilder *builder;
@@ -96,6 +97,9 @@ gnc_plugin_bi_import_showGUI(void)
         // window found
         gui = g_list_nth_data (glist, 0);
         g_list_free (glist);
+
+        gtk_window_set_transient_for(GTK_WINDOW(gui->dialog), GTK_WINDOW(parent));
+        gui->parent = parent;
         gtk_window_present (GTK_WINDOW(gui->dialog));
         return gui;
     }
@@ -108,6 +112,8 @@ gnc_plugin_bi_import_showGUI(void)
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-bi-import-gui.glade", "bi_import_dialog");
     gui->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "bi_import_dialog"));
+    gtk_window_set_transient_for(GTK_WINDOW(gui->dialog), GTK_WINDOW(parent));
+    gui->parent = parent;
     gui->tree_view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview1"));
     gui->entryFilename = GTK_WIDGET(gtk_builder_get_object (builder, "entryFilename"));
 
@@ -208,7 +214,8 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
     if (res == RESULT_OK)
     {
         gnc_bi_import_fix_bis (gui->store, &n_fixed, &n_deleted, info, gui->type);
-        gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated, gui->type, gui->open_mode, info);
+        gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated,
+                                  gui->type, gui->open_mode, info, gui->parent);
         if (info->len > 0)
             gnc_info_dialog (GTK_WINDOW (gui->dialog), "%s", info->str);
         g_string_free( info, TRUE );
diff --git a/gnucash/import-export/bi-import/dialog-bi-import-gui.h b/gnucash/import-export/bi-import/dialog-bi-import-gui.h
index 0848437..b698ad7 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import-gui.h
+++ b/gnucash/import-export/bi-import/dialog-bi-import-gui.h
@@ -39,7 +39,7 @@ typedef struct _bi_import_gui BillImportGui;
 /**
  * File chooser
  */
-BillImportGui *gnc_plugin_bi_import_showGUI(void);
+BillImportGui *gnc_plugin_bi_import_showGUI(GtkWindow *parent);
 
 G_END_DECLS
 
diff --git a/gnucash/import-export/bi-import/dialog-bi-import.c b/gnucash/import-export/bi-import/dialog-bi-import.c
index 4587bcb..4fb5e74 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import.c
@@ -504,7 +504,8 @@ void
 gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
                           guint * n_invoices_created,
                           guint * n_invoices_updated,
-                          gchar * type, gchar * open_mode, GString * info)
+                          gchar * type, gchar * open_mode, GString * info,
+                          GtkWindow *parent)
 {
     gboolean valid;
     GtkTreeIter iter;
@@ -628,7 +629,6 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
             (*n_invoices_created)++;
             update = YES;
 
-            
             gncInvoiceCommitEdit (invoice);
         }
 // I want to warn the user that an existing billvoice exists, but not every
@@ -645,7 +645,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
             }
             if (update != YES)	// Pop up a dialog to ask if updates are the expected action
             {
-                dialog = gtk_message_dialog_new (NULL,
+                dialog = gtk_message_dialog_new (parent,
                                                  GTK_DIALOG_MODAL,
                                                  GTK_MESSAGE_ERROR,
                                                  GTK_BUTTONS_YES_NO,
@@ -840,7 +840,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
                 || (g_ascii_strcasecmp(open_mode, "NOT_POSTED") == 0
                     && strlen(date_posted) == 0))
         {
-            iw =  gnc_ui_invoice_edit (invoice);
+            iw =  gnc_ui_invoice_edit (parent, invoice);
             gnc_plugin_page_invoice_new (iw);
         }
 
diff --git a/gnucash/import-export/bi-import/dialog-bi-import.h b/gnucash/import-export/bi-import/dialog-bi-import.h
index f03af05..649b290 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import.h
+++ b/gnucash/import-export/bi-import/dialog-bi-import.h
@@ -68,7 +68,9 @@ void
 gnc_bi_import_fix_bis (GtkListStore *store, guint *fixed, guint *deleted, GString *info, gchar *type);
 
 void
-gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created, guint *n_invoices_updated,	gchar *type, gchar *open_mode, GString * info);
+gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created,
+                          guint *n_invoices_updated,	gchar *type, gchar *open_mode, GString * info,
+                          GtkWindow *parent);
 
 
 G_END_DECLS
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
index e3ccb3c..9087661 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
@@ -109,7 +109,7 @@ gnc_plugin_bi_import_cmd_test (GtkAction *action, GncMainWindowActionData *data)
     ENTER ("action %p, main window data %p", action, data);
     g_message ("bi_import");
 
-    gnc_plugin_bi_import_showGUI();
+    gnc_plugin_bi_import_showGUI(GTK_WINDOW(data->window));
 
     LEAVE (" ");
 }
diff --git a/gnucash/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c
index 9340224..d884df6 100644
--- a/gnucash/report/report-gnome/window-report.c
+++ b/gnucash/report/report-gnome/window-report.c
@@ -56,10 +56,10 @@
  ********************************************************************/
 
 void
-reportWindow(int report_id)
+reportWindow(int report_id, GtkWindow *parent)
 {
     gnc_set_busy_cursor (NULL, TRUE);
-    gnc_main_window_open_report(report_id, NULL);
+    gnc_main_window_open_report(report_id, GNC_MAIN_WINDOW(parent));
     gnc_unset_busy_cursor (NULL);
 }
 
@@ -324,7 +324,7 @@ gnc_html_options_url_cb (const char *location, const char *label,
             return FALSE;
         }
 
-        gnc_report_edit_options (report, NULL);
+        gnc_report_edit_options (report, GTK_WINDOW(result->parent));
 
         return TRUE;
     }
@@ -350,7 +350,7 @@ gnc_html_report_url_cb (const char *location, const char *label,
         char *url;
 
         url = gnc_build_url (URL_TYPE_REPORT, location, label);
-        gnc_main_window_open_report_url (url, NULL);
+        gnc_main_window_open_report_url (url, GNC_MAIN_WINDOW(result->parent));
         g_free (url);
 
         result->load_to_stream = FALSE;
diff --git a/gnucash/report/report-gnome/window-report.h b/gnucash/report/report-gnome/window-report.h
index 4e3e475..7d4371c 100644
--- a/gnucash/report/report-gnome/window-report.h
+++ b/gnucash/report/report-gnome/window-report.h
@@ -38,7 +38,7 @@ GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report, Gtk
 // called from multiple places
 // [gnome-business/dialog-invoice.c;gnome/window-register.c]; and
 // scm-exposed; 3-liner which calls gnc_main_window_open_report after handling busy-cursor.
-void       reportWindow(int id);
+void       reportWindow(int id, GtkWindow *parent);
 gboolean   gnc_report_edit_options(SCM report, GtkWindow *parent);
 // module[/plugin]-init
 void       gnc_report_init (void);

commit 8986795251691d2a3cb187f8f3c39ea3e6599663
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 16 17:47:10 2017 +0100

    Fix transient parent for SX since last run... at startup

diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
index a3889a2..7486daf 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.c
+++ b/gnucash/gnome/dialog-sx-since-last-run.c
@@ -41,6 +41,7 @@
 #include "dialog-sx-since-last-run.h"
 
 #include "gnc-prefs.h"
+#include "gnc-ui.h"
 #include "gnc-ui-util.h"
 #include "Query.h"
 #include "qof.h"
@@ -847,7 +848,7 @@ gnc_sx_sxsincelast_book_opened(void)
 
     if (summary.need_dialog)
     {
-        gnc_ui_sx_since_last_run_dialog(inst_model, auto_created_txns);
+        gnc_ui_sx_since_last_run_dialog (gnc_ui_get_main_window (NULL), inst_model, auto_created_txns);
         auto_created_txns = NULL;
     }
     else
@@ -858,7 +859,7 @@ gnc_sx_sxsincelast_book_opened(void)
                 return;
 
             gnc_info_dialog
-            (NULL,
+            (gnc_ui_get_main_window (NULL),
              ngettext
              ("There are no Scheduled Transactions to be entered at this time. "
               "(One transaction automatically created)",
@@ -959,7 +960,7 @@ variable_value_changed_cb(GtkCellRendererText *cell,
 }
 
 GncSxSinceLastRunDialog*
-gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
+gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
 {
     GncSxSinceLastRunDialog *dialog;
     GtkBuilder *builder;
@@ -970,6 +971,7 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr
     gnc_builder_add_from_file (builder, "dialog-sx.glade", "since_last_run_dialog");
 
     dialog->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "since_last_run_dialog"));
+    gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(dialog->dialog), "GncSxSinceLastRunDialog");
diff --git a/gnucash/gnome/dialog-sx-since-last-run.h b/gnucash/gnome/dialog-sx-since-last-run.h
index 2b7a5f7..e94a355 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.h
+++ b/gnucash/gnome/dialog-sx-since-last-run.h
@@ -47,7 +47,7 @@ void gnc_sx_sxsincelast_book_opened(void);
 /**
  * Create the since-last-run dialog.
  **/
-GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances,
+GncSxSinceLastRunDialog*  gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_instances,
         GList *auto_created_txn_guids);
 
 #endif
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index e858fc0..96cbecb 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -551,7 +551,7 @@ gnc_main_window_cmd_actions_scheduled_transaction_editor (GtkAction *action, Gnc
 static void
 gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActionData *data)
 {
-    GncMainWindow *window;
+    GtkWindow *window;
     GncSxInstanceModel *sx_instances;
     GncSxSummary summary;
     GList *auto_created_txns = NULL;
@@ -560,7 +560,7 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
 
     g_return_if_fail (data != NULL);
 
-    window = data->window;
+    window = GTK_WINDOW (data->window);
 
     if (qof_book_is_readonly(gnc_get_current_book()))
     {
@@ -573,18 +573,18 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
     gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns, NULL);
     if (summary.need_dialog)
     {
-        gnc_ui_sx_since_last_run_dialog(sx_instances, auto_created_txns);
+        gnc_ui_sx_since_last_run_dialog (window, sx_instances, auto_created_txns);
         auto_created_txns = NULL;
     }
     else
     {
         if (summary.num_auto_create_no_notify_instances == 0)
         {
-            gnc_info_dialog(GTK_WINDOW (window), "%s", nothing_to_do_msg);
+            gnc_info_dialog (window, "%s", nothing_to_do_msg);
         }
         else
         {
-            gnc_info_dialog(GTK_WINDOW (window), ngettext
+            gnc_info_dialog(window, ngettext
                             /* Translators: %d is the number of transactions. This is a
                                ngettext(3) message. */
                             ("There are no Scheduled Transactions to be entered at this time. "
diff --git a/gnucash/gnome/gtkbuilder/dialog-sx.glade b/gnucash/gnome/gtkbuilder/dialog-sx.glade
index e2c9ba3..f09c8f3 100644
--- a/gnucash/gnome/gtkbuilder/dialog-sx.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-sx.glade
@@ -1456,7 +1456,6 @@
     </action-widgets>
   </object>
   <object class="GtkDialog" id="since_last_run_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Since Last Run...</property>
     <property name="window_position">center-on-parent</property>

commit 995c3cf4c37e5dad51fc937bb6ce17c85e24d02f
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 16 17:22:10 2017 +0100

    Set transient parents for all query views and dialogs

diff --git a/gnucash/gnome-utils/dialog-query-view.c b/gnucash/gnome-utils/dialog-query-view.c
index 824755f..44543c7 100644
--- a/gnucash/gnome-utils/dialog-query-view.c
+++ b/gnucash/gnome-utils/dialog-query-view.c
@@ -177,7 +177,7 @@ gnc_dialog_query_view_close (GtkButton *button, DialogQueryView *dqv)
 /* PUBLIC INTERFACES */
 
 DialogQueryView *
-gnc_dialog_query_view_new (GList *param_list, Query *q)
+gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
 {
     GtkBuilder  *builder;
     DialogQueryView *dqv;
@@ -191,6 +191,7 @@ gnc_dialog_query_view_new (GList *param_list, Query *q)
     /* Grab the dialog, save the dialog info */
     dqv->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "query_view_dialog"));
     g_object_set_data (G_OBJECT (dqv->dialog), "dialog-info", dqv);
+    gtk_window_set_transient_for(GTK_WINDOW(dqv->dialog), parent);
 
     // Set the style context for this dialog so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(dqv->dialog), "GncQueryViewDialog");
@@ -313,7 +314,7 @@ void gnc_dialog_query_view_destroy (DialogQueryView *dqv)
 }
 
 DialogQueryView *
-gnc_dialog_query_view_create (GList *param_list, Query *q,
+gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
                               const char *title, const char *label,
                               gboolean abs, gboolean inv_sort,
                               gint sort_column, GtkSortType order,
@@ -324,7 +325,7 @@ gnc_dialog_query_view_create (GList *param_list, Query *q,
     if (!param_list || !q)
         return NULL;
 
-    dqv = gnc_dialog_query_view_new (param_list, q);
+    dqv = gnc_dialog_query_view_new (parent, param_list, q);
     if (!dqv)
         return NULL;
 
diff --git a/gnucash/gnome-utils/dialog-query-view.h b/gnucash/gnome-utils/dialog-query-view.h
index 4aefded..96676af 100644
--- a/gnucash/gnome-utils/dialog-query-view.h
+++ b/gnucash/gnome-utils/dialog-query-view.h
@@ -39,7 +39,7 @@ typedef struct
 } GNCDisplayViewButton;
 
 DialogQueryView *
-gnc_dialog_query_view_new (GList *param_list, Query *q);
+gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q);
 
 void gnc_dialog_query_view_set_title (DialogQueryView *dqv, const char *title);
 void gnc_dialog_query_view_set_label (DialogQueryView *dqv, const char *label);
@@ -53,7 +53,7 @@ void gnc_dialog_query_view_refresh (DialogQueryView *dqv);
 void gnc_dialog_query_view_destroy (DialogQueryView *dqv);
 
 DialogQueryView *
-gnc_dialog_query_view_create (GList *param_list, Query *q,
+gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
                               const char *title, const char *label,
                               gboolean abs, gboolean inv_sort,
                               gint sort_column, GtkSortType order,
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index 1a93602..f799d4e 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -210,7 +210,7 @@ struct _invoice_window
 void gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data);
 void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data);
 gboolean gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data);
-DialogQueryView *gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueType duetype);
+DialogQueryView *gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_advance, GncWhichDueType duetype);
 
 #define INV_WIDTH_PREFIX "invoice_reg"
 #define BILL_WIDTH_PREFIX "bill_reg"
@@ -3276,7 +3276,7 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
 }
 
 DialogQueryView *
-gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueType duetype)
+gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_advance, GncWhichDueType duetype)
 {
     QofIdType type = GNC_INVOICE_MODULE_NAME;
     Query *q;
@@ -3411,7 +3411,7 @@ gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueTy
                       len);
         title = _("Due Invoices Reminder");
     }
-    dialog = gnc_dialog_query_view_create(param_list, q,
+    dialog = gnc_dialog_query_view_create(parent, param_list, q,
                                           title,
                                           message,
                                           TRUE, FALSE,
@@ -3426,7 +3426,7 @@ gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueTy
 }
 
 void
-gnc_invoice_remind_bills_due (void)
+gnc_invoice_remind_bills_due (GtkWindow *parent)
 {
     QofBook *book;
     gint days;
@@ -3435,11 +3435,11 @@ gnc_invoice_remind_bills_due (void)
     book = qof_session_get_book(gnc_get_current_session());
     days = gnc_prefs_get_float(GNC_PREFS_GROUP_BILL, GNC_PREF_DAYS_IN_ADVANCE);
 
-    gnc_invoice_show_bills_due(book, days, DUE_FOR_VENDOR);
+    gnc_invoice_show_docs_due (parent, book, days, DUE_FOR_VENDOR);
 }
 
 void
-gnc_invoice_remind_invoices_due (void)
+gnc_invoice_remind_invoices_due (GtkWindow *parent)
 {
     QofBook *book;
     gint days;
@@ -3448,7 +3448,7 @@ gnc_invoice_remind_invoices_due (void)
     book = qof_session_get_book(gnc_get_current_session());
     days = gnc_prefs_get_float(GNC_PREFS_GROUP_INVOICE, GNC_PREF_DAYS_IN_ADVANCE);
 
-    gnc_invoice_show_bills_due(book, days, DUE_FOR_CUSTOMER);
+    gnc_invoice_show_docs_due (parent, book, days, DUE_FOR_CUSTOMER);
 }
 
 void
@@ -3457,7 +3457,7 @@ gnc_invoice_remind_bills_due_cb (void)
     if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_BILL, GNC_PREF_NOTIFY_WHEN_DUE))
         return;
 
-    gnc_invoice_remind_bills_due();
+    gnc_invoice_remind_bills_due (GTK_WINDOW(gnc_ui_get_main_window (NULL)));
 }
 
 void
@@ -3466,5 +3466,5 @@ gnc_invoice_remind_invoices_due_cb (void)
     if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_INVOICE, GNC_PREF_NOTIFY_WHEN_DUE))
         return;
 
-    gnc_invoice_remind_invoices_due();
+    gnc_invoice_remind_invoices_due (GTK_WINDOW(gnc_ui_get_main_window (NULL)));
 }
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 366574b..b4fd61d 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -800,7 +800,7 @@ gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
     g_return_if_fail (mw != NULL);
     g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-    gnc_invoice_remind_bills_due();
+    gnc_invoice_remind_bills_due (GTK_WINDOW (mw->window));
 }
 
 
@@ -811,7 +811,7 @@ gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
     g_return_if_fail (mw != NULL);
     g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-    gnc_invoice_remind_invoices_due();
+    gnc_invoice_remind_invoices_due (GTK_WINDOW (mw->window));
 }
 
 static void
diff --git a/gnucash/gnome/gnc-plugin-business.h b/gnucash/gnome/gnc-plugin-business.h
index 9a0e72c..9ded6cf 100644
--- a/gnucash/gnome/gnc-plugin-business.h
+++ b/gnucash/gnome/gnc-plugin-business.h
@@ -60,8 +60,8 @@ GncPlugin *gnc_plugin_business_new      (void);
 G_END_DECLS
 
 GncMainWindow *gnc_plugin_business_get_window (void);
-void gnc_invoice_remind_bills_due (void);
-void gnc_invoice_remind_invoices_due (void);
+void gnc_invoice_remind_bills_due (GtkWindow *parent);
+void gnc_invoice_remind_invoices_due (GtkWindow *parent);
 void gnc_invoice_remind_bills_due_cb (void);
 void gnc_invoice_remind_invoices_due_cb (void);
 const char *gnc_plugin_business_get_invoice_printreport(void);

commit d8cc165e2894c7d52aee3785c3a8b070a4e4b563
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sun Nov 26 12:55:09 2017 +0100

    Alter function signature of gnc_(verify|yes_no|info|warning|error)_dialog
    
    The new signature makes it more clear what the purpose and required type of the parent widget should be.
    While at it, the info,warning and error dialog code got slightly refactored for better code reuse.
    Finally a few more parent widgets were passed in places where a parent was readily available.

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index badc97d..63dd1f2 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -234,7 +234,7 @@ gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
     if (sw->selected_item == NULL && sw->allow_clear == FALSE)
     {
         char *msg = _("You must select an item from the list");
-        gnc_error_dialog (sw->dialog, "%s", msg);
+        gnc_error_dialog (GTK_WINDOW (sw->dialog), "%s", msg);
         return;
     }
 
diff --git a/gnucash/gnome-utils/assistant-xml-encoding.c b/gnucash/gnome-utils/assistant-xml-encoding.c
index f38b5e8..0e04e23 100644
--- a/gnucash/gnome-utils/assistant-xml-encoding.c
+++ b/gnucash/gnome-utils/assistant-xml-encoding.c
@@ -1132,7 +1132,7 @@ cleanup_parse_file:
     }
     if (message)
     {
-        gnc_error_dialog (data->assistant, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (data->assistant), "%s", message);
     }
     if (!success)
         gxi_session_destroy (data);
@@ -1306,7 +1306,7 @@ gxi_add_encoding (GncXmlImportData *data, gpointer encoding_ptr)
     if (g_list_find (data->encodings, encoding_ptr))
     {
         message = _("This encoding has been added to the list already.");
-        gnc_error_dialog (data->encodings_dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (data->encodings_dialog), "%s", message);
         return;
     }
 
@@ -1317,7 +1317,7 @@ gxi_add_encoding (GncXmlImportData *data, gpointer encoding_ptr)
         g_iconv_close (iconv);
         g_free (enc_string);
         message = _("This is an invalid encoding.");
-        gnc_error_dialog (data->encodings_dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (data->encodings_dialog), "%s", message);
         return;
     }
     g_iconv_close (iconv);
diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index 24f63e1..3c2a59d 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -467,7 +467,7 @@ gnc_ui_to_account(AccountWindow *aw)
         if (!gnc_account_create_opening_balance (account, balance, date, aw->book))
         {
             const char *message = _("Could not create opening balance.");
-            gnc_error_dialog(aw->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         }
     }
     else
@@ -756,7 +756,7 @@ gnc_common_ok (AccountWindow *aw)
     if (g_strcmp0(name, "") == 0)
     {
         const char *message = _("The account must be given a name.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("bad name");
         return FALSE;
     }
@@ -782,7 +782,7 @@ gnc_common_ok (AccountWindow *aw)
             !guid_equal(&aw->account, xaccAccountGetGUID (account)))
     {
         const char *message = _("There is already an account with that name.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("duplicate name");
         return FALSE;
     }
@@ -791,7 +791,7 @@ gnc_common_ok (AccountWindow *aw)
     if (!gnc_filter_parent_accounts(parent, aw))
     {
         const char *message = _("You must choose a valid parent account.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("invalid parent");
         return FALSE;
     }
@@ -800,7 +800,7 @@ gnc_common_ok (AccountWindow *aw)
     if (aw->type == ACCT_TYPE_INVALID)
     {
         const char *message = _("You must select an account type.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("invalid type");
         return FALSE;
     }
@@ -810,7 +810,7 @@ gnc_common_ok (AccountWindow *aw)
     {
         const char *message = _("The selected account type is incompatible with "
                                 "the one of the selected parent.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("incompatible types");
         return FALSE;
     }
@@ -821,7 +821,7 @@ gnc_common_ok (AccountWindow *aw)
     if (!commodity)
     {
         const char *message = _("You must choose a commodity.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE("invalid commodity");
         return FALSE;
     }
@@ -878,7 +878,7 @@ gnc_new_account_ok (AccountWindow *aw)
     {
         const char *message = _("You must enter a valid opening balance "
                                 "or leave it blank.");
-        gnc_error_dialog(aw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
         LEAVE(" ");
         return;
     }
@@ -902,7 +902,7 @@ gnc_new_account_ok (AccountWindow *aw)
             {
                 const char *message = _("You must select a transfer account or choose"
                                         " the opening balances equity account.");
-                gnc_error_dialog(aw->dialog, "%s", message);
+                gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
                 LEAVE(" ");
                 return;
             }
diff --git a/gnucash/gnome-utils/dialog-book-close.c b/gnucash/gnome-utils/dialog-book-close.c
index dab1930..2d23e41 100644
--- a/gnucash/gnome-utils/dialog-book-close.c
+++ b/gnucash/gnome-utils/dialog-book-close.c
@@ -297,14 +297,14 @@ gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
 
         if (!income_acct)
         {
-            gnc_error_dialog(cbw->dialog, "%s",
+            gnc_error_dialog(GTK_WINDOW (cbw->dialog), "%s",
                              _("Please select an Equity account to hold the total Period Income."));
             break;
         }
 
         if (!expense_acct)
         {
-            gnc_error_dialog(cbw->dialog, "%s",
+            gnc_error_dialog(GTK_WINDOW (cbw->dialog), "%s",
                              _("Please select an Equity account to hold the total Period Expense."));
             break;
         }
diff --git a/gnucash/gnome-utils/dialog-commodity.c b/gnucash/gnome-utils/dialog-commodity.c
index e9aa51f..3179b7a 100644
--- a/gnucash/gnome-utils/dialog-commodity.c
+++ b/gnucash/gnome-utils/dialog-commodity.c
@@ -1282,8 +1282,8 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
             gnc_commodity_commit_edit(c);
             return TRUE;
         }
-        gnc_warning_dialog(w->dialog, "%s",
-                           _("You may not create a new national currency."));
+        gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s",
+                            _("You may not create a new national currency."));
         return FALSE;
     }
 
@@ -1292,10 +1292,10 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
      */
     if (g_utf8_collate(name_space, GNC_COMMODITY_NS_TEMPLATE) == 0)
     {
-	gnc_warning_dialog (w->dialog,
-			    _("%s is a reserved commodity type."
+        gnc_warning_dialog (GTK_WINDOW (w->dialog),
+                            _("%s is a reserved commodity type."
                             " Please use something else."), GNC_COMMODITY_NS_TEMPLATE);
-	return FALSE;
+        return FALSE;
     }
 
     if (fullname && fullname[0] &&
@@ -1308,7 +1308,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
         if ((!w->edit_commodity && c) ||
                 (w->edit_commodity && c && (c != w->edit_commodity)))
         {
-            gnc_warning_dialog (w->dialog, "%s",  _("That commodity already exists."));
+            gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s",  _("That commodity already exists."));
             g_free(name_space);
             return FALSE;
         }
@@ -1356,10 +1356,10 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
     }
     else
     {
-        gnc_warning_dialog(w->dialog, "%s",
-                           _("You must enter a non-empty \"Full name\", "
-                             "\"Symbol/abbreviation\", "
-                             "and \"Type\" for the commodity."));
+        gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s",
+                            _("You must enter a non-empty \"Full name\", "
+                              "\"Symbol/abbreviation\", "
+                              "and \"Type\" for the commodity."));
         g_free(name_space);
         return FALSE;
     }
diff --git a/gnucash/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c
index 9d6768f..c184208 100644
--- a/gnucash/gnome-utils/dialog-options.c
+++ b/gnucash/gnome-utils/dialog-options.c
@@ -834,7 +834,7 @@ gnc_option_changed_gain_loss_account_widget_cb (GtkTreeSelection *selection,
                         "the placeholder account by clicking on the arrow " \
                         "to the left.)");
 
-            gnc_error_dialog(NULL, "%s", message);
+            gnc_error_dialog (gnc_ui_get_gtk_window (book_currency_data->default_gain_loss_account_widget), "%s", message);
             if (book_currency_data->prior_gain_loss_account)
             {
                 (gnc_tree_view_account_set_selected_account
diff --git a/gnucash/gnome-utils/dialog-preferences.c b/gnucash/gnome-utils/dialog-preferences.c
index cb5e976..b3ba114 100644
--- a/gnucash/gnome-utils/dialog-preferences.c
+++ b/gnucash/gnome-utils/dialog-preferences.c
@@ -193,7 +193,7 @@ gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *
 
     if (conflict_msg)
     {
-        gnc_warning_dialog(dialog, "%s", conflict_msg);
+        gnc_warning_dialog (GTK_WINDOW (dialog), "%s", conflict_msg);
         g_free ( conflict_msg );
     }
     g_free (separator);
diff --git a/gnucash/gnome-utils/dialog-tax-table.c b/gnucash/gnome-utils/dialog-tax-table.c
index aa4dfbf..0274167 100644
--- a/gnucash/gnome-utils/dialog-tax-table.c
+++ b/gnucash/gnome-utils/dialog-tax-table.c
@@ -114,7 +114,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
         if (name == NULL || *name == '\0')
         {
             message = _("You must provide a name for this Tax Table.");
-            gnc_error_dialog (ntt->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
             return FALSE;
         }
         if (gncTaxTableLookupByName (ttw->book, name))
@@ -122,7 +122,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
             message = g_strdup_printf(_(
                                           "You must provide a unique name for this Tax Table. "
                                           "Your choice \"%s\" is already in use."), name);
-            gnc_error_dialog (ntt->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
             g_free (message);
             return FALSE;
         }
@@ -135,7 +135,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
                                  gnc_numeric_create (100, 1)) > 0)
     {
         message = _("Percentage amount must be between -100 and 100.");
-        gnc_error_dialog (ntt->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
         return FALSE;
     }
 
@@ -144,7 +144,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
     if (acc == NULL)
     {
         message = _("You must choose a Tax Account.");
-        gnc_error_dialog (ntt->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
         return FALSE;
     }
 
@@ -563,12 +563,12 @@ tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw)
         char *message =
             g_strdup_printf (_("Tax table \"%s\" is in use. You cannot delete it."),
                              gncTaxTableGetName (ttw->current_table));
-        gnc_error_dialog (ttw->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (ttw->dialog), "%s", message);
         g_free (message);
         return;
     }
 
-    if (gnc_verify_dialog (ttw->dialog, FALSE,
+    if (gnc_verify_dialog (GTK_WINDOW (ttw->dialog), FALSE,
                            _("Are you sure you want to delete \"%s\"?"),
                            gncTaxTableGetName (ttw->current_table)))
     {
@@ -611,11 +611,11 @@ tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw)
     {
         char *message = _("You cannot remove the last entry from the tax table. "
                           "Try deleting the tax table if you want to do that.");
-        gnc_error_dialog (ttw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (ttw->dialog)  , "%s", message);
         return;
     }
 
-    if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
+    if (gnc_verify_dialog (GTK_WINDOW (ttw->dialog), FALSE, "%s",
                            _("Are you sure you want to delete this entry?")))
     {
         /* Ok, let's remove it */
diff --git a/gnucash/gnome-utils/dialog-transfer.c b/gnucash/gnome-utils/dialog-transfer.c
index e5fedbf..6ab6fb2 100644
--- a/gnucash/gnome-utils/dialog-transfer.c
+++ b/gnucash/gnome-utils/dialog-transfer.c
@@ -689,7 +689,7 @@ gnc_parse_error_dialog (XferDialog *xferData, const char *error_string)
     if (error_string == NULL)
         error_string = "";
 
-    gnc_error_dialog (xferData->dialog,
+    gnc_error_dialog (GTK_WINDOW (xferData->dialog),
                       "%s\n\n%s: %s.",
                       error_string, _("Error"),
                       parse_error_string);
@@ -1417,7 +1417,7 @@ check_accounts  (XferDialog* xferData, Account* from_account,
         const char *message = _("You must specify an account to transfer from, "
                                 "or to, or both, for this transaction. "
                                 "Otherwise, it will not be recorded.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
         LEAVE("bad account");
         return FALSE;
     }
@@ -1426,7 +1426,7 @@ check_accounts  (XferDialog* xferData, Account* from_account,
     {
         const char *message = _("You can't transfer from and to the same "
                                 "account!");
-        gnc_error_dialog(xferData->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
         LEAVE("same account");
         return FALSE;
     }
@@ -1442,7 +1442,7 @@ check_accounts  (XferDialog* xferData, Account* from_account,
             name = gnc_account_get_full_name(from_account);
         else
             name = gnc_account_get_full_name(to_account);
-        gnc_error_dialog(xferData->dialog, placeholder_format, name);
+        gnc_error_dialog (GTK_WINDOW (xferData->dialog), placeholder_format, name);
         g_free(name);
         LEAVE("placeholder");
         return FALSE;
@@ -1454,7 +1454,7 @@ check_accounts  (XferDialog* xferData, Account* from_account,
             _("You can't transfer from a non-currency account. "
               "Try reversing the \"from\" and \"to\" accounts "
               "and making the \"amount\" negative.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
         LEAVE("non-currency");
         return FALSE;
     }
@@ -1703,7 +1703,7 @@ gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
     if (gnc_numeric_zero_p (amount))
     {
         const char *message = _("You must enter an amount to transfer.");
-        gnc_error_dialog(xferData->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
         LEAVE("invalid from amount");
         return;
     }
@@ -1823,7 +1823,7 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
     }
 
     scm_window =  SWIG_NewPointerObj(xferData->dialog,
-                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
+                                     SWIG_TypeQuery("_p_GtkWindow"), 0);
 
     if (scm_is_true (scm_not (book_scm)))
     {
diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index b733c0f..6fea291 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -198,7 +198,7 @@ show_session_error (QofBackendError io_error,
                     const char *newfile,
                     GNCFileDialogType type)
 {
-    GtkWidget *parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
+    GtkWindow *parent = gnc_ui_get_main_window (NULL);
     GtkWidget *dialog;
     gboolean uh_oh = TRUE;
     const char *fmt, *label;
@@ -305,7 +305,7 @@ show_session_error (QofBackendError io_error,
             break;
         }
 
-        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,
@@ -315,7 +315,7 @@ show_session_error (QofBackendError io_error,
                                _("_Cancel"), GTK_RESPONSE_CANCEL,
                                label, GTK_RESPONSE_YES,
                                NULL);
-        if (parent == NULL)
+        if (!parent)
             gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
         response = gtk_dialog_run(GTK_DIALOG(dialog));
         gtk_widget_destroy(dialog);
@@ -948,7 +948,7 @@ RESTART:
                 uh_oh = TRUE;
 
                 // XXX: should pull out the file name here */
-                gnc_error_dialog(GTK_WIDGET (gnc_ui_get_main_window(NULL)), msg, "");
+                gnc_error_dialog (gnc_ui_get_main_window (NULL), msg, "");
                 g_free (msg);
             }
             if (template_root != NULL)
@@ -1308,7 +1308,7 @@ gnc_file_save (void)
 
     if (qof_book_is_readonly(qof_session_get_book(session)))
     {
-        gint response = gnc_ok_cancel_dialog(GTK_WIDGET (gnc_ui_get_main_window(NULL)),
+        gint response = gnc_ok_cancel_dialog(gnc_ui_get_main_window (NULL),
                                              GTK_RESPONSE_CANCEL,
                                              _("The database was opened read-only. "
                                                "Do you want to save it to a different place?"));
diff --git a/gnucash/gnome-utils/gnc-gui-query.c b/gnucash/gnome-utils/gnc-gui-query.c
index e2f4434..9ada424 100644
--- a/gnucash/gnome-utils/gnc-gui-query.c
+++ b/gnucash/gnome-utils/gnc-gui-query.c
@@ -50,7 +50,7 @@
  * Return: the result the user selected                             *
 \********************************************************************/
 gint
-gnc_ok_cancel_dialog(GtkWidget *parent,
+gnc_ok_cancel_dialog(GtkWindow *parent,
                      gint default_result,
                      const gchar *format, ...)
 {
@@ -59,12 +59,12 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
     gchar *buffer;
     va_list args;
 
-    if (parent == NULL)
-        parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
+    if (!parent)
+        parent = gnc_ui_get_main_window (NULL);
 
     va_start(args, format);
     buffer = g_strdup_vprintf(format, args);
-    dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+    dialog = gtk_message_dialog_new (parent,
                                      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                      GTK_MESSAGE_QUESTION,
                                      GTK_BUTTONS_OK_CANCEL,
@@ -73,7 +73,7 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
     g_free(buffer);
     va_end(args);
 
-    if (parent == NULL)
+    if (!parent)
         gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
 
     gtk_dialog_set_default_response (GTK_DIALOG(dialog), default_result);
@@ -99,7 +99,7 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
  *                string.                                           *
 \********************************************************************/
 gboolean
-gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
+gnc_verify_dialog(GtkWindow *parent, gboolean yes_is_default,
                   const gchar *format, ...)
 {
     GtkWidget *dialog;
@@ -107,12 +107,12 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
     gint result;
     va_list args;
 
-    if (parent == NULL)
-        parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
+    if (!parent)
+        parent = gnc_ui_get_main_window (NULL);
 
     va_start(args, format);
     buffer = g_strdup_vprintf(format, args);
-    dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+    dialog = gtk_message_dialog_new (parent,
                                      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                      GTK_MESSAGE_QUESTION,
                                      GTK_BUTTONS_YES_NO,
@@ -121,7 +121,7 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
     g_free(buffer);
     va_end(args);
 
-    if (parent == NULL)
+    if (!parent)
         gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
 
     gtk_dialog_set_default_response(GTK_DIALOG(dialog),
@@ -131,6 +131,30 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
     return (result == GTK_RESPONSE_YES);
 }
 
+static void
+gnc_message_dialog_common (GtkWindow *parent, const gchar *format, GtkMessageType msg_type, va_list args)
+{
+    GtkWidget *dialog = NULL;
+    gchar *buffer;
+
+    if (!parent)
+        parent = gnc_ui_get_main_window (NULL);
+
+    buffer = g_strdup_vprintf(format, args);
+    dialog = gtk_message_dialog_new (parent,
+                                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     msg_type,
+                                     GTK_BUTTONS_CLOSE,
+                                     "%s",
+                                     buffer);
+    g_free(buffer);
+
+    if (!parent)
+        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
+
+    gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
+}
 
 /********************************************************************\
  * gnc_info_dialog                                                  *
@@ -144,36 +168,19 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
  * Return: none                                                     *
 \********************************************************************/
 void
-gnc_info_dialog(GtkWidget *parent, const gchar *format, ...)
+gnc_info_dialog (GtkWindow *parent, const gchar *format, ...)
 {
-    GtkWidget *dialog;
-    gchar *buffer;
     va_list args;
 
-    if (parent == NULL)
-        parent = GTK_WIDGET (gnc_ui_get_main_window (NULL));
-
     va_start(args, format);
-    buffer = g_strdup_vprintf(format, args);
-    dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
-                                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_INFO,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s",
-                                     buffer);
+    gnc_message_dialog_common (parent, format, GTK_MESSAGE_INFO, args);
     va_end(args);
-
-    if (parent == NULL)
-        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
-
-    gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy (dialog);
 }
 
 
 
 /********************************************************************\
- * gnc_warning_dialog_common                                        *
+ * gnc_warning_dialog                                               *
  *   displays a warning dialog box                                  *
  *                                                                  *
  * Args:   parent  - the parent window                              *
@@ -183,44 +190,20 @@ gnc_info_dialog(GtkWidget *parent, const gchar *format, ...)
  *                string.                                           *
  * Return: none                                                     *
 \********************************************************************/
-static void
-gnc_warning_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
-{
-    GtkWidget *dialog = NULL;
-    gchar *buffer;
-
-    if (parent == NULL)
-        parent = GTK_WIDGET(gnc_ui_get_main_window(NULL));
-
-    buffer = g_strdup_vprintf(format, args);
-    dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
-                                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_WARNING,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s",
-                                     buffer);
-    g_free(buffer);
-
-    if (parent == NULL)
-        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
-
-    gtk_dialog_run (GTK_DIALOG (dialog));
-    gtk_widget_destroy (dialog);
-}
 
 void
-gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
+gnc_warning_dialog (GtkWindow *parent, const gchar *format, ...)
 {
     va_list args;
 
     va_start(args, format);
-    gnc_warning_dialog_common(parent, format, args);
+    gnc_message_dialog_common (parent, format, GTK_MESSAGE_WARNING, args);
     va_end(args);
 }
 
 
 /********************************************************************\
- * gnc_error_dialog_common                                          *
+ * gnc_error_dialog                                                 *
  *   displays an error dialog box                                   *
  *                                                                  *
  * Args:   parent  - the parent window                              *
@@ -230,38 +213,12 @@ gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
  *                string.                                           *
  * Return: none                                                     *
 \********************************************************************/
-static void
-gnc_error_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
-{
-    GtkWidget *dialog;
-    gchar *buffer;
-
-    if (parent == NULL)
-        parent = GTK_WIDGET(gnc_ui_get_main_window(NULL));
-
-    buffer = g_strdup_vprintf(format, args);
-    dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
-                                     GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_ERROR,
-                                     GTK_BUTTONS_CLOSE,
-                                     "%s",
-                                     buffer);
-    g_free(buffer);
-
-    if (parent == NULL)
-        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
-
-    gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy (dialog);
-}
-
-void
-gnc_error_dialog(GtkWidget *parent, const gchar *format, ...)
+void gnc_error_dialog (GtkWindow* parent, const char* format, ...)
 {
     va_list args;
 
     va_start(args, format);
-    gnc_error_dialog_common(parent, format, args);
+    gnc_message_dialog_common (parent, format, GTK_MESSAGE_ERROR, args);
     va_end(args);
 }
 
diff --git a/gnucash/gnome-utils/gnc-gui-query.h b/gnucash/gnome-utils/gnc-gui-query.h
index f026594..e6b7fac 100644
--- a/gnucash/gnome-utils/gnc-gui-query.h
+++ b/gnucash/gnome-utils/gnc-gui-query.h
@@ -24,12 +24,11 @@
 #define QUERY_USER_H
 
 extern void
-gnc_info_dialog(GtkWidget *parent,
-                const char *format, ...) G_GNUC_PRINTF (2, 3);
+gnc_info_dialog (GtkWindow *parent,
+                 const char *format, ...) G_GNUC_PRINTF (2, 3);
 
 
-extern void
-gnc_error_dialog(GtkWidget *parent,
-                 const char *format, ...) G_GNUC_PRINTF (2, 3);
+void gnc_error_dialog (GtkWindow* parent, const char* format, ...) G_GNUC_PRINTF (2, 3);
+
 
 #endif
diff --git a/gnucash/gnome-utils/gnc-tree-control-split-reg.c b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
index 4bf3c1b..16abbd3 100644
--- a/gnucash/gnome-utils/gnc-tree-control-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
@@ -167,13 +167,13 @@ gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Trans
 gboolean
 gtc_sr_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans)
 {
-    GtkWidget *window;
+    GtkWindow *window;
     Transaction *dirty_trans;
 
     /* Make sure we have stopped editing */
     gnc_tree_view_split_reg_finish_edit (view);
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     /* Get dirty_trans */
     dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
@@ -354,7 +354,7 @@ void
 gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
 {
     GncTreeModelSplitReg *model;
-    GtkWidget *window;
+    GtkWindow *window;
     Account *anchor;
     Transaction *trans;
     Split *split = NULL;
@@ -397,7 +397,7 @@ gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
     if (num_splits < 2)
         return;
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     /* Make sure we NEED this for this type of register */
     if (!gnc_tree_util_split_reg_has_rate (view))
@@ -1078,7 +1078,7 @@ gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
 void
 gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
 {
-    GtkWidget *window;
+    GtkWindow *window;
     Transaction *trans = NULL, *new_trans = NULL;
     GList *snode = NULL;
 
@@ -1113,7 +1113,7 @@ gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
         return;
     }
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     if (xaccTransGetReversedBy (trans))
     {
@@ -1167,7 +1167,7 @@ gboolean
 gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
 {
     GncTreeModelSplitReg *model;
-    GtkWidget *window;
+    GtkWindow *window;
     RowDepth depth;
     Transaction *trans;
     Split *blank_split;
@@ -1228,7 +1228,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
         return FALSE;
     }
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     /* Ok, we are now ready to make the copy. */
     if (depth == SPLIT3)
@@ -1259,7 +1259,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
                 else
                     in_num = gnc_get_num_action (NULL, split);
 
-                if (!gnc_dup_trans_dialog (window, title, FALSE,
+                if (!gnc_dup_trans_dialog (GTK_WIDGET (window), title, FALSE,
                                            &date, in_num, &out_num, NULL, NULL))
                 {
                     LEAVE("dup cancelled");
@@ -1334,7 +1334,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
                                         ? gnc_get_num_action (trans, NULL)
                                         : NULL);
 
-        if (!gnc_dup_trans_dialog (window, NULL, TRUE,
+        if (!gnc_dup_trans_dialog (GTK_WIDGET (window), NULL, TRUE,
                                    &date, in_num, &out_num, in_tnum, &out_tnum))
         {
             LEAVE("dup cancelled");
@@ -1348,7 +1348,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
             gnc_gdate_set_time64 (&d, date);
             if (g_date_compare (&d, readonly_threshold) < 0)
             {
-                GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                GtkWidget *dialog = gtk_message_dialog_new (window,
                                     0,
                                     GTK_MESSAGE_ERROR,
                                     GTK_BUTTONS_OK,
@@ -1946,7 +1946,7 @@ gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view, GtkTreePath *sp
 Account *
 gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const char *name)
 {
-    GtkWidget *window;
+    GtkWindow *window;
     const char *placeholder = _("The account %s does not allow transactions.");
     const char *missing = _("The account %s does not exist. "
                             "Would you like to create it?");
@@ -1964,7 +1964,7 @@ gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const
     if (!account)
         account = gnc_account_lookup_by_code (gnc_get_current_root_account(), name);
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     if (!account)
     {
@@ -2106,9 +2106,9 @@ gnc_tree_control_split_reg_paste_trans (GncTreeViewSplitReg *view)
     //FIXME You can not paste from gl to a register, is this too simplistic
     if (clipboard_acct == NULL && anchor_acct != NULL)
     {
-        GtkWidget *window;
+        GtkWindow *window;
 
-        window = gnc_tree_view_split_reg_get_parent (view);
+        window = gnc_ui_get_main_window (GTK_WIDGET (view));
         gnc_error_dialog (window, "%s",
                          _("You can not paste from the general journal to a register."));
         return;
diff --git a/gnucash/gnome-utils/gnc-tree-util-split-reg.c b/gnucash/gnome-utils/gnc-tree-util-split-reg.c
index dc46ff9..62360bc 100644
--- a/gnucash/gnome-utils/gnc-tree-util-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-util-split-reg.c
@@ -824,7 +824,7 @@ void
 gnc_tree_util_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean force)
 {
 //    GncTreeModelSplitReg *model;
-    GtkWidget *window;
+    GtkWindow *window;
 //    Account *anchor;
 //    Account *acct = xaccSplitGetAccount (split);
 //    gnc_commodity *currency;
@@ -845,7 +845,7 @@ gnc_tree_util_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *t
         return;
     }
 
-    window = gnc_tree_view_split_reg_get_parent (view);
+    window = gnc_ui_get_main_window (GTK_WIDGET (view));
 
     if (gtu_sr_needs_exchange_rate (view, trans, split))
     {
diff --git a/gnucash/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
index b870614..f817970 100644
--- a/gnucash/gnome-utils/gnc-ui.h
+++ b/gnucash/gnome-utils/gnc-ui.h
@@ -79,26 +79,26 @@
 /* Dialog windows ***************************************************/
 
 extern gboolean
-gnc_verify_dialog(GtkWidget *parent,
-                  gboolean yes_is_default,
-                  const char *format, ...) G_GNUC_PRINTF (3, 4);
+gnc_verify_dialog (GtkWindow *parent,
+                   gboolean yes_is_default,
+                   const char *format, ...) G_GNUC_PRINTF (3, 4);
 
 extern gint
-gnc_ok_cancel_dialog(GtkWidget *parent,
-                     gint default_result,
-                     const char *format, ...) G_GNUC_PRINTF (3, 4);
+gnc_ok_cancel_dialog (GtkWindow *parent,
+                      gint default_result,
+                      const char *format, ...) G_GNUC_PRINTF (3, 4);
 
 extern void
-gnc_warning_dialog(GtkWidget *parent,
-                   const char *format, ...) G_GNUC_PRINTF (2, 3);
+gnc_warning_dialog (GtkWindow *parent,
+                    const char *format, ...) G_GNUC_PRINTF (2, 3);
 
 extern void
-gnc_info_dialog(GtkWidget *parent,
-                const char *format, ...) G_GNUC_PRINTF (2, 3);
+gnc_info_dialog (GtkWindow *parent,
+                 const char *format, ...) G_GNUC_PRINTF (2, 3);
 
 extern void
-gnc_error_dialog(GtkWidget *parent,
-                 const char *format, ...) G_GNUC_PRINTF (2, 3);
+gnc_error_dialog (GtkWindow *parent,
+                  const char *format, ...) G_GNUC_PRINTF (2, 3);
 
 
 extern void
diff --git a/gnucash/gnome-utils/gnome-utils.i b/gnucash/gnome-utils/gnome-utils.i
index bafde30..5246cd8 100644
--- a/gnucash/gnome-utils/gnome-utils.i
+++ b/gnucash/gnome-utils/gnome-utils.i
@@ -57,18 +57,18 @@ void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
         SCM apply_cb, SCM close_cb);
 
 gboolean
-gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
-		  const gchar *format, ...);
+gnc_verify_dialog (GtkWindow *parent, gboolean yes_is_default,
+		   const gchar *format, ...);
 
 void
-gnc_warning_dialog(GtkWidget *parent,
-                   const gchar *format, ...);
+gnc_warning_dialog (GtkWindow *parent,
+                    const gchar *format, ...);
 void
-gnc_error_dialog(GtkWidget *parent,
-		 const char *format, ...);
+gnc_error_dialog (GtkWindow *parent,
+		  const char *format, ...);
 void
-gnc_info_dialog(GtkWidget *parent,
-		const char *format, ...);
+gnc_info_dialog (GtkWindow *parent,
+		 const char *format, ...);
 
 void gnc_add_scm_extension (SCM extension);
 
diff --git a/gnucash/gnome/assistant-stock-split.c b/gnucash/gnome/assistant-stock-split.c
index 758fd4b..c5c4f8e 100644
--- a/gnucash/gnome/assistant-stock-split.c
+++ b/gnucash/gnome/assistant-stock-split.c
@@ -410,7 +410,7 @@ gnc_stock_split_assistant_finish (GtkAssistant *assistant,
         pdb = gnc_pricedb_get_db (book);
 
         if (!gnc_pricedb_add_price (pdb, price))
-            gnc_error_dialog (info->window, "%s", _("Error adding price."));
+            gnc_error_dialog (GTK_WINDOW (info->window), "%s", _("Error adding price."));
 
     }
 
@@ -778,7 +778,7 @@ gnc_stock_split_dialog (GtkWidget *parent, Account * initial)
 
     if (fill_account_list (info, initial) == 0)
     {
-        gnc_warning_dialog (parent, "%s", _("You don't have any stock accounts with balances!"));
+        gnc_warning_dialog (GTK_WINDOW (parent), "%s", _("You don't have any stock accounts with balances!"));
         gnc_close_gui_component_by_data (ASSISTANT_STOCK_SPLIT_CM_CLASS, info);
         return;
     }
diff --git a/gnucash/gnome/dialog-billterms.c b/gnucash/gnome/dialog-billterms.c
index e88f759..0a935d3 100644
--- a/gnucash/gnome/dialog-billterms.c
+++ b/gnucash/gnome/dialog-billterms.c
@@ -289,14 +289,14 @@ verify_term_ok (NewBillTerm *nbt)
     case GNC_TERM_TYPE_DAYS:
         if (days_due_days<days_disc_days)
         {
-              gnc_error_dialog (nbt->dialog, "%s", message);
+              gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
               result=FALSE;
         }
         break;
     case GNC_TERM_TYPE_PROXIMO:
 	if (prox_due_days<prox_disc_days)
         {
-            gnc_error_dialog (nbt->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
             result=FALSE;
         }
         break;
@@ -324,7 +324,7 @@ new_billterm_ok_cb (NewBillTerm *nbt)
         if (name == NULL || *name == '\0')
         {
             message = _("You must provide a name for this Billing Term.");
-            gnc_error_dialog (nbt->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
             return FALSE;
         }
         if (gncBillTermLookupByName (btw->book, name))
@@ -332,7 +332,7 @@ new_billterm_ok_cb (NewBillTerm *nbt)
             message = g_strdup_printf(_(
                                           "You must provide a unique name for this Billing Term. "
                                           "Your choice \"%s\" is already in use."), name);
-            gnc_error_dialog (nbt->dialog, "%s", message);
+            gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
             g_free (message);
             return FALSE;
         }
@@ -664,13 +664,13 @@ billterms_delete_term_cb (GtkButton *button, BillTermsWindow *btw)
 
     if (gncBillTermGetRefcount (btw->current_term) > 0)
     {
-        gnc_error_dialog (btw->dialog,
+        gnc_error_dialog (GTK_WINDOW (btw->dialog),
                           _("Term \"%s\" is in use. You cannot delete it."),
                           gncBillTermGetName (btw->current_term));
         return;
     }
 
-    if (gnc_verify_dialog (btw->dialog, FALSE,
+    if (gnc_verify_dialog (GTK_WINDOW (btw->dialog), FALSE,
                            _("Are you sure you want to delete \"%s\"?"),
                            gncBillTermGetName (btw->current_term)))
     {
diff --git a/gnucash/gnome/dialog-commodities.c b/gnucash/gnome/dialog-commodities.c
index bcfb061..f4d0a51 100644
--- a/gnucash/gnome/dialog-commodities.c
+++ b/gnucash/gnome/dialog-commodities.c
@@ -157,7 +157,7 @@ remove_clicked (CommoditiesDialog *cd)
                                 "at least one of your accounts. You may "
                                 "not delete it.");
 
-        gnc_warning_dialog (cd->dialog, "%s", message);
+        gnc_warning_dialog (GTK_WINDOW (cd->dialog), "%s", message);
         g_list_free (accounts);
         return;
     }
diff --git a/gnucash/gnome/dialog-customer.c b/gnucash/gnome/dialog-customer.c
index 6f262f6..a352fbc 100644
--- a/gnucash/gnome/dialog-customer.c
+++ b/gnucash/gnome/dialog-customer.c
@@ -279,14 +279,14 @@ static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
     gnc_resume_gui_refresh ();
 }
 
-static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
+static gboolean check_edit_amount (GtkWidget *amount,
                                    gnc_numeric *min, gnc_numeric *max,
                                    const char * error_message)
 {
     if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
     {
         if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
+            gnc_error_dialog (gnc_ui_get_gtk_window (amount), "%s", error_message);
         return TRUE;
     }
     /* We've got a valid-looking number; check mix/max */
@@ -297,21 +297,21 @@ static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
                 (max && gnc_numeric_compare (val, *max) > 0))
         {
             if (error_message)
-                gnc_error_dialog (dialog, "%s", error_message);
+                gnc_error_dialog (gnc_ui_get_gtk_window (amount), "%s", error_message);
             return TRUE;
         }
     }
     return FALSE;
 }
 
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+static gboolean check_entry_nonempty (GtkWidget *entry,
                                       const char * error_message)
 {
     const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
     if (g_strcmp0 (res, "") == 0)
     {
         if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
+            gnc_error_dialog (gnc_ui_get_gtk_window (entry), "%s", error_message);
         return TRUE;
     }
     return FALSE;
@@ -325,7 +325,7 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
     gchar *string;
 
     /* Check for valid company name */
-    if (check_entry_nonempty (cw->dialog, cw->company_entry,
+    if (check_entry_nonempty (cw->company_entry,
                               _("You must enter a company name. "
                                 "If this customer is an individual (and not a company) "
                                 "you should enter the same value for:\nIdentification "
@@ -333,13 +333,13 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
         return;
 
     /* Make sure we have an address */
-    if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
-            check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL))
+    if (check_entry_nonempty (cw->addr1_entry, NULL) &&
+            check_entry_nonempty (cw->addr2_entry, NULL) &&
+            check_entry_nonempty (cw->addr3_entry, NULL) &&
+            check_entry_nonempty (cw->addr4_entry, NULL))
     {
         const char *msg = _("You must enter a billing address.");
-        gnc_error_dialog (cw->dialog, "%s", msg);
+        gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
         return;
     }
 
@@ -347,12 +347,12 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
     min = gnc_numeric_zero ();
     max = gnc_numeric_create (100, 1);
 
-    if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
+    if (check_edit_amount (cw->discount_amount, &min, &max,
                            _("Discount percentage must be between 0-100 "
                              "or you must leave it blank.")))
         return;
 
-    if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
+    if (check_edit_amount (cw->credit_amount, &min, NULL,
                            _("Credit must be a positive amount or "
                              "you must leave it blank.")))
         return;
diff --git a/gnucash/gnome/dialog-date-close.c b/gnucash/gnome/dialog-date-close.c
index 60fee7f..0701b9a 100644
--- a/gnucash/gnome/dialog-date-close.c
+++ b/gnucash/gnome/dialog-date-close.c
@@ -71,14 +71,14 @@ gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
 
         if (!acc)
         {
-            gnc_error_dialog (ddc->dialog, "%s",
+            gnc_error_dialog (GTK_WINDOW (ddc->dialog), "%s",
                               _("No Account selected. Please try again."));
             return;
         }
 
         if (xaccAccountGetPlaceholder (acc))
         {
-            gnc_error_dialog (ddc->dialog, "%s",
+            gnc_error_dialog (GTK_WINDOW (ddc->dialog), "%s",
                               _("Placeholder account selected. Please try again."));
             return;
         }
diff --git a/gnucash/gnome/dialog-employee.c b/gnucash/gnome/dialog-employee.c
index c4e3781..f4d8f80 100644
--- a/gnucash/gnome/dialog-employee.c
+++ b/gnucash/gnome/dialog-employee.c
@@ -174,41 +174,14 @@ static void gnc_ui_to_employee (EmployeeWindow *ew, GncEmployee *employee)
     gnc_resume_gui_refresh ();
 }
 
-#if 0
-static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
-                                   gnc_numeric *min, gnc_numeric *max,
-                                   const char * error_message)
-{
-    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
-    {
-        if (error_message)
-            gnc_error_dialog (dialog, error_message);
-        return TRUE;
-    }
-    /* We've got a valid-looking number; check mix/max */
-    if (min || max)
-    {
-        gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
-        if ((min && gnc_numeric_compare (*min, val) > 0) ||
-                (max && gnc_numeric_compare (val, *max) > 0))
-        {
-            if (error_message)
-                gnc_error_dialog (dialog, error_message);
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-#endif
-
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+static gboolean check_entry_nonempty (GtkWidget *entry,
                                       const char * error_message)
 {
     const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
     if (g_strcmp0 (res, "") == 0)
     {
         if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
+            gnc_error_dialog (gnc_ui_get_gtk_window(entry), "%s", error_message);
         return TRUE;
     }
     return FALSE;
@@ -221,23 +194,23 @@ gnc_employee_window_ok_cb (GtkWidget *widget, gpointer data)
     gchar *string;
 
     /* Check for valid username */
-    if (check_entry_nonempty (ew->dialog, ew->username_entry,
+    if (check_entry_nonempty (ew->username_entry,
                               _("You must enter a username.")))
         return;
 
     /* Check for valid username */
-    if (check_entry_nonempty (ew->dialog, ew->name_entry,
+    if (check_entry_nonempty (ew->name_entry,
                               _("You must enter the employee's name.")))
         return;
 
     /* Make sure we have an address */
-    if (check_entry_nonempty (ew->dialog, ew->addr1_entry, NULL) &&
-            check_entry_nonempty (ew->dialog, ew->addr2_entry, NULL) &&
-            check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) &&
-            check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL))
+    if (check_entry_nonempty (ew->addr1_entry, NULL) &&
+            check_entry_nonempty (ew->addr2_entry, NULL) &&
+            check_entry_nonempty (ew->addr3_entry, NULL) &&
+            check_entry_nonempty (ew->addr4_entry, NULL))
     {
         const char *msg = _("You must enter an address.");
-        gnc_error_dialog (ew->dialog, "%s", msg);
+        gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
         return;
     }
 
diff --git a/gnucash/gnome/dialog-fincalc.c b/gnucash/gnome/dialog-fincalc.c
index 24b914b..25152cf 100644
--- a/gnucash/gnome/dialog-fincalc.c
+++ b/gnucash/gnome/dialog-fincalc.c
@@ -398,7 +398,7 @@ calc_value(FinCalcDialog *fcd, FinCalcValue value)
     {
         GtkWidget *entry;
 
-        gnc_error_dialog(fcd->dialog, "%s", string);
+        gnc_error_dialog (GTK_WINDOW (fcd->dialog), "%s", string);
         if (error_item == 0)
             entry = fcd->amounts[0];
         else
diff --git a/gnucash/gnome/dialog-invoice.c b/gnucash/gnome/dialog-invoice.c
index 78db3ef..1a93602 100644
--- a/gnucash/gnome/dialog-invoice.c
+++ b/gnucash/gnome/dialog-invoice.c
@@ -389,7 +389,7 @@ gnc_invoice_window_verify_ok (InvoiceWindow *iw)
     res = gncOwnerGetName (&(iw->owner));
     if (res == NULL || g_strcmp0 (res, "") == 0)
     {
-        gnc_error_dialog (iw_get_window(iw), "%s",
+        gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
                           /* Translators: In this context,
                            * 'Billing information' maps to the
                            * label in the frame and means
@@ -600,7 +600,7 @@ gnc_invoice_window_deleteCB (GtkWidget *widget, gpointer data)
         else
             msg = g_strdup (message);
 
-        result = gnc_verify_dialog (iw_get_window(iw), FALSE, "%s", msg);
+        result = gnc_verify_dialog (GTK_WINDOW (iw_get_window(iw)), FALSE, "%s", msg);
         g_free (msg);
 
         if (!result)
@@ -794,7 +794,7 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params)
     /* Check that there is at least one Entry */
     if (gncInvoiceGetEntries (invoice) == NULL)
     {
-        gnc_error_dialog (iw_get_window(iw), "%s",
+        gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
                           _("The Invoice must have at least one Entry."));
         return;
     }
@@ -853,7 +853,7 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params)
          */
         if (show_dialog)
         {
-            gnc_info_dialog(iw_get_window(iw), "%s", text);
+            gnc_info_dialog(GTK_WINDOW (iw_get_window(iw)), "%s", text);
             show_dialog = FALSE;
         }
 
@@ -967,7 +967,7 @@ cleanup:
     else
     {
         text = _("The post action was canceled because not all exchange rates were given.");
-        gnc_info_dialog(iw_get_window(iw), "%s", text);
+        gnc_info_dialog(GTK_WINDOW (iw_get_window(iw)), "%s", text);
     }
 
     /* ... and redisplay here. */
@@ -2943,7 +2943,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
     gnc_resume_gui_refresh ();
     if (test)
     {
-        gnc_error_dialog (iw_get_window(iw), "%s",
+        gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
                           _("One or more selected invoices have already been posted.\nRe-check your selection."));
         return;
     }
diff --git a/gnucash/gnome/dialog-job.c b/gnucash/gnome/dialog-job.c
index e7ee643..bc9ef54 100644
--- a/gnucash/gnome/dialog-job.c
+++ b/gnucash/gnome/dialog-job.c
@@ -137,7 +137,7 @@ gnc_job_verify_ok (JobWindow *jw)
     if (g_strcmp0 (res, "") == 0)
     {
         const char *message = _("The Job must be given a name.");
-        gnc_error_dialog(jw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (jw->dialog), "%s", message);
         return FALSE;
     }
 
@@ -147,7 +147,7 @@ gnc_job_verify_ok (JobWindow *jw)
     if (res == NULL || g_strcmp0 (res, "") == 0)
     {
         const char *message = _("You must choose an owner for this job.");
-        gnc_error_dialog(jw->dialog, "%s", message);
+        gnc_error_dialog (GTK_WINDOW (jw->dialog), "%s", message);
         return FALSE;
     }
 
diff --git a/gnucash/gnome/dialog-order.c b/gnucash/gnome/dialog-order.c
index ab0d480..34e7ad0 100644
--- a/gnucash/gnome/dialog-order.c
+++ b/gnucash/gnome/dialog-order.c
@@ -168,7 +168,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
     res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
     if (g_strcmp0 (res, "") == 0)
     {
-        gnc_error_dialog (ow->dialog, "%s",
+        gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
                           _("The Order must be given an ID."));
         return FALSE;
     }
@@ -178,7 +178,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
     res = gncOwnerGetName (&(ow->owner));
     if (res == NULL || g_strcmp0 (res, "") == 0)
     {
-        gnc_error_dialog (ow->dialog, "%s",
+        gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
                           _("You need to supply Billing Information."));
         return FALSE;
     }
@@ -274,7 +274,7 @@ gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
     /* Check that there is at least one Entry */
     if (gncOrderGetEntries (order) == NULL)
     {
-        gnc_error_dialog (ow->dialog, "%s",
+        gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
                           _("The Order must have at least one Entry."));
         return;
     }
@@ -301,7 +301,7 @@ gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
                     "Are you sure you want to close it out before "
                     "you invoice all the entries?");
 
-        if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
+        if (gnc_verify_dialog (GTK_WINDOW (ow->dialog), FALSE, "%s", message) == FALSE)
             return;
     }
 
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index b78d2c8..89557ea 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -954,7 +954,7 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
             text = _("The transfer and post accounts are associated with different currencies. Please specify the conversion rate.");
 
             xfer = gnc_xfer_dialog(pw->dialog, pw->post_acct);
-            gnc_info_dialog(pw->dialog, "%s", text);
+            gnc_info_dialog (GTK_WINDOW (pw->dialog), "%s", text);
 
             gnc_xfer_dialog_select_to_account(xfer, pw->xfer_acct);
             gnc_xfer_dialog_set_amount(xfer, pw->amount_tot);
@@ -1341,7 +1341,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
              * Let's assert this to protect from potential future changes. */
             g_assert (g_list_length (pw->acct_types) == 1);
             acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
-            gnc_warning_dialog(pw->dialog,
+            gnc_warning_dialog(GTK_WINDOW (pw->dialog),
                                _("You have no valid \"Post To\" accounts. "
                                  "Please create an account of type \"%s\" "
                                  "before you continue to process this payment. "
diff --git a/gnucash/gnome/dialog-price-edit-db.c b/gnucash/gnome/dialog-price-edit-db.c
index a3c1630..f6d5efb 100644
--- a/gnucash/gnome/dialog-price-edit-db.c
+++ b/gnucash/gnome/dialog-price-edit-db.c
@@ -452,7 +452,7 @@ gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
         GList *comm_list = gnc_prices_dialog_get_commodities (pdb_dialog->remove_view);
 
         // Are you sure you want to delete the entries and we have commodities
-        if ((g_list_length (comm_list) != 0) && (gnc_verify_dialog (pdb_dialog->remove_dialog, FALSE, fmt, NULL)))
+        if ((g_list_length (comm_list) != 0) && (gnc_verify_dialog (GTK_WINDOW (pdb_dialog->remove_dialog), FALSE, fmt, NULL)))
         {
             Timespec last_ts;
             GDate fiscal_end_date = get_fiscal_end_date ();
@@ -550,7 +550,7 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
     }
 
     scm_window =  SWIG_NewPointerObj(pdb_dialog->dialog,
-                                     SWIG_TypeQuery("_p_GtkWidget"), 0);
+                                     SWIG_TypeQuery("_p_GtkWindow"), 0);
 
     gnc_set_busy_cursor (NULL, TRUE);
     scm_call_2 (quotes_func, scm_window, book_scm);
diff --git a/gnucash/gnome/dialog-price-editor.c b/gnucash/gnome/dialog-price-editor.c
index 9a55f03..a787284 100644
--- a/gnucash/gnome/dialog-price-editor.c
+++ b/gnucash/gnome/dialog-price-editor.c
@@ -279,7 +279,7 @@ pedit_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
         error_str = gui_to_price (pedit_dialog);
         if (error_str)
         {
-            gnc_warning_dialog (pedit_dialog->dialog, "%s", error_str);
+            gnc_warning_dialog (GTK_WINDOW (pedit_dialog->dialog), "%s", error_str);
             return;
         }
 
diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index 33b1bae..61e246a 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -200,7 +200,7 @@ sxed_confirmed_cancel(GncSxEditorDialog *sxed)
         const char *sx_changed_msg =
             _( "This Scheduled Transaction has changed; are you "
                "sure you want to cancel?" );
-        if (!gnc_verify_dialog(sxed->dialog, FALSE, "%s", sx_changed_msg))
+        if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", sx_changed_msg))
         {
             return FALSE;
         }
@@ -490,7 +490,7 @@ gnc_sxed_check_names (GncSxEditorDialog *sxed)
     {
         const char *sx_has_no_name_msg =
             _( "Please name the Scheduled Transaction." );
-        gnc_error_dialog( sxed->dialog, "%s", sx_has_no_name_msg );
+        gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_has_no_name_msg );
         g_free( name );
         return FALSE;
 
@@ -517,7 +517,7 @@ gnc_sxed_check_names (GncSxEditorDialog *sxed)
         const char *sx_has_existing_name_msg =
             _("A Scheduled Transaction with the name \"%s\" already exists. "
               "Are you sure you want to name this one the same?");
-        if (!gnc_verify_dialog (sxed->dialog, FALSE,
+        if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
                                 sx_has_existing_name_msg, name))
         {
             g_free (name);
@@ -540,7 +540,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
     {
         const char *sx_end_spec_msg =
             _("Please provide a valid end selection.");
-        gnc_error_dialog (sxed->dialog, "%s", sx_end_spec_msg);
+        gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_end_spec_msg);
         return FALSE;
     }
 
@@ -555,7 +555,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
         {
             const char *sx_occur_count_zero_msg =
                 _("There must be some number of occurrences.");
-            gnc_error_dialog (sxed->dialog, "%s", sx_occur_count_zero_msg);
+            gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_occur_count_zero_msg);
             return FALSE;
         }
 
@@ -564,7 +564,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
             const char *sx_occur_counts_wrong_msg =
                 _("The number of remaining occurrences (%d) is greater than "
                   "the number of total occurrences (%d).");
-            gnc_error_dialog (sxed->dialog, sx_occur_counts_wrong_msg,
+            gnc_error_dialog (GTK_WINDOW (sxed->dialog), sx_occur_counts_wrong_msg,
                               rem, occur);
             return FALSE;
         }
@@ -593,7 +593,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
         const char *invalid_sx_check_msg =
             _("You have attempted to create a Scheduled Transaction which "
               "will never run. Do you really want to do this?");
-        if (!gnc_verify_dialog(sxed->dialog, FALSE,
+        if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
                                "%s", invalid_sx_check_msg))
             return FALSE;
     }
@@ -612,7 +612,7 @@ gnc_sxed_check_autocreate (GncSxEditorDialog *sxed, int ttVarCount,
 
     if (((ttVarCount > 0) || multi_commodity) && autocreateState)
     {
-        gnc_warning_dialog(sxed->dialog, "%s",
+        gnc_warning_dialog(GTK_WINDOW (sxed->dialog), "%s",
                            _("Scheduled Transactions with variables "
                              "or involving more than one commodity "
                              "cannot be automatically created."));
@@ -623,7 +623,7 @@ gnc_sxed_check_autocreate (GncSxEditorDialog *sxed, int ttVarCount,
      * only valid if there's actually a transaction to create. */
     if (autocreateState && splitCount == 0)
     {
-        gnc_warning_dialog(sxed->dialog, "%s",
+        gnc_warning_dialog(GTK_WINDOW (sxed->dialog), "%s",
                            _("Scheduled Transactions without a template "
                              "transaction cannot be automatically created.") );
         return FALSE;
@@ -672,7 +672,7 @@ gnc_sxed_split_calculate_formula (GncSxEditorDialog *sxed, Split *s,
     {
         gchar *err = g_strdup_printf (_("Couldn't parse %s for split \"%s\"."),
                                       key, xaccSplitGetMemo (s));
-        gnc_error_dialog (GTK_WIDGET(sxed->dialog), "%s", err);
+        gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", err);
         g_free (err);
 
         return FALSE;
@@ -870,7 +870,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
         const char *msg =
             _("The Scheduled Transaction Editor cannot automatically "
               "balance this transaction. Should it still be entered?");
-        if (!gnc_verify_dialog (sxed->dialog, FALSE, "%s", msg))
+        if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", msg))
             return FALSE;
     }
 
@@ -1557,7 +1557,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed)
         return;
     }
 
-    if (gnc_verify_dialog(sxed->dialog, TRUE, "%s", message))
+    if (gnc_verify_dialog (GTK_WINDOW (sxed->dialog), TRUE, "%s", message))
     {
         if ( !gnc_split_register_save( reg, TRUE ) )
             return;
diff --git a/gnucash/gnome/dialog-sx-editor2.c b/gnucash/gnome/dialog-sx-editor2.c
index f243e76..333da7f 100644
--- a/gnucash/gnome/dialog-sx-editor2.c
+++ b/gnucash/gnome/dialog-sx-editor2.c
@@ -198,7 +198,7 @@ sxed_confirmed_cancel (GncSxEditorDialog2 *sxed)
         const char *sx_changed_msg =
             _( "This Scheduled Transaction has changed; are you "
                "sure you want to cancel?" );
-        if (!gnc_verify_dialog (sxed->dialog, FALSE, "%s", sx_changed_msg))
+        if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", sx_changed_msg))
         {
             return FALSE;
         }
@@ -636,7 +636,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
 				     _( "Couldn't parse credit formula for "
 					"split \"%s\"." ),
 				     xaccSplitGetMemo( s ) );
-		    gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
+                    gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
 				      errStr->str );
 		    g_string_free( errStr, TRUE );
 
@@ -658,7 +658,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
 				     _( "Couldn't parse debit formula for "
 					"split \"%s\"." ),
 				     xaccSplitGetMemo( s ) );
-		    gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
+                    gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
 				      (gchar*)errStr->str );
 		    g_string_free( errStr, TRUE );
 
@@ -686,7 +686,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
         g_hash_table_destroy (txns);
 
         if (unbalanceable
-                && !gnc_verify_dialog (sxed->dialog, FALSE,
+                && !gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
                                        "%s",
                                        _("The Scheduled Transaction Editor "
                                          "cannot automatically balance "
@@ -710,7 +710,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
         {
             const char *sx_has_no_name_msg =
                 _("Please name the Scheduled Transaction.");
-            gnc_error_dialog (sxed->dialog, "%s", sx_has_no_name_msg);
+            gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_has_no_name_msg);
             g_free (name);
             return FALSE;
 
@@ -740,7 +740,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
                    "name \"%s\" already exists. "
                    "Are you sure you want to name "
                    "this one the same?");
-            if (!gnc_verify_dialog (sxed->dialog, FALSE,
+            if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
                                       sx_has_existing_name_msg,
                                       name))
             {
@@ -763,7 +763,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
 
         if (((ttVarCount > 0) || multi_commodity) && autocreateState)
         {
-            gnc_warning_dialog (sxed->dialog, "%s",
+            gnc_warning_dialog (GTK_WINDOW (sxed->dialog), "%s",
                                _("Scheduled Transactions with variables "
                                  "cannot be automatically created."));
             return FALSE;
@@ -773,7 +773,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
          * only valid if there's actually a transaction to create. */
         if (autocreateState && splitCount == 0)
         {
-            gnc_warning_dialog (sxed->dialog, "%s",
+            gnc_warning_dialog (GTK_WINDOW (sxed->dialog), "%s",
                                _("Scheduled Transactions without a template "
                                  "transaction cannot be automatically created."));
             return FALSE;
@@ -790,7 +790,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
         {
             const char *sx_end_spec_msg =
                 _("Please provide a valid end selection.");
-            gnc_error_dialog (sxed->dialog, "%s", sx_end_spec_msg);
+            gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_end_spec_msg);
             return FALSE;
         }
 
@@ -808,7 +808,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
             {
                 const char *sx_occur_count_zero_msg =
                     _("There must be some number of occurrences.");
-                gnc_error_dialog (sxed->dialog, "%s",
+                gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
                                   sx_occur_count_zero_msg);
                 return FALSE;
             }
@@ -819,7 +819,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
                     _("The number of remaining occurrences "
                        "(%d) is greater than the number of "
                        "total occurrences (%d).");
-                gnc_error_dialog (sxed->dialog,
+                gnc_error_dialog (GTK_WINDOW (sxed->dialog),
                                   sx_occur_counts_wrong_msg,
                                   rem, occur);
                 return FALSE;
@@ -851,7 +851,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
                 _("You have attempted to create a Scheduled "
                   "Transaction which will never run. Do you "
                   "really want to do this?");
-            if (!gnc_verify_dialog (sxed->dialog, FALSE,
+            if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
                                    "%s", invalid_sx_check_msg))
                 return FALSE;
         }
@@ -1521,7 +1521,7 @@ gnc_sxed_reg_check_close (GncSxEditorDialog2 *sxed)
     if (dirty_trans == NULL)
         return;
 
-    if (gnc_verify_dialog (sxed->dialog, TRUE, "%s", message))
+    if (gnc_verify_dialog (GTK_WINDOW (sxed->dialog), TRUE, "%s", message))
     {
         /* Save the template transactions changes */
         xaccTransCommitEdit (dirty_trans);
diff --git a/gnucash/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.c
index cb8ef55..f300b1e 100644
--- a/gnucash/gnome/dialog-sx-from-trans.c
+++ b/gnucash/gnome/dialog-sx-from-trans.c
@@ -256,7 +256,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
     }
 
     if ( ! gnc_numeric_zero_p( runningBalance )
-            && !gnc_verify_dialog( (GtkWidget *)sxfti->dialog,
+            && !gnc_verify_dialog (GTK_WINDOW (sxfti->dialog),
                                    FALSE, "%s",
                                    _("The Scheduled Transaction Editor "
                                      "cannot automatically balance "
@@ -553,7 +553,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
     {
         if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION )
         {
-            gnc_error_dialog (NULL, "%s",
+            gnc_error_dialog (GTK_WINDOW (sxfti->dialog), "%s",
                               _( "The Scheduled Transaction is unbalanced. "
                                  "You are strongly encouraged to correct this situation." ) );
         }
diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
index 372a274..f5d8658 100644
--- a/gnucash/gnome/dialog-trans-assoc.c
+++ b/gnucash/gnome/dialog-trans-assoc.c
@@ -272,7 +272,8 @@ row_selected_cb (GtkTreeView *view, GtkTreePath *path,
             g_free (uri_scheme);
         }
         else
-            gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
+            gnc_error_dialog (gnc_ui_get_gtk_window(GTK_WIDGET (view)),
+                              "%s", _("This transaction is not associated with a valid URI."));
     }
 
     // Open transaction
diff --git a/gnucash/gnome/dialog-vendor.c b/gnucash/gnome/dialog-vendor.c
index d7e1d7d..3eda233 100644
--- a/gnucash/gnome/dialog-vendor.c
+++ b/gnucash/gnome/dialog-vendor.c
@@ -190,14 +190,14 @@ static void gnc_ui_to_vendor (VendorWindow *vw, GncVendor *vendor)
     gnc_resume_gui_refresh ();
 }
 
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+static gboolean check_entry_nonempty (GtkWidget *entry,
                                       const char * error_message)
 {
     const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
     if (g_strcmp0 (res, "") == 0)
     {
         if (error_message)
-            gnc_error_dialog (dialog, "%s", error_message);
+            gnc_error_dialog (gnc_ui_get_gtk_window (entry), "%s", error_message);
         return TRUE;
     }
     return FALSE;
@@ -210,7 +210,7 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
     gchar *string;
 
     /* Check for valid company name */
-    if (check_entry_nonempty (vw->dialog, vw->company_entry,
+    if (check_entry_nonempty (vw->company_entry,
                               _("You must enter a company name. "
                                 "If this vendor is an individual (and not a company) "
                                 "you should enter the same value for:\nIdentification "
@@ -218,13 +218,13 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
         return;
 
     /* Make sure we have an address */
-    if (check_entry_nonempty (vw->dialog, vw->addr1_entry, NULL) &&
-            check_entry_nonempty (vw->dialog, vw->addr2_entry, NULL) &&
-            check_entry_nonempty (vw->dialog, vw->addr3_entry, NULL) &&
-            check_entry_nonempty (vw->dialog, vw->addr4_entry, NULL))
+    if (check_entry_nonempty (vw->addr1_entry, NULL) &&
+            check_entry_nonempty (vw->addr2_entry, NULL) &&
+            check_entry_nonempty (vw->addr3_entry, NULL) &&
+            check_entry_nonempty (vw->addr4_entry, NULL))
     {
         const char *msg = _("You must enter a payment address.");
-        gnc_error_dialog (vw->dialog, "%s", msg);
+        gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
         return;
     }
 
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index d047fe3..e858fc0 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -580,11 +580,11 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
     {
         if (summary.num_auto_create_no_notify_instances == 0)
         {
-            gnc_info_dialog(GTK_WIDGET(&window->gtk_window), "%s", nothing_to_do_msg);
+            gnc_info_dialog(GTK_WINDOW (window), "%s", nothing_to_do_msg);
         }
         else
         {
-            gnc_info_dialog(GTK_WIDGET(&window->gtk_window), ngettext
+            gnc_info_dialog(GTK_WINDOW (window), ngettext
                             /* Translators: %d is the number of transactions. This is a
                                ngettext(3) message. */
                             ("There are no Scheduled Transactions to be entered at this time. "
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index d0cab8e..b42270d 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -694,7 +694,8 @@ gnc_plugin_page_register_new (Account *account, gboolean subaccounts)
 
         if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (new_account)))
         {
-            gnc_error_dialog (NULL, "%s",
+            GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (new_register_page)));
+            gnc_error_dialog (window, "%s",
                          _("You have tried to open an account in the old register while it is open in the new register."));
             return NULL;
         }
@@ -1570,7 +1571,7 @@ gnc_plugin_page_register_finish_pending (GncPluginPage *page)
         return TRUE;
 
     name = gnc_plugin_page_register_get_tab_name(page);
-    window = gnc_plugin_page_get_window(page);
+    window = gnc_plugin_page_get_window (page);
     dialog = gtk_message_dialog_new(GTK_WINDOW(window),
                                     GTK_DIALOG_DESTROY_WITH_PARENT,
                                     GTK_MESSAGE_WARNING,
@@ -2802,7 +2803,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
     priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
     reg = gnc_ledger_display_get_split_register (priv->ledger);
     ledger_type = gnc_ledger_display_type(priv->ledger);
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
     if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
     {
         account  = gnc_plugin_page_register_get_account (plugin_page);
@@ -2879,7 +2880,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
     }
     else
     {
-        gnc_error_dialog(window, "%s",
+        gnc_error_dialog(GTK_WINDOW (window), "%s",
                          _("You can only print checks from a bank account register or search results."));
         LEAVE("Unsupported ledger type");
         return;
@@ -2957,8 +2958,7 @@ gnc_plugin_page_register_cmd_find_account (GtkAction *action,
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
 
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
-
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
     gnc_find_account_dialog (window, NULL);
 }
 
@@ -3041,11 +3041,13 @@ gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
     GtkBuilder *builder;
     const char *reason;
     gint result;
+    GtkWindow *window;
 
     ENTER("(action %p, page %p)", action, page);
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
 
+    window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
     reg = gnc_ledger_display_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
@@ -3055,13 +3057,13 @@ gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
         return;
     if (xaccTransHasReconciledSplits(trans) || xaccTransHasSplitsInState(trans, CREC))
     {
-        gnc_error_dialog(NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
+        gnc_error_dialog (window, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
         return;
     }
     reason = xaccTransGetReadOnly (trans);
     if (reason)
     {
-        gnc_error_dialog(NULL, _("This transaction is marked read-only with the comment: '%s'"), reason);
+        gnc_error_dialog(window, _("This transaction is marked read-only with the comment: '%s'"), reason);
         return;
     }
 
@@ -3131,7 +3133,7 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
 
     if (xaccTransGetReversedBy(trans))
     {
-        gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)), "%s",
+        gnc_error_dialog(GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))), "%s",
                          _("A reversing entry has already been created for this transaction."));
         return;
     }
@@ -4155,7 +4157,7 @@ gnc_plugin_page_register_event_handler (QofInstance *entity,
     ENTER("entity %p of type %d, page %p, event data %p",
           entity, event_type, page, ed);
 
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
 
     if (GNC_IS_ACCOUNT(entity))
     {
diff --git a/gnucash/gnome/gnc-plugin-page-register2.c b/gnucash/gnome/gnc-plugin-page-register2.c
index ff69d3d..bd10fa9 100644
--- a/gnucash/gnome/gnc-plugin-page-register2.c
+++ b/gnucash/gnome/gnc-plugin-page-register2.c
@@ -678,7 +678,8 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
 
         if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
         {
-            gnc_error_dialog (NULL, "%s",
+            GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (old_register_page)));
+            gnc_error_dialog (window, "%s",
                          _("You have tried to open an account in the new register while it is open in the old register."));
             return NULL;
         }
@@ -2624,7 +2625,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
                     gnc_ui_print_check_dialog_create (window, splits);
                     g_list_free(splits);
                 }
-            }           
+            }
         }
     }
     else if (ledger_type == LD2_GL && model->type == SEARCH_LEDGER2)
@@ -2675,7 +2676,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
     }
     else
     {
-        gnc_error_dialog (window, "%s",
+        gnc_error_dialog (GTK_WINDOW (window), "%s",
                          _("You can only print checks from a bank account register or search results."));
         LEAVE("Unsupported ledger type");
         return;
@@ -2769,7 +2770,7 @@ gnc_plugin_page_register2_cmd_find_account (GtkAction *action,
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
-    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
 
     gnc_find_account_dialog (window, NULL);
 }
@@ -2869,6 +2870,7 @@ gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action,
     }
     if (xaccTransHasReconciledSplits (trans) || xaccTransHasSplitsInState (trans, CREC))
     {
+        GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
         gnc_error_dialog (NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
         LEAVE("trans with reconciled splits");
         return;
@@ -4032,7 +4034,7 @@ gnc_plugin_page_register2_event_handler (QofInstance *entity,
     ENTER("entity %p of type %d, page %p, event data %p",
           entity, event_type, page, ed);
 
-    window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
+    window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
 
     if (GNC_IS_ACCOUNT(entity))
     {
diff --git a/gnucash/gnome/gnc-plugin-page-sx-list.c b/gnucash/gnome/gnc-plugin-page-sx-list.c
index 79da000..e233459 100644
--- a/gnucash/gnome/gnc-plugin-page-sx-list.c
+++ b/gnucash/gnome/gnc-plugin-page-sx-list.c
@@ -747,6 +747,7 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
     GtkTreeSelection *selection;
     GList *selected_paths, *to_delete = NULL;
     GtkTreeModel *model;
+    GtkWindow *window;
 
     selection = gtk_tree_view_get_selection(priv->tree_view);
     selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
@@ -767,11 +768,12 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
         }
     }
 
+    window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     /* FIXME: Does this always refer to only one transaction? Or could
        multiple SXs be deleted as well? Ideally, the number of
        to-be-deleted SXs should be mentioned here; see
        dialog-sx-since-last-run.c:807 */
-    if (gnc_verify_dialog(NULL, FALSE, "%s", _("Do you really want to delete this scheduled transaction?")))
+    if (gnc_verify_dialog (window, FALSE, "%s", _("Do you really want to delete this scheduled transaction?")))
     {
         g_list_foreach(to_delete, (GFunc)_destroy_sx, NULL);
     }
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 678d1b5..e01223a 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -762,8 +762,8 @@ gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
 
     if (xaccTransGetReversedBy(trans))
     {
-        gnc_error_dialog(gsr->window, "%s",
-                         _("A reversing entry has already been created for this transaction."));
+        gnc_error_dialog (GTK_WINDOW (gsr->window), "%s",
+                          _("A reversing entry has already been created for this transaction."));
         return;
     }
 
@@ -1114,7 +1114,7 @@ gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
     uri = xaccTransGetAssociation (trans);
 
     if (g_strcmp0 (uri, "") == 0 && g_strcmp0 (uri, NULL) == 0)
-        gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a URI."));
+        gnc_error_dialog (GTK_WINDOW (gsr->window), "%s", _("This transaction is not associated with a URI."));
     else
     {
         if (g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) // Check for relative path
@@ -1140,7 +1140,7 @@ gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
             g_free (uri_scheme);
         }
         else
-            gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
+            gnc_error_dialog (GTK_WINDOW (gsr->window), "%s", _("This transaction is not associated with a valid URI."));
     }
     return;
 }
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index cb8104b..90444f8 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1314,7 +1314,7 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data)
                                 "transaction?");
         gboolean result;
 
-        result = gnc_verify_dialog(recnData->window, FALSE, "%s", message);
+        result = gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message);
 
         if (!result)
             return;
@@ -1990,7 +1990,7 @@ recn_cancel(RecnWindow *recnData)
     {
         const char *message = _("You have made changes to this reconcile "
                                 "window. Are you sure you want to cancel?");
-        if (!gnc_verify_dialog(recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
@@ -2108,7 +2108,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
     {
         const char *message = _("The account is not balanced. "
                                 "Are you sure you want to finish?");
-        if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
@@ -2165,7 +2165,7 @@ recnPostponeCB (GtkAction *action, gpointer data)
     {
         const char *message = _("Do you want to postpone this reconciliation "
                                 "and finish it later?");
-        if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
diff --git a/gnucash/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
index a337b18..3b8082f 100644
--- a/gnucash/gnome/window-reconcile2.c
+++ b/gnucash/gnome/window-reconcile2.c
@@ -1278,7 +1278,7 @@ gnc_ui_reconcile_window_delete_cb (GtkButton *button, gpointer data)
                                 "transaction?");
         gboolean result;
 
-        result = gnc_verify_dialog (recnData->window, FALSE, "%s", message);
+        result = gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message);
 
         if (!result)
             return;
@@ -1951,7 +1951,7 @@ recn_cancel (RecnWindow2 *recnData)
     {
         const char *message = _("You have made changes to this reconcile "
                                 "window. Are you sure you want to cancel?");
-        if (!gnc_verify_dialog(recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
@@ -2069,7 +2069,7 @@ recnFinishCB (GtkAction *action, RecnWindow2 *recnData)
     {
         const char *message = _("The account is not balanced. "
                                 "Are you sure you want to finish?");
-        if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
@@ -2126,7 +2126,7 @@ recnPostponeCB (GtkAction *action, gpointer data)
     {
         const char *message = _("Do you want to postpone this reconciliation "
                                 "and finish it later?");
-        if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
+        if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
             return;
     }
 
diff --git a/gnucash/html/gnc-html-webkit1.c b/gnucash/html/gnc-html-webkit1.c
index 0b0fadd..908d165 100644
--- a/gnucash/html/gnc-html-webkit1.c
+++ b/gnucash/html/gnc-html-webkit1.c
@@ -543,7 +543,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
             {
                 if ( !https_allowed() )
                 {
-                    gnc_error_dialog( priv->base.parent, "%s",
+                    gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                       _("Secure HTTP access is disabled. "
                                         "You can enable it in the Network section of "
                                         "the Preferences dialog."));
@@ -553,7 +553,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
 
             if ( !http_allowed() )
             {
-                gnc_error_dialog( priv->base.parent, "%s",
+                gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                   _("Network HTTP access is disabled. "
                                     "You can enable it in the Network section of "
                                     "the Preferences dialog."));
@@ -887,12 +887,12 @@ impl_webkit_show_url( GncHtml* self, URLType type,
         {
             if ( result.error_message )
             {
-                gnc_error_dialog( priv->base.parent, "%s", result.error_message );
+                gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s", result.error_message );
             }
             else
             {
                 /* %s is a URL (some location somewhere). */
-                gnc_error_dialog( priv->base.parent, _("There was an error accessing %s."), location );
+                gnc_error_dialog (GTK_WINDOW (priv->base.parent), _("There was an error accessing %s."), location );
             }
 
             if ( priv->base.load_cb )
@@ -958,7 +958,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
             {
                 if ( !https_allowed() )
                 {
-                    gnc_error_dialog( priv->base.parent, "%s",
+                    gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                       _("Secure HTTP access is disabled. "
                                         "You can enable it in the Network section of "
                                         "the Preferences dialog.") );
@@ -970,7 +970,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
             {
                 if ( !http_allowed() )
                 {
-                    gnc_error_dialog( priv->base.parent, "%s",
+                    gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                       _("Network HTTP access is disabled. "
                                         "You can enable it in the Network section of "
                                         "the Preferences dialog.") );
diff --git a/gnucash/html/gnc-html-webkit2.c b/gnucash/html/gnc-html-webkit2.c
index 3a0f079..13d5207 100644
--- a/gnucash/html/gnc-html-webkit2.c
+++ b/gnucash/html/gnc-html-webkit2.c
@@ -561,7 +561,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
                {
                     if ( !https_allowed() )
                     {
-                         gnc_error_dialog( priv->base.parent, "%s",
+                        gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                            _("Secure HTTP access is disabled. "
                                              "You can enable it in the Network section of "
                                              "the Preferences dialog."));
@@ -571,7 +571,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
 
                if ( !http_allowed() )
                {
-                    gnc_error_dialog( priv->base.parent, "%s",
+                   gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                       _("Network HTTP access is disabled. "
                                         "You can enable it in the Network section of "
                                         "the Preferences dialog."));
@@ -859,12 +859,12 @@ impl_webkit_show_url( GncHtml* self, URLType type,
           {
                if ( result.error_message )
                {
-                    gnc_error_dialog( priv->base.parent, "%s", result.error_message );
+                   gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s", result.error_message );
                }
                else
                {
                     /* %s is a URL (some location somewhere). */
-                    gnc_error_dialog( priv->base.parent, _("There was an error accessing %s."), location );
+                    gnc_error_dialog (GTK_WINDOW (priv->base.parent), _("There was an error accessing %s."), location );
                }
 
                if ( priv->base.load_cb )
@@ -930,7 +930,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
                {
                     if ( !https_allowed() )
                     {
-                         gnc_error_dialog( priv->base.parent, "%s",
+                        gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                            _("Secure HTTP access is disabled. "
                                              "You can enable it in the Network section of "
                                              "the Preferences dialog.") );
@@ -942,7 +942,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
                {
                     if ( !http_allowed() )
                     {
-                         gnc_error_dialog( priv->base.parent, "%s",
+                        gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
                                            _("Network HTTP access is disabled. "
                                              "You can enable it in the Network section of "
                                              "the Preferences dialog.") );
diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 50c12bd..920a58d 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -373,7 +373,7 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
     {
         g_warning("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
         gnc_error_dialog
-        (info->window,
+        (GTK_WINDOW (info->window),
          _("The external program \"AqBanking Setup Wizard\" has not "
            "been found. \n\n"
            "The %s package should include the "
@@ -530,7 +530,7 @@ child_exit_cb(GPid pid, gint status, gpointer data)
                       "value: %d. The called program was \"%s\".\n",
                       exit_status, deferred_info->wizard_path);
             gnc_error_dialog
-            (info->window, "%s",
+            (GTK_WINDOW (info->window), "%s",
              _("The external program \"AqBanking Setup Wizard\" failed "
                "to run successfully because the "
                "additional software \"Qt\" was not found. "
@@ -551,7 +551,7 @@ child_exit_cb(GPid pid, gint status, gpointer data)
                       "value: %d. The called program was \"%s\".\n",
                       exit_status, deferred_info->wizard_path);
             gnc_error_dialog
-            (info->window, "%s",
+            (GTK_WINDOW (info->window), "%s",
              _("The external program \"AqBanking Setup Wizard\" failed "
                "to run successfully. Online Banking can only be setup "
                "if this wizard has run successfully. "
diff --git a/gnucash/import-export/aqb/dialog-ab-trans.c b/gnucash/import-export/aqb/dialog-ab-trans.c
index dc4480a..c3244f2 100644
--- a/gnucash/import-export/aqb/dialog-ab-trans.c
+++ b/gnucash/import-export/aqb/dialog-ab-trans.c
@@ -606,7 +606,7 @@ gnc_ab_trans_dialog_verify_values(GncABTransDialog *td)
             const char* localBankCode = AB_Transaction_GetLocalBankCode(td->ab_trans);
             const char* localAccountCode = AB_Transaction_GetLocalAccountNumber(td->ab_trans);
             values_ok = FALSE;
-            gnc_error_dialog(td->dialog,
+            gnc_error_dialog(GTK_WINDOW (td->dialog),
                              _("Your local bank account does not yet have the SEPA account information stored."
                                " We are sorry, but in this development version one additional step is necessary "
                                "which has not yet been implemented directly in gnucash. "
@@ -1179,7 +1179,7 @@ gnc_ab_trans_dialog_add_templ_cb(GtkButton *button, gpointer user_data)
                                find_templ_helper, &data);
         if (data.pointer)
         {
-            gnc_error_dialog(dialog, "%s",
+            gnc_error_dialog(GTK_WINDOW (dialog), "%s",
                              _("A template with the given name already exists. "
                                "Please enter another name."));
             continue;
@@ -1313,8 +1313,8 @@ gnc_ab_trans_dialog_del_templ_cb(GtkButton *button, gpointer user_data)
     }
 
     gtk_tree_model_get(model, &iter, TEMPLATE_NAME, &name, -1);
-    if (gnc_verify_dialog(
-                td->parent, FALSE,
+    if (gnc_verify_dialog (
+                GTK_WINDOW (td->parent), FALSE,
                 _("Do you really want to delete the template with the name \"%s\"?"),
                 name))
     {
diff --git a/gnucash/import-export/aqb/gnc-ab-getbalance.c b/gnucash/import-export/aqb/gnc-ab-getbalance.c
index 19569de..3a2c6cb 100644
--- a/gnucash/import-export/aqb/gnc-ab-getbalance.c
+++ b/gnucash/import-export/aqb/gnc-ab-getbalance.c
@@ -80,7 +80,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
     if (!ab_acc)
     {
         g_warning("gnc_ab_getbalance: No AqBanking account found");
-        gnc_error_dialog(parent, _("No valid online banking account assigned."));
+        gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
         goto cleanup;
     }
 
@@ -94,7 +94,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
     {
         g_warning("gnc_ab_getbalance: JobGetBalance not available for this "
                   "account");
-        gnc_error_dialog(parent, _("Online action \"Get Balance\" not available for this account."));
+        gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Balance\" not available for this account."));
         goto cleanup;
     }
     job_list = AB_Job_List2_new();
@@ -127,9 +127,9 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
             && job_status != AB_Job_StatusPending)
     {
         g_warning("gnc_ab_getbalance: Error on executing job");
-        gnc_error_dialog(parent, _("Error on executing job.\n\nStatus: %s - %s")
-                         , AB_Job_Status2Char(job_status)
-                         , AB_Job_GetResultText(job));
+        gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
+                          AB_Job_Status2Char(job_status),
+                          AB_Job_GetResultText(job));
         goto cleanup;
     }
 
diff --git a/gnucash/import-export/aqb/gnc-ab-gettrans.c b/gnucash/import-export/aqb/gnc-ab-gettrans.c
index f5a236e..8a7641f 100644
--- a/gnucash/import-export/aqb/gnc-ab-gettrans.c
+++ b/gnucash/import-export/aqb/gnc-ab-gettrans.c
@@ -134,7 +134,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
     if (!ab_acc)
     {
         g_warning("gnc_ab_gettrans: No AqBanking account found");
-        gnc_error_dialog(parent, _("No valid online banking account assigned."));
+        gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
         goto cleanup;
     }
 
@@ -157,7 +157,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
     {
         g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
                   "account");
-        gnc_error_dialog(parent, _("Online action \"Get Transactions\" not available for this account."));
+        gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Transactions\" not available for this account."));
         goto cleanup;
     }
     AB_JobGetTransactions_SetFromTime(job, from_date);
@@ -192,9 +192,9 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
             && job_status != AB_Job_StatusPending)
     {
         g_warning("gnc_ab_gettrans: Error on executing job");
-        gnc_error_dialog(parent, _("Error on executing job.\n\nStatus: %s - %s")
-                         , AB_Job_Status2Char(job_status)
-                         , AB_Job_GetResultText(job));
+        gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
+                          AB_Job_Status2Char(job_status),
+                          AB_Job_GetResultText(job));
         goto cleanup;
     }
 
diff --git a/gnucash/import-export/aqb/gnc-ab-transfer.c b/gnucash/import-export/aqb/gnc-ab-transfer.c
index abb68b3..128e94b 100644
--- a/gnucash/import-export/aqb/gnc-ab-transfer.c
+++ b/gnucash/import-export/aqb/gnc-ab-transfer.c
@@ -56,8 +56,8 @@ save_templates(GtkWidget *parent, Account *gnc_acc, GList *templates,
                gboolean dont_ask)
 {
     g_return_if_fail(gnc_acc);
-    if (dont_ask || gnc_verify_dialog(
-                parent, FALSE, "%s",
+    if (dont_ask || gnc_verify_dialog (
+                GTK_WINDOW (parent), FALSE, "%s",
                 _("You have changed the list of online transfer templates, "
                   "but you cancelled the transfer dialog. "
                   "Do you nevertheless want to store the changes?")))
@@ -113,7 +113,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
     if (!ab_acc)
     {
         g_warning("gnc_ab_gettrans: No AqBanking account found");
-        gnc_error_dialog(parent, _("No valid online banking account assigned."));
+        gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
         goto cleanup;
     }
 
@@ -180,8 +180,8 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
 #endif
                                             ))
         {
-            if (!gnc_verify_dialog(
-                        parent, FALSE, "%s",
+            if (!gnc_verify_dialog (
+                        GTK_WINDOW (parent), FALSE, "%s",
                         _("The backend found an error during the preparation "
                           "of the job. It is not possible to execute this job. \n"
                           "\n"
@@ -289,8 +289,8 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
                     && job_status != AB_Job_StatusPending)
             {
                 successful = FALSE;
-                if (!gnc_verify_dialog(
-                            parent, FALSE, "%s",
+                if (!gnc_verify_dialog (
+                            GTK_WINDOW (parent), FALSE, "%s",
                             _("An error occurred while executing the job. Please check "
                               "the log window for the exact error message.\n"
                               "\n"
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index c06d927..161aca6 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -715,7 +715,7 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
         {
             /* Oops, no job, probably not supported by bank */
             if (gnc_verify_dialog(
-                        NULL, FALSE, "%s",
+                        GTK_WINDOW (data->parent), FALSE, "%s",
                         _("The backend found an error during the preparation "
                           "of the job. It is not possible to execute this job. \n"
                           "\n"
@@ -726,7 +726,8 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
                           "\n"
                           "Do you want to enter the job again?")))
             {
-                gnc_error_dialog(NULL, "Sorry, not implemented yet. Please check the console or trace file logs to see which job was rejected.");
+                gnc_error_dialog (GTK_WINDOW (data->parent),
+                                  "Sorry, not implemented yet. Please check the console or trace file logs to see which job was rejected.");
             }
         }
         else
@@ -807,7 +808,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
 
     if (!(data->awaiting & AWAIT_TRANSACTIONS))
     {
-        if (gnc_verify_dialog(data->parent, TRUE, "%s",
+        if (gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s",
                               _("The bank has sent transaction information "
                                 "in its response."
                                 "\n"
@@ -834,7 +835,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
         data->ab_acc = gnc_ab_get_ab_account(data->api, gnc_acc);
         if (!data->ab_acc)
         {
-            gnc_error_dialog(NULL, "%s",
+            gnc_error_dialog(GTK_WINDOW (data->parent), "%s",
                              _("No Online Banking account found for this "
                                "gnucash account. These transactions will "
                                "not be executed by Online Banking."));
@@ -911,7 +912,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
             return NULL;
 
         /* Ask the user whether to import unawaited non-zero balance */
-        if (gnc_verify_dialog(data->parent, TRUE, "%s",
+        if (gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s",
                               _("The bank has sent balance information "
                                 "in its response."
                                 "\n"
@@ -1047,7 +1048,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
         {
             const char *message3 = _("Reconcile account now?");
 
-            show_recn_window = gnc_verify_dialog(data->parent, TRUE, "%s\n%s\n%s",
+            show_recn_window = gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s\n%s\n%s",
                                                  message1, message2, message3);
         }
         g_free(booked_str);
@@ -1110,7 +1111,7 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
         {
             const char* subject = AB_Message_GetSubject(bankmsg);
             const char* text = AB_Message_GetText(bankmsg);
-            gnc_info_dialog(data->parent, "%s\n%s %s\n%s",
+            gnc_info_dialog(GTK_WINDOW (data->parent), "%s\n%s %s\n%s",
                             _("The bank has sent a message in its response."),
                             _("Subject:"),
                             subject,
diff --git a/gnucash/import-export/aqb/gnc-gwen-gui.c b/gnucash/import-export/aqb/gnc-gwen-gui.c
index eebc20a..db8792f 100644
--- a/gnucash/import-export/aqb/gnc-gwen-gui.c
+++ b/gnucash/import-export/aqb/gnc-gwen-gui.c
@@ -1087,7 +1087,7 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text,
             gchar *msg = g_strdup_printf(
                              _("The PIN needs to be at least %d characters \n"
                                "long. Do you want to try again?"), min_len);
-            retval = gnc_verify_dialog(gui->parent, TRUE, "%s", msg);
+            retval = gnc_verify_dialog (GTK_WINDOW (gui->parent), TRUE, "%s", msg);
             g_free(msg);
             if (!retval)
                 break;
@@ -1589,7 +1589,7 @@ ggg_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
         const char *still_running_msg =
             _("The Online Banking job is still running; are you "
               "sure you want to cancel?");
-        if (!gnc_verify_dialog(gui->dialog, FALSE, "%s", still_running_msg))
+        if (!gnc_verify_dialog (GTK_WINDOW (gui->dialog), FALSE, "%s", still_running_msg))
             return FALSE;
 
         set_aborted(gui);
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 1ec3c53..8ae4f9c 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import-gui.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import-gui.c
@@ -210,9 +210,9 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
         gnc_bi_import_fix_bis (gui->store, &n_fixed, &n_deleted, info, gui->type);
         gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated, gui->type, gui->open_mode, info);
         if (info->len > 0)
-            gnc_info_dialog (gui->dialog, "%s", info->str);
+            gnc_info_dialog (GTK_WINDOW (gui->dialog), "%s", info->str);
         g_string_free( info, TRUE );
-        gnc_info_dialog (gui->dialog, _("Import results:\n%i lines were ignored\n%i lines imported:\n   %u fixes\n   %u ignored (not fixable)\n\n   %u created\n   %u updated (based on id)"), stats.n_ignored, stats.n_imported, n_fixed, n_deleted, n_invoices_created, n_invoices_updated);
+        gnc_info_dialog (GTK_WINDOW (gui->dialog), _("Import results:\n%i lines were ignored\n%i lines imported:\n   %u fixes\n   %u ignored (not fixable)\n\n   %u created\n   %u updated (based on id)"), stats.n_ignored, stats.n_imported, n_fixed, n_deleted, n_invoices_created, n_invoices_updated);
         if (stats.n_ignored > 0)
             gnc_info2_dialog (gui->dialog, _("These lines were ignored during import"), stats.ignored_lines->str);
 
@@ -221,11 +221,11 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
     }
     else if (res ==  RESULT_OPEN_FAILED)
     {
-        gnc_error_dialog (gui->dialog, _("The input file can not be opened."));
+        gnc_error_dialog (GTK_WINDOW (gui->dialog), _("The input file can not be opened."));
     }
     else if (res ==  RESULT_ERROR_IN_REGEXP)
     {
-        //gnc_error_dialog (gui->dialog, "The regular expression is faulty:\n\n%s", stats.err->str);
+        //gnc_error_dialog (GTK_WINDOW (gui->dialog), "The regular expression is faulty:\n\n%s", stats.err->str);
     }
 }
 
diff --git a/gnucash/import-export/bi-import/dialog-bi-import.c b/gnucash/import-export/bi-import/dialog-bi-import.c
index ab146cb..4587bcb 100644
--- a/gnucash/import-export/bi-import/dialog-bi-import.c
+++ b/gnucash/import-export/bi-import/dialog-bi-import.c
@@ -98,7 +98,7 @@ gnc_bi_import_read_file (const gchar * filename, const gchar * parser_regexp,
     f = g_fopen (filename, "rt");
     if (!f)
     {
-        //gnc_error_dialog( 0, _("File %s cannot be opened."), filename );
+        //gnc_error_dialog (NULL, _("File %s cannot be opened."), filename );
         return RESULT_OPEN_FAILED;
     }
 
diff --git a/gnucash/import-export/csv-exp/assistant-csv-export.c b/gnucash/import-export/csv-exp/assistant-csv-export.c
index 7e05461..a39090c 100644
--- a/gnucash/import-export/csv-exp/assistant-csv-export.c
+++ b/gnucash/import-export/csv-exp/assistant-csv-export.c
@@ -146,7 +146,7 @@ csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info)
                                    "Are you sure you want to overwrite it?");
 
             /* if user says cancel, we should break out */
-            if (!gnc_verify_dialog (NULL, FALSE, format, file_name))
+            if (!gnc_verify_dialog (GTK_WINDOW (assistant), FALSE, format, file_name))
                 return;
         }
 
diff --git a/gnucash/import-export/csv-imp/assistant-csv-account-import.c b/gnucash/import-export/csv-imp/assistant-csv-account-import.c
index 916ecdb..aaceb5e 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-account-import.c
+++ b/gnucash/import-export/csv-imp/assistant-csv-account-import.c
@@ -168,7 +168,7 @@ csv_import_file_chooser_confirm_cb (GtkWidget *button, CsvImportInfo *info)
         gtk_list_store_clear (info->store);
         res = csv_import_read_file (info->file_name, info->regexp->str, info->store, 1 );
         if (res == RESULT_OPEN_FAILED)
-            gnc_error_dialog (info->window, _("The input file can not be opened."));
+            gnc_error_dialog (GTK_WINDOW (info->window), _("The input file can not be opened."));
         else if (res == RESULT_OK)
             gtk_assistant_set_page_complete (assistant, page, TRUE);
         else if (res == MATCH_FOUND)
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index d52b676..9402f38 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -641,13 +641,13 @@ CsvImpTransAssist::file_confirm_cb ()
     catch (std::ifstream::failure& e)
     {
         /* File loading failed ... */
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst), "%s", e.what());
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "%s", e.what());
         return;
     }
     catch (std::range_error &e)
     {
         /* Parsing failed ... */
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst), "%s", e.what());
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "%s", e.what());
         return;
     }
 
@@ -759,7 +759,7 @@ CsvImpTransAssist::preview_settings_load ()
 
     tx_imp->settings (*preset);
     if (preset->m_load_error)
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst),
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst),
             "%s", _("There were problems reading some saved settings, continuing to load.\n"
                     "Please review and save again."));
 
@@ -781,7 +781,7 @@ CsvImpTransAssist::preview_settings_delete ()
     auto model = gtk_combo_box_get_model (settings_combo);
     gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
 
-    auto response = gnc_ok_cancel_dialog (GTK_WIDGET(csv_imp_asst),
+    auto response = gnc_ok_cancel_dialog (GTK_WINDOW (csv_imp_asst),
                                 GTK_RESPONSE_CANCEL,
                                 "%s", _("Delete the Import Settings."));
     if (response == GTK_RESPONSE_OK)
@@ -815,7 +815,7 @@ CsvImpTransAssist::preview_settings_save ()
 
             if (preset && (preset->m_name == std::string(new_name)))
             {
-                auto response = gnc_ok_cancel_dialog (GTK_WIDGET(csv_imp_asst),
+                auto response = gnc_ok_cancel_dialog (GTK_WINDOW (csv_imp_asst),
                         GTK_RESPONSE_OK,
                         "%s", _("Setting name already exists, over write?"));
                 if (response != GTK_RESPONSE_OK)
@@ -830,7 +830,7 @@ CsvImpTransAssist::preview_settings_save ()
     /* All checks passed, let's save this preset */
     if (!tx_imp->save_settings())
     {
-        gnc_info_dialog (GTK_WIDGET(csv_imp_asst),
+        gnc_info_dialog (GTK_WINDOW (csv_imp_asst),
             "%s", _("The settings have been saved."));
 
         // Update the settings store
@@ -855,7 +855,7 @@ CsvImpTransAssist::preview_settings_save ()
         }
     }
     else
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst),
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst),
             "%s", _("There was a problem saving the settings, please try again."));
 }
 
@@ -936,7 +936,7 @@ void CsvImpTransAssist::preview_update_separators (GtkWidget* widget)
         /* Warn the user there was a problem and try to undo what caused
          * the error. (This will cause a reparsing and ideally a usable
          * configuration.) */
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst), "Error in parsing");
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "Error in parsing");
         /* If we're here because the user changed the file format, we should just wait for the user
          * to update the configuration */
         if (!widget)
@@ -986,7 +986,7 @@ void CsvImpTransAssist::preview_update_file_format ()
     catch (std::range_error &e)
     {
         /* Parsing failed ... */
-        gnc_error_dialog (nullptr, "%s", e.what());
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "%s", e.what());
         return;
     }
     catch (...)
@@ -1030,7 +1030,7 @@ CsvImpTransAssist::preview_update_encoding (const char* encoding)
         catch (...)
         {
             /* If it fails, change back to the old encoding. */
-            gnc_error_dialog (nullptr, "%s", _("Invalid encoding selected"));
+            gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "%s", _("Invalid encoding selected"));
             go_charmap_sel_set_encoding (encselector, previous_encoding.c_str());
         }
     }
@@ -1218,7 +1218,7 @@ fixed_context_menu_handler (GnumericPopupMenuElement const *element,
     }
     catch(std::range_error& e)
     {
-        gnc_error_dialog (nullptr, "%s", e.what());
+        gnc_error_dialog (GTK_WINDOW (info->csv_imp_asst), "%s", e.what());
         return false;
     }
     info->preview_refresh_table ();
@@ -1263,7 +1263,7 @@ CsvImpTransAssist::preview_split_column (int col, int offset)
     }
     catch (std::range_error& e)
     {
-        gnc_error_dialog (nullptr, "%s", e.what());
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst), "%s", e.what());
         return;
     }
     preview_refresh_table();
@@ -1863,7 +1863,7 @@ CsvImpTransAssist::assist_doc_page_prepare ()
         /* Oops! This shouldn't happen when using the import assistant !
          * Inform the user and go back to the preview page.
          */
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst),
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst),
             _("An unexpected error has occurred while mapping accounts. Please report this as a bug.\n\n"
               "Error message:\n%s"), err.what());
         gtk_assistant_set_current_page (csv_imp_asst, 2);
@@ -1897,7 +1897,7 @@ CsvImpTransAssist::assist_match_page_prepare ()
         /* Oops! This shouldn't happen when using the import assistant !
          * Inform the user and go back to the preview page.
          */
-        gnc_error_dialog (GTK_WIDGET(csv_imp_asst),
+        gnc_error_dialog (GTK_WINDOW (csv_imp_asst),
             _("An unexpected error has occurred while creating transactions. Please report this as a bug.\n\n"
               "Error message:\n%s"), err.what());
         gtk_assistant_set_current_page (csv_imp_asst, 2);
diff --git a/gnucash/import-export/csv-imp/csv-account-import.c b/gnucash/import-export/csv-imp/csv-account-import.c
index 58fe331..5285b68 100644
--- a/gnucash/import-export/csv-imp/csv-account-import.c
+++ b/gnucash/import-export/csv-imp/csv-account-import.c
@@ -93,7 +93,7 @@ csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
 
     if (!g_file_get_contents (filename, &locale_cont, NULL, NULL))
     {
-        //gnc_error_dialog( 0, _("File %s cannot be opened."), filename );
+        //gnc_error_dialog (NULL, _("File %s cannot be opened."), filename );
         return RESULT_OPEN_FAILED;
     }
 
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 3884300..d4d5c68 100644
--- a/gnucash/import-export/customer-import/dialog-customer-import-gui.c
+++ b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
@@ -194,7 +194,7 @@ gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data)
     {
         gnc_customer_import_fix_customers (gui->store, &n_fixed, &n_deleted, gui->type);
         gnc_customer_import_create_customers (gui->store, gui->book, &n_customers_created, &n_customers_updated, gui->type);
-        gnc_info_dialog (gui->dialog, _("Import results:\n%i lines were ignored\n%i lines imported:\n   %u %s fixed\n   %u %s ignored (not fixable)\n\n   %u %s created\n   %u %s updated (based on id)"), \
+        gnc_info_dialog (GTK_WINDOW (gui->dialog), _("Import results:\n%i lines were ignored\n%i lines imported:\n   %u %s fixed\n   %u %s ignored (not fixable)\n\n   %u %s created\n   %u %s updated (based on id)"), \
                          stats.n_ignored, stats.n_imported, n_fixed, cv_type_text, n_deleted, cv_type_text, n_customers_created, cv_type_text, n_customers_updated, cv_type_text);
 
         if (stats.n_ignored > 0)
@@ -205,11 +205,11 @@ gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data)
     }
     else if (res == CI_RESULT_OPEN_FAILED)
     {
-        gnc_error_dialog (gui->dialog, _("The input file can not be opened."));
+        gnc_error_dialog (GTK_WINDOW (gui->dialog), _("The input file can not be opened."));
     }
     else if (res == CI_RESULT_ERROR_IN_REGEXP)
     {
-        //gnc_error_dialog (gui->dialog, "The regular expression is faulty:\n\n%s", stats.err->str);
+        //gnc_error_dialog (GTK_WINDOW (gui->dialog), "The regular expression is faulty:\n\n%s", stats.err->str);
     }
 }
 
diff --git a/gnucash/import-export/customer-import/dialog-customer-import.c b/gnucash/import-export/customer-import/dialog-customer-import.c
index 9f3accd..a095417 100644
--- a/gnucash/import-export/customer-import/dialog-customer-import.c
+++ b/gnucash/import-export/customer-import/dialog-customer-import.c
@@ -83,7 +83,7 @@ gnc_customer_import_read_file (const gchar *filename, const gchar *parser_regexp
     f = g_fopen( filename, "rt" );
     if (!f)
     {
-        //gnc_error_dialog( 0, _("File %s cannot be opened."), filename );
+        //gnc_error_dialog (NULL, _("File %s cannot be opened."), filename );
         return CI_RESULT_OPEN_FAILED;
     }
 
@@ -187,8 +187,6 @@ gnc_customer_import_read_file (const gchar *filename, const gchar *parser_regexp
     regexpat = 0;
     fclose (f);
 
-    //gnc_info_dialog (0, _("Import results:\n%i customers imported\n%i lines ignored"), n_imported, n_ignored);
-
     if (stats == &stats_fallback)
         // stats are not requested -> free the string
         g_string_free (stats->ignored_lines, TRUE);
diff --git a/gnucash/import-export/import-account-matcher.c b/gnucash/import-export/import-account-matcher.c
index a77ca31..33d1904 100644
--- a/gnucash/import-export/import-account-matcher.c
+++ b/gnucash/import-export/import-account-matcher.c
@@ -189,7 +189,7 @@ account_tree_row_activated_cb(GtkTreeView *view, GtkTreePath *path,
         /* See if the selected account is a placeholder. */
         if (picker->retAccount && xaccAccountGetPlaceholder (picker->retAccount))
         {
-            gnc_error_dialog (picker->dialog,
+            gnc_error_dialog (GTK_WINDOW (picker->dialog),
                               _("The account %s is a placeholder account and does not allow "
                                 "transactions. Please choose a different account."),
                               retval_name);
@@ -365,7 +365,7 @@ Account * gnc_import_select_account(GtkWidget *parent,
                 if (retval && xaccAccountGetPlaceholder (retval))
                 {
                     gnc_error_dialog
-                    (picker->dialog,
+                    (GTK_WINDOW (picker->dialog),
                      _("The account %s is a placeholder account and does not allow "
                        "transactions. Please choose a different account."),
                      retval_name);
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index f80c642..4276e3b 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -658,7 +658,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
                             // whether to continue or abort.
                             choosing_account =
                                 gnc_verify_dialog(
-                                    gnc_gen_trans_list_widget(gnc_ofx_importer_gui), TRUE,
+                                    GTK_WINDOW (gnc_gen_trans_list_widget(gnc_ofx_importer_gui)), TRUE,
                                     "The chosen account \"%s\" does not have the correct "
                                     "currency/security \"%s\" (it has \"%s\" instead). "
                                     "This account cannot be used. "
diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
index 4c35b96..b669a05 100644
--- a/gnucash/import-export/qif-imp/assistant-qif-import.c
+++ b/gnucash/import-export/qif-imp/assistant-qif-import.c
@@ -1535,11 +1535,11 @@ gnc_ui_qif_import_load_file_complete (GtkAssistant  *assistant,
 
     /* Validate the chosen filename. */
     if (strlen(path_to_load) == 0)
-        gnc_error_dialog(wind->window, "%s", _("Please select a file to load."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s", _("Please select a file to load."));
     else if (g_access(path_to_load, R_OK) < 0)
-        gnc_error_dialog(wind->window, "%s",
-                         _("File not found or read permission denied. "
-                           "Please select another file."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                          _("File not found or read permission denied. "
+                            "Please select another file."));
     else
     {
         SCM qif_file_loaded = scm_c_eval_string("qif-dialog:qif-file-loaded?");
@@ -1548,9 +1548,9 @@ gnc_ui_qif_import_load_file_complete (GtkAssistant  *assistant,
         if (scm_call_2(qif_file_loaded,
                        scm_from_locale_string(path_to_load ? path_to_load : ""),
                        wind->imported_files) == SCM_BOOL_T)
-            gnc_error_dialog(wind->window, "%s",
-                             _("That QIF file is already loaded. "
-                               "Please select another file."));
+            gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                              _("That QIF file is already loaded. "
+                                "Please select another file."));
         else
         {
             /* Passed all checks; proceed to the next page. */
@@ -1703,8 +1703,9 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
         gpointer user_data)
 {
     QIFImportWindow   *wind = user_data;
-    gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(wind->window));
-    GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(wind->window), num);
+    GtkAssistant *assistant = GTK_ASSISTANT(wind->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
 
     const gchar * path_to_load;
 
@@ -1784,8 +1785,8 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
                                        _( "An error occurred while loading the QIF file."));
         gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
         gnc_progress_dialog_reset_value(wind->load_progress);
-        gnc_error_dialog(wind->window, "%s",
-                         _( "An error occurred while loading the QIF file."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                          _( "An error occurred while loading the QIF file."));
         /* FIXME: How should we request that the user report this problem? */
 
         wind->busy = FALSE;
@@ -1863,8 +1864,8 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
                                        _( "A bug was detected while parsing the QIF file."));
         gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
         gnc_progress_dialog_reset_value(wind->load_progress);
-        gnc_error_dialog(wind->window, "%s",
-                         _( "A bug was detected while parsing the QIF file."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                          _( "A bug was detected while parsing the QIF file."));
         /* FIXME: How should we request that the user report this problem? */
 
         wind->busy = FALSE;
@@ -1927,7 +1928,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
     }
 
     /* Enable the assistant Forward button */
-    gtk_assistant_set_page_complete (GTK_ASSISTANT(wind->window), page, TRUE);
+    gtk_assistant_set_page_complete (assistant, page, TRUE);
 
     /* Set Pause and Start buttons */
     gtk_widget_set_sensitive(wind->load_pause, FALSE);
@@ -1947,7 +1948,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
         wind->busy = FALSE;
 
         /* Auto step to next page */
-        gtk_assistant_set_current_page (GTK_ASSISTANT(wind->window), num + 1);
+        gtk_assistant_set_current_page (assistant, num + 1);
     }
 }
 
@@ -2689,14 +2690,14 @@ gnc_ui_qif_import_comm_valid (GtkAssistant *assistant,
 
     if (!name || (name[0] == 0))
     {
-        gnc_warning_dialog(wind->window, "%s",
+        gnc_warning_dialog(GTK_WINDOW (assistant), "%s",
                            _("Enter a name or short description, such as \"Red Hat Stock\"."));
         g_free(name_space);
         return FALSE;
     }
     else if (!mnemonic || (mnemonic[0] == 0))
     {
-        gnc_warning_dialog(wind->window, "%s",
+        gnc_warning_dialog(GTK_WINDOW (assistant), "%s",
                            _("Enter the ticker symbol or other well known abbreviation, such as"
                              " \"RHT\". If there isn't one, or you don't know it, create your own."));
         g_free(name_space);
@@ -2704,7 +2705,7 @@ gnc_ui_qif_import_comm_valid (GtkAssistant *assistant,
     }
     else if (!name_space || (name_space[0] == 0))
     {
-        gnc_warning_dialog(wind->window, "%s",
+        gnc_warning_dialog(GTK_WINDOW (assistant), "%s",
                            _("Select the exchange on which the symbol is traded, or select the"
                              " type of investment (such as FUND for mutual funds.) If you don't"
                              " see your exchange or an appropriate investment type, you can"
@@ -2724,7 +2725,7 @@ gnc_ui_qif_import_comm_valid (GtkAssistant *assistant,
     if (gnc_commodity_namespace_is_iso(name_space) &&
             !gnc_commodity_table_lookup(table, name_space, mnemonic))
     {
-        gnc_warning_dialog(wind->window, "%s",
+        gnc_warning_dialog(GTK_WINDOW (assistant), "%s",
                            _("You must enter an existing national "
                              "currency or enter a different type."));
 
@@ -2821,8 +2822,9 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
         gpointer user_data)
 {
     QIFImportWindow   *wind = user_data;
-    gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(wind->window));
-    GtkWidget *page = gtk_assistant_get_nth_page (GTK_ASSISTANT(wind->window), num);
+    GtkAssistant *assistant = GTK_ASSISTANT (wind->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
 
     SCM qif_to_gnc      = scm_c_eval_string("qif-import:qif-to-gnc");
     SCM find_duplicates = scm_c_eval_string("gnc:account-tree-find-duplicates");
@@ -2904,8 +2906,8 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
                                        _( "A bug was detected while converting the QIF data."));
         gnc_progress_dialog_set_sub(wind->convert_progress, _("Failed"));
         gnc_progress_dialog_reset_value(wind->convert_progress);
-        gnc_error_dialog(wind->window, "%s",
-                         _( "A bug was detected while converting the QIF data."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                          _( "A bug was detected while converting the QIF data."));
         /* FIXME: How should we request that the user report this problem? */
 
         wind->busy = FALSE;
@@ -2972,8 +2974,8 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
                                        _( "A bug was detected while detecting duplicates."));
         gnc_progress_dialog_set_sub(wind->convert_progress, _("Failed"));
         gnc_progress_dialog_reset_value(wind->convert_progress);
-        gnc_error_dialog(wind->window, "%s",
-                         _( "A bug was detected while detecting duplicates."));
+        gnc_error_dialog (GTK_WINDOW (assistant), "%s",
+                          _( "A bug was detected while detecting duplicates."));
         /* FIXME: How should we request that the user report this problem? */
 
         gtk_widget_set_sensitive(wind->convert_pause, FALSE);
@@ -2982,7 +2984,7 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
     }
 
     /* Enable the Assistant Forward Button */
-    gtk_assistant_set_page_complete (GTK_ASSISTANT(wind->window), page, TRUE);
+    gtk_assistant_set_page_complete (assistant, page, TRUE);
 
     /* Set Pause and Start buttons */
     gtk_widget_set_sensitive(wind->convert_pause, FALSE);
@@ -3000,7 +3002,7 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
 
         /* If the log is empty, move on to the next page automatically. */
         if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(wind->convert_log))) == 0)
-            gtk_assistant_set_current_page (GTK_ASSISTANT(wind->window), num + 1);
+            gtk_assistant_set_current_page (assistant, num + 1);
     }
 }
 
@@ -3184,7 +3186,7 @@ gnc_ui_qif_import_end_page_prepare (GtkAssistant *assistant,
  * Invoked when the "Apply" button is clicked on the final page.
  ********************************************************************/
 void
-gnc_ui_qif_import_finish_cb (GtkAssistant *gtkassistant,
+gnc_ui_qif_import_finish_cb (GtkAssistant *assistant,
                              gpointer user_data)
 {
     QIFImportWindow * wind = user_data;
@@ -3219,7 +3221,7 @@ gnc_ui_qif_import_finish_cb (GtkAssistant *gtkassistant,
                            SCM_EOL);
 
     if (scm_result == SCM_BOOL_F)
-        gnc_warning_dialog(wind->window, "%s",
+        gnc_warning_dialog(GTK_WINDOW (assistant), "%s",
                            _("GnuCash was unable to save your mapping preferences."));
 
     /* Open an account tab in the main window if one doesn't exist already. */
diff --git a/gnucash/register/ledger-core/gncEntryLedger.c b/gnucash/register/ledger-core/gncEntryLedger.c
index 6a8c910..8a75530 100644
--- a/gnucash/register/ledger-core/gncEntryLedger.c
+++ b/gnucash/register/ledger-core/gncEntryLedger.c
@@ -96,7 +96,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
     if (!account)
     {
         /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (ledger->parent, TRUE, missing, name))
+        if (!gnc_verify_dialog (GTK_WINDOW (ledger->parent), TRUE, missing, name))
             return NULL;
 
         /* No changes, as yet. */
@@ -127,7 +127,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
     /* See if the account (either old or new) is a placeholder. */
     if (xaccAccountGetPlaceholder (account))
     {
-        gnc_error_dialog (ledger->parent, placeholder, name);
+        gnc_error_dialog (GTK_WINDOW (ledger->parent), placeholder, name);
     }
 
     /* Be seeing you. */
diff --git a/gnucash/register/ledger-core/gncEntryLedgerControl.c b/gnucash/register/ledger-core/gncEntryLedgerControl.c
index 159b141..cc93fb1 100644
--- a/gnucash/register/ledger-core/gncEntryLedgerControl.c
+++ b/gnucash/register/ledger-core/gncEntryLedgerControl.c
@@ -158,7 +158,7 @@ gnc_entry_ledger_verify_acc_cell_ok (GncEntryLedger *ledger,
         const char *format = ("%s %s");
         const char *gen_msg = _("Invalid Entry: You need to supply an account in the right currency for this position.");
 
-        gnc_error_dialog (ledger->parent, format, gen_msg, cell_msg);
+        gnc_error_dialog (GTK_WINDOW (ledger->parent), format, gen_msg, cell_msg);
         return FALSE;
     }
     return TRUE;
@@ -762,7 +762,7 @@ static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
         {
             const char *format = _("The tax table %s does not exist. "
                                    "Would you like to create it?");
-            if (!gnc_verify_dialog (ledger->parent, TRUE, format, name))
+            if (!gnc_verify_dialog (GTK_WINDOW (ledger->parent), TRUE, format, name))
                 break;
         }
 
@@ -995,7 +995,7 @@ gnc_entry_ledger_check_close_internal (GtkWidget *parent,
     if (!gnc_entry_ledger_verify_can_save (ledger))
         return FALSE;
 
-    if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
+    if (dontask || gnc_verify_dialog (GTK_WINDOW (parent), TRUE, "%s", message))
         gnc_entry_ledger_save (ledger, TRUE);
     else
         gnc_entry_ledger_cancel_cursor_changes (ledger);
diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
index a9dd3e9..b66c073 100644
--- a/gnucash/register/ledger-core/split-register-control.c
+++ b/gnucash/register/ledger-core/split-register-control.c
@@ -1322,7 +1322,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (force_dialog)
         {
             message = _("This register does not support editing exchange rates.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("no rate cell");
         return FALSE;
@@ -1335,7 +1335,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (force_dialog)
         {
             message = _("This register does not support editing exchange rates.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("null rate cell");
         return FALSE;
@@ -1362,7 +1362,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         {
             message = _("You need to select a split in order to modify its exchange "
                         "rate.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("expanded with transaction cursor; nothing to do");
         return FALSE;
@@ -1377,7 +1377,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
     {
         message = _("You need to expand the transaction in order to modify its "
                     "exchange rates.");
-        gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+        gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         LEAVE("%s", message);
         return TRUE;
     }
@@ -1388,7 +1388,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (force_dialog)
         {
             message = _("The entered account could not be found.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("no xfer account");
         return FALSE;
@@ -1423,7 +1423,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (expanded || osplit == NULL)
         {
             message = _("The two currencies involved equal each other.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
             LEAVE("register is expanded or osplit == NULL; not forcing dialog");
             return FALSE;
         }
@@ -1436,7 +1436,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (gnc_commodity_equal (txn_cur, xfer_com))
         {
             message = _("The two currencies involved equal each other.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
             LEAVE("reg commodity == txn commodity; not forcing");
             return FALSE;
         }
@@ -1454,7 +1454,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
                     "exchange rates.");
         if (force_dialog)
         {
-            gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("%s", message);
         return TRUE;
@@ -1487,7 +1487,7 @@ gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)
         if (force_dialog)
         {
             message = _("The split's amount is zero, so no exchange rate is needed.");
-            gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+            gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)), "%s", message);
         }
         LEAVE("amount is zero; no exchange rate needed");
         return FALSE;
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
index 8349eda..672760f 100644
--- a/gnucash/register/ledger-core/split-register.c
+++ b/gnucash/register/ledger-core/split-register.c
@@ -179,9 +179,9 @@ gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans)
         }
         else
         {
-            GtkWidget *parent = NULL;
+            GtkWindow *parent = NULL;
             if (info->get_parent)
-                parent = info->get_parent(info->user_data);
+                parent = GTK_WINDOW (info->get_parent (info->user_data));
             gnc_error_dialog(parent, "%s", _("This transaction is already being edited in another register. Please finish editing it there first."));
             LEAVE("already editing");
             return TRUE;
@@ -455,7 +455,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
               "record the changes before duplicating the transaction, or "
               "cancel the duplication?");
 
-        window = gnc_split_register_get_parent(reg);
+        window = gnc_split_register_get_parent (reg);
         dialog = gtk_message_dialog_new(GTK_WINDOW(window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                         GTK_MESSAGE_QUESTION,
@@ -922,7 +922,7 @@ gnc_split_register_paste_current (SplitRegister *reg)
 
         /* Ask before overwriting an existing split. */
         if (split != NULL &&
-                !gnc_verify_dialog (gnc_split_register_get_parent (reg),
+                !gnc_verify_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
                                     FALSE, "%s", message))
         {
             LEAVE("user cancelled");
@@ -960,7 +960,7 @@ gnc_split_register_paste_current (SplitRegister *reg)
 
         /* Ask before overwriting an existing transaction. */
         if (split != blank_split &&
-                !gnc_verify_dialog(gnc_split_register_get_parent(reg),
+                !gnc_verify_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
                                    FALSE, "%s", message))
         {
             LEAVE("user cancelled");
@@ -1846,7 +1846,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     if (!account && !creating_account)
     {
         /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
+        if (!gnc_verify_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
                                 TRUE, missing, name))
             return NULL;
         creating_account = TRUE;
@@ -1870,7 +1870,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     /* See if the account (either old or new) is a placeholder. */
     if (xaccAccountGetPlaceholder (account))
     {
-        gnc_error_dialog (gnc_split_register_get_parent (reg),
+        gnc_error_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
                           placeholder, name);
     }
 
diff --git a/gnucash/report/report-gnome/dialog-custom-report.c b/gnucash/report/report-gnome/dialog-custom-report.c
index 3f3d727..8f09a2a 100644
--- a/gnucash/report/report-gnome/dialog-custom-report.c
+++ b/gnucash/report/report-gnome/dialog-custom-report.c
@@ -309,7 +309,7 @@ custom_report_delete (SCM guid, CustomReportDialog *crd)
     report_name = gnc_scm_to_utf8_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
 
     /* we must confirm the user wants to delete their precious custom report! */
-    if (gnc_verify_dialog(crd->dialog, FALSE, _("Are you sure you want to delete %s?"), report_name))
+    if (gnc_verify_dialog( GTK_WINDOW (crd->dialog), FALSE, _("Are you sure you want to delete %s?"), report_name))
     {
         SCM del_report = scm_c_eval_string("gnc:delete-report");
         scm_call_1(del_report, guid);
@@ -352,7 +352,7 @@ get_custom_report_selection(CustomReportDialog *crd,
     else
     {
         /* no selection, notify user */
-        gnc_error_dialog(GTK_WIDGET(crd->window), "%s", message);
+        gnc_error_dialog (GTK_WINDOW (crd->dialog), "%s", message);
         return SCM_EOL;
 
     }
@@ -446,8 +446,8 @@ void custom_report_name_edited_cb(GtkCellRendererText *renderer, gchar *path, gc
     if (scm_is_true (scm_call_2 (unique_name_func, guid, new_name_scm)))
         custom_report_edit_report_name (guid, crd, new_text);
     else
-        gnc_error_dialog(crd->dialog, "%s",
-                         _("A saved report configuration with this name already exists, please choose another name.") );
+        gnc_error_dialog (GTK_WINDOW (crd->dialog), "%s",
+                          _("A saved report configuration with this name already exists, please choose another name.") );
 
 
 }
diff --git a/gnucash/report/report-gnome/dialog-report-style-sheet.c b/gnucash/report/report-gnome/dialog-report-style-sheet.c
index f2fbb97..ebd8a1e 100644
--- a/gnucash/report/report-gnome/dialog-report-style-sheet.c
+++ b/gnucash/report/report-gnome/dialog-report-style-sheet.c
@@ -254,7 +254,7 @@ gnc_style_sheet_new (StyleSheetDialog * ssd)
         {
             /* If the name is empty, we display an error dialog but
              * refuse to create the new style sheet. */
-            gnc_error_dialog (ssd->toplevel, "%s", _("You must provide a name for the new style sheet."));
+            gnc_error_dialog (GTK_WINDOW (ssd->toplevel), "%s", _("You must provide a name for the new style sheet."));
             name_str = NULL;
         }
         if (template_str && name_str)
diff --git a/gnucash/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c
index 365bdac..9340224 100644
--- a/gnucash/report/report-gnome/window-report.c
+++ b/gnucash/report/report-gnome/window-report.c
@@ -232,7 +232,7 @@ gnc_report_edit_options(SCM report, GtkWindow *parent)
     options = scm_call_1(get_options, report);
     if (options == SCM_BOOL_F)
     {
-        gnc_warning_dialog (GTK_WIDGET (parent), "%s",
+        gnc_warning_dialog (parent, "%s",
                             _("There are no options for this report."));
         return FALSE;
     }

commit 68103dd02da2beab89ffe53ba971fc6228b999a1
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Nov 25 15:08:31 2017 +0100

    Improve window management
    
    This first commit will replace gnc_ui_get_toplevel with two functions
    - gnc_ui_get_gtk_window (widget): tries to find the immediate GtkWindow the given widget belongs to
    - gnc_ui_get_main_window: looks for the main window that's the final transient parent widget
      can be traced back to. In the absence of widget, this will behave as gnc_ui_get_toplevel did
      and return the first active or mapped window.

diff --git a/gnucash/gnome-utils/gnc-autosave.c b/gnucash/gnome-utils/gnc-autosave.c
index 1aff29c..557462d 100644
--- a/gnucash/gnome-utils/gnc-autosave.c
+++ b/gnucash/gnome-utils/gnc-autosave.c
@@ -187,7 +187,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
         return FALSE;
 
     /* Store the current toplevel window for later use. */
-    toplevel = gnc_ui_get_toplevel();
+    toplevel = GTK_WIDGET (gnc_ui_get_main_window (NULL));
 
     /* Lookup preference to show an explanatory dialog, if wanted. */
     show_explanation =
diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index eb00ab5..b733c0f 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -140,8 +140,7 @@ gnc_file_dialog (const char * title,
 
     gtk_window_set_modal(GTK_WINDOW(file_box), TRUE);
     /*
-    gtk_window_set_transient_for(GTK_WINDOW(file_box),
-    		       GTK_WINDOW(gnc_ui_get_toplevel()));
+    gtk_window_set_transient_for(GTK_WINDOW(file_box), gnc_ui_get_main_window(NULL));
     */
 
     if (filters != NULL)
@@ -199,7 +198,7 @@ show_session_error (QofBackendError io_error,
                     const char *newfile,
                     GNCFileDialogType type)
 {
-    GtkWidget *parent = gnc_ui_get_toplevel();
+    GtkWidget *parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
     GtkWidget *dialog;
     gboolean uh_oh = TRUE;
     const char *fmt, *label;
@@ -570,7 +569,7 @@ gnc_file_new (void)
 gboolean
 gnc_file_query_save (gboolean can_cancel)
 {
-    GtkWidget *parent = gnc_ui_get_toplevel();
+    GtkWidget *parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
     QofBook *current_book;
 
     if (!gnc_current_session_exist())
@@ -777,7 +776,7 @@ RESTART:
 
         GtkWindow *parent = gnc_get_splash_screen();
         if (!parent)
-            parent = GTK_WINDOW(gnc_ui_get_toplevel());
+            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);
@@ -949,7 +948,7 @@ RESTART:
                 uh_oh = TRUE;
 
                 // XXX: should pull out the file name here */
-                gnc_error_dialog(gnc_ui_get_toplevel(), msg, "");
+                gnc_error_dialog(GTK_WIDGET (gnc_ui_get_main_window(NULL)), msg, "");
                 g_free (msg);
             }
             if (template_root != NULL)
@@ -1309,7 +1308,7 @@ gnc_file_save (void)
 
     if (qof_book_is_readonly(qof_session_get_book(session)))
     {
-        gint response = gnc_ok_cancel_dialog(gnc_ui_get_toplevel(),
+        gint response = gnc_ok_cancel_dialog(GTK_WIDGET (gnc_ui_get_main_window(NULL)),
                                              GTK_RESPONSE_CANCEL,
                                              _("The database was opened read-only. "
                                                "Do you want to save it to a different place?"));
diff --git a/gnucash/gnome-utils/gnc-gui-query.c b/gnucash/gnome-utils/gnc-gui-query.c
index d8492e2..e2f4434 100644
--- a/gnucash/gnome-utils/gnc-gui-query.c
+++ b/gnucash/gnome-utils/gnc-gui-query.c
@@ -60,7 +60,7 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
     va_list args;
 
     if (parent == NULL)
-        parent = gnc_ui_get_toplevel();
+        parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
 
     va_start(args, format);
     buffer = g_strdup_vprintf(format, args);
@@ -108,7 +108,7 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
     va_list args;
 
     if (parent == NULL)
-        parent = gnc_ui_get_toplevel();
+        parent = GTK_WIDGET (gnc_ui_get_main_window(NULL));
 
     va_start(args, format);
     buffer = g_strdup_vprintf(format, args);
@@ -151,7 +151,7 @@ gnc_info_dialog(GtkWidget *parent, const gchar *format, ...)
     va_list args;
 
     if (parent == NULL)
-        parent = gnc_ui_get_toplevel();
+        parent = GTK_WIDGET (gnc_ui_get_main_window (NULL));
 
     va_start(args, format);
     buffer = g_strdup_vprintf(format, args);
@@ -190,7 +190,7 @@ gnc_warning_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
     gchar *buffer;
 
     if (parent == NULL)
-        parent = GTK_WIDGET(gnc_ui_get_toplevel());
+        parent = GTK_WIDGET(gnc_ui_get_main_window(NULL));
 
     buffer = g_strdup_vprintf(format, args);
     dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
@@ -237,7 +237,7 @@ gnc_error_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
     gchar *buffer;
 
     if (parent == NULL)
-        parent = GTK_WIDGET(gnc_ui_get_toplevel());
+        parent = GTK_WIDGET(gnc_ui_get_main_window(NULL));
 
     buffer = g_strdup_vprintf(format, args);
     dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index ff9665e..1ca7ad9 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -1601,14 +1601,13 @@ static guint gnc_statusbar_notification_messageid = 0;
  * statusbar by generate_statusbar_lastmodified_message. */
 static gboolean statusbar_notification_off(gpointer user_data_unused)
 {
-    GtkWidget *widget = gnc_ui_get_toplevel();
+    GncMainWindow *mainwindow = GNC_MAIN_WINDOW (gnc_ui_get_main_window (NULL));
     //g_warning("statusbar_notification_off\n");
     if (gnc_statusbar_notification_messageid == 0)
         return FALSE;
 
-    if (widget && GNC_IS_MAIN_WINDOW(widget))
+    if (mainwindow)
     {
-        GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
         GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
         gtk_statusbar_remove(GTK_STATUSBAR(statusbar), 0, gnc_statusbar_notification_messageid);
         gnc_statusbar_notification_messageid = 0;
@@ -2671,16 +2670,16 @@ GncMainWindow *
 gnc_main_window_new (void)
 {
     GncMainWindow *window;
-    GtkWidget *old_window;
+    GtkWindow *old_window;
 
     window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL);
     gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
 
-    old_window = gnc_ui_get_toplevel();
+    old_window = gnc_ui_get_main_window (NULL);
     if (old_window)
     {
         gint width, height;
-        gtk_window_get_size (GTK_WINDOW (old_window), &width, &height);
+        gtk_window_get_size (old_window, &width, &height);
         gtk_window_resize (GTK_WINDOW (window), width, height);
         if ((gdk_window_get_state((gtk_widget_get_window (GTK_WIDGET(old_window))))
                 & GDK_WINDOW_STATE_MAXIMIZED) != 0)
@@ -4555,16 +4554,33 @@ gnc_main_window_show_all_windows(void)
 #endif
 }
 
-/** Get a pointer to the first active top level window. If there is
- *  none, return the first mapped window or NULL
- *  if there is none.
- *
- *  @return A pointer to a GtkWindow object. */
-GtkWidget *
-gnc_ui_get_toplevel (void)
+GtkWindow *
+gnc_ui_get_gtk_window (GtkWidget *widget)
+{
+    GtkWidget *toplevel;
+
+    if (!widget)
+        return NULL;
+
+    toplevel = gtk_widget_get_toplevel (widget);
+    if (toplevel && GTK_IS_WINDOW (toplevel))
+        return GTK_WINDOW (toplevel);
+    else
+        return NULL;
+}
+
+GtkWindow *
+gnc_ui_get_main_window (GtkWidget *widget)
 {
     GList *window;
 
+    GtkWindow *toplevel = gnc_ui_get_gtk_window (widget);
+    while (toplevel && !GNC_IS_MAIN_WINDOW (toplevel))
+        toplevel = gtk_window_get_transient_for(toplevel);
+
+    if (toplevel)
+        return toplevel;
+
     for (window = active_windows; window; window = window->next)
         if (gtk_window_is_active (GTK_WINDOW (window->data)))
             return window->data;
diff --git a/gnucash/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
index 18d21a0..b870614 100644
--- a/gnucash/gnome-utils/gnc-ui.h
+++ b/gnucash/gnome-utils/gnc-ui.h
@@ -141,7 +141,34 @@ gboolean gnc_get_username_password (GtkWidget *parent,
 
 /* Managing the GUI Windows *****************************************/
 
-GtkWidget *gnc_ui_get_toplevel (void);
+/** Get a pointer to the widget's immediate top level GtkWindow. This can be a dialog
+ *  window or a GncMainWindow. If the widget is not a child of
+ *  a GtkWindow (yet), NULL is returned.
+ *
+ *  @param widget the widget to find a GtkWindow for.
+ *  @return A pointer to a GtkWindow object or NULL if no toplevel was found. */
+GtkWindow *gnc_ui_get_gtk_window (GtkWidget *widget);
+
+/** Get a pointer to the final GncMainWindow widget is rooted
+ * in. If widget is a child of a GncMainWindow return that window.
+ * If it's a child of a dialog window recursively query the
+ * dialog's transient parent until the first parent that's a GncMainWindow
+ * and return that. If widget is NULL or not part of any GtkWindow,
+ * get a pointer to the first active top level window. If there is
+ * none, return the first mapped window. If there's no mapped window
+ * return NULL.
+ *
+ * An example of why searching for a GncMainWindow makes sense: suppose
+ * a user has opened a search dialog for vendors and in that dialog has
+ * clicked "View vendor invoices". This opens another search window in
+ * which the user can click "View/Edit bill". Clicking that button should
+ * open a new tab in the GncMainWindow from which the first search dialog
+ * was opened.
+ *
+ * @param widget the widget to find a GncMainWindow for.
+ * @return A pointer to a GtkWindow object. */
+
+GtkWindow *gnc_ui_get_main_window (GtkWidget *widget);
 
 /* Changing the GUI Cursor ******************************************/
 
diff --git a/gnucash/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.c
index 4ca974d..cb8ef55 100644
--- a/gnucash/gnome/dialog-sx-from-trans.c
+++ b/gnucash/gnome/dialog-sx-from-trans.c
@@ -553,7 +553,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
     {
         if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION )
         {
-            gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
+            gnc_error_dialog (NULL, "%s",
                               _( "The Scheduled Transaction is unbalanced. "
                                  "You are strongly encouraged to correct this situation." ) );
         }
@@ -781,7 +781,7 @@ gnc_sx_create_from_trans( Transaction *trans )
     {
         if ( errno == SXFTD_ERRNO_OPEN_XACTION )
         {
-            gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
+            gnc_error_dialog (NULL, "%s",
                               _( "Cannot create a Scheduled Transaction "
                                  "from a Transaction currently "
                                  "being edited. Please Enter the "
diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c
index 7194e02..fd62912 100644
--- a/gnucash/import-export/aqb/gnc-file-aqb-import.c
+++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c
@@ -229,7 +229,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(gnc_ui_get_toplevel());
+        gnc_new_book_option_display (GTK_WIDGET (gnc_ui_get_main_window(NULL)));
 
     /* Import the results */
     ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS,
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index 38ae80a..f80c642 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -919,7 +919,7 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
          * calling 'gnc_import_select_account', allow the user to set book
          * options. */
         if (new_book)
-            new_book = gnc_new_book_option_display(gnc_ui_get_toplevel());
+            new_book = gnc_new_book_option_display (GTK_WIDGET (gnc_ui_get_main_window (NULL)));
 
         gnc_utf8_strip_invalid(data.account_name);
         gnc_utf8_strip_invalid(data.account_id);
diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
index 6939c33..4c35b96 100644
--- a/gnucash/import-export/qif-imp/assistant-qif-import.c
+++ b/gnucash/import-export/qif-imp/assistant-qif-import.c
@@ -3617,8 +3617,7 @@ gnc_ui_qif_import_assistant_make(QIFImportWindow *qif_win)
     get_assistant_widgets(qif_win, builder);
 
     /* Make this window stay on top */
-    gtk_window_set_transient_for (GTK_WINDOW (qif_win->window),
-				  GTK_WINDOW (gnc_ui_get_toplevel ()));
+    gtk_window_set_transient_for (GTK_WINDOW (qif_win->window), gnc_ui_get_main_window(NULL));
 
     /* Build the details of all GtkTreeView widgets. */
     build_views(qif_win);
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index a0fe927..67743c8 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -413,7 +413,7 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page )
     report = GNC_PLUGIN_PAGE_REPORT(page);
     priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
 
-    topLvl = GTK_WINDOW(gnc_ui_get_toplevel());
+    topLvl = gnc_ui_get_main_window (NULL);
 //        priv->html = gnc_html_new( topLvl );
     priv->html = gnc_html_factory_create_html();
     gnc_html_set_parent( priv->html, topLvl );
diff --git a/gnucash/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c
index 82e2bc2..365bdac 100644
--- a/gnucash/report/report-gnome/window-report.c
+++ b/gnucash/report/report-gnome/window-report.c
@@ -232,8 +232,8 @@ gnc_report_edit_options(SCM report, GtkWindow *parent)
     options = scm_call_1(get_options, report);
     if (options == SCM_BOOL_F)
     {
-        gnc_warning_dialog(GTK_WIDGET(gnc_ui_get_toplevel()), "%s",
-                           _("There are no options for this report."));
+        gnc_warning_dialog (GTK_WIDGET (parent), "%s",
+                            _("There are no options for this report."));
         return FALSE;
     }
 

commit 12bad5cec81f6d11b342c0d1ed30df287674cdde
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 16 17:21:25 2017 +0100

    Ensure the main window is mapped before any reminder dialogs are shown at startup

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 862403f..ff9665e 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -720,8 +720,8 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
         if (active_windows)
             DEBUG("first window %p.", active_windows->data);
         window = gnc_main_window_new();
-        gtk_widget_show(GTK_WIDGET(window));
     }
+    gtk_widget_show(GTK_WIDGET(window));
 
     priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
 
@@ -952,6 +952,7 @@ gnc_main_window_restore_default_state(GncMainWindow *window)
     DEBUG("no saved state file");
     if (!window)
         window = g_list_nth_data(active_windows, 0);
+    gtk_widget_show (GTK_WIDGET(window));
     action = gnc_main_window_find_action(window, "ViewAccountTreeAction");
     gtk_action_activate(action);
 }
@@ -4554,7 +4555,8 @@ gnc_main_window_show_all_windows(void)
 #endif
 }
 
-/** Get a pointer to the first active top level window or NULL
+/** Get a pointer to the first active top level window. If there is
+ *  none, return the first mapped window or NULL
  *  if there is none.
  *
  *  @return A pointer to a GtkWindow object. */
@@ -4567,6 +4569,10 @@ gnc_ui_get_toplevel (void)
         if (gtk_window_is_active (GTK_WINDOW (window->data)))
             return window->data;
 
+    for (window = active_windows; window; window = window->next)
+        if (gtk_widget_get_mapped (GTK_WIDGET(window->data)))
+            return window->data;
+
     return NULL;
 }
 
diff --git a/gnucash/gnome/top-level.c b/gnucash/gnome/top-level.c
index 4013ba5..61d793d 100644
--- a/gnucash/gnome/top-level.c
+++ b/gnucash/gnome/top-level.c
@@ -377,8 +377,6 @@ gnc_main_gui_init (void)
     gnc_html_register_url_handler (URL_TYPE_PRICE,
                                    gnc_html_price_url_cb);
 
-    gnc_ui_sx_initialize();
-
     /* Register the Owner search type */
     gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
                                     (GNCSearchCoreNew) gnc_search_owner_new);
@@ -421,6 +419,8 @@ gnc_main_gui_init (void)
     gnc_hook_add_dangler(HOOK_BOOK_OPENED,
                          (GFunc)gnc_invoice_remind_invoices_due_cb, NULL);
 
+    gnc_ui_sx_initialize();
+
     /* Add to preferences under Business */
     /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
     gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,cust_days_in_adj,business_prefs",

commit 47d622de6138b9adf4ccbfa9a56e109966533658
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 16 15:45:58 2017 +0100

    Handle the splash/lock file warning more the gtk way
    
    If the splash screen is still availabe when the dialog should be displayed,
    make the splash' window the transient parent for this dialog.
    
    In the other case we try to use the front-most main window. While this
    works well when calling file->open from the menu, there may not be a
    visible main window yet during startup. Since the user can close
    the splash before the dialog is due, we may end up with no usable candidate
    as parent window.
    In that case the dialog will emit a missing transient parent message on stdout.
    There's no easy fix for this as users don't want to see an incomplete
    main window (see old bug 350993).

diff --git a/gnucash/gnome-utils/gnc-file.c b/gnucash/gnome-utils/gnc-file.c
index ff06c63..eb00ab5 100644
--- a/gnucash/gnome-utils/gnc-file.c
+++ b/gnucash/gnome-utils/gnc-file.c
@@ -775,17 +775,16 @@ RESTART:
                      );
         int rc;
 
+        GtkWindow *parent = gnc_get_splash_screen();
+        if (!parent)
+            parent = GTK_WINDOW(gnc_ui_get_toplevel());
+
         if (! gnc_uri_is_file_uri (newfile)) /* Hide the db password in error messages */
             displayname = gnc_uri_normalize_uri ( newfile, FALSE);
         else
             displayname = g_strdup (newfile);
 
-        // Bug#467521: on Mac (and maybe Win?), the dialog will appear below the
-        // splash, but is modal, so we can't get rid of the splash...  So, get
-        // rid of it now.
-        gnc_destroy_splash_screen();
-
-        dialog = gtk_message_dialog_new(NULL,
+        dialog = gtk_message_dialog_new(parent,
                                         0,
                                         GTK_MESSAGE_WARNING,
                                         GTK_BUTTONS_NONE,
@@ -820,16 +819,10 @@ RESTART:
             break;
         case RESPONSE_READONLY:
             is_readonly = TRUE;
-            // re-enable the splash screen, file loading and display of
-            // reports may take some time
-            gnc_show_splash_screen();
             /* user told us to open readonly. We do ignore locks (just as before), but now also force the opening. */
             qof_session_begin (new_session, newfile, is_readonly, FALSE, TRUE);
             break;
         case RESPONSE_OPEN:
-            // re-enable the splash screen, file loading and display of
-            // reports may take some time
-            gnc_show_splash_screen();
             /* user told us to ignore locks. So ignore them. */
             qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
             break;
diff --git a/gnucash/gnome-utils/gnc-splash.c b/gnucash/gnome-utils/gnc-splash.c
index 1cb20b3..661bf48 100644
--- a/gnucash/gnome-utils/gnc-splash.c
+++ b/gnucash/gnome-utils/gnc-splash.c
@@ -206,3 +206,8 @@ gnc_update_splash_screen (const gchar *string, double percentage)
             gtk_main_iteration ();
     }
 }
+
+GtkWindow *gnc_get_splash_screen (void)
+{
+    return GTK_WINDOW(splash);
+}
diff --git a/gnucash/gnome-utils/gnc-splash.h b/gnucash/gnome-utils/gnc-splash.h
index 61d3687..c6819f4 100644
--- a/gnucash/gnome-utils/gnc-splash.h
+++ b/gnucash/gnome-utils/gnc-splash.h
@@ -22,10 +22,12 @@
 
 #ifndef GNC_SPLASH_H
 #define GNC_SPLASH_H
+#include <gtk/gtk.h>
 
 void gnc_show_splash_screen (void);
 void gnc_destroy_splash_screen (void);
 void gnc_update_splash_screen (const gchar *string, double percentage);
+GtkWindow *gnc_get_splash_screen (void);
 
 #define GNC_SPLASH_PERCENTAGE_UNKNOWN 101
 

commit 66817bb997d601b74b25b7a465a318387fb81594
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Dec 5 14:48:45 2017 -0800

    Rework directory determination in CMake builds.
    
    Sets paths for finding componenents depending on the state of ENABLE_BINRELOC,
    GNC_UNINSTALLED, GNC_BUILDDIR and whether any install paths have been set
    outside of CMAKE_INSTALL_PREFIX.
    
    GNUInstallDirs changes the name of CMAKE_INSTALL_LIBDIR depending on the
    operating system and distro. When CMAKE_INSTALL_PREFIX is /usr,
    /usr/local, or any subdirectory of /opt it also changes
    CMAKE_INSTALL_FULL_SYSCONFDIR to /etc. An earlier commit by Aaron Laws
    mirrors the name of CMAKE_INSTALL_LIBDIR to the build library directory.
    
    It's possible for builders to set any of the install directories
    anywhere they please.
    
    Setting any directory outside of CMAKE_INSTALL_PREFIX breaks Binreloc so
    the toplevel CMakeLists.txt now detects that and disables Binreloc.
    
    If Binreloc is enabled then all path queries use it to find paths. This
    works in the build directory because the gnucash executable and all of
    the test programs are in build_directory/bin and LIBDIR, DATADIR, and
    SYSCONFDIR can be found in the same root path.
    
    If Binreloc is disabled then in order to build or run programs from the
    build directory one must set GNC_UNINSTALLED and set GNC_BUILDDIR to the
    absolute path of the build directory. When those are set GNC_BUILDDIR
    replaces CMAKE_INSTALL_PREFIX in all paths that are subdirectories of
    CMAKE_INSTALL_PREFIX; paths that are not in CMAKE_INSTALL_PREFIX are
    appended whole to GNC_BUILDDIR. This process is constent between CMake
    and gnc_path_get_foo. GnuCash is unlikely to run from a DESTDIR without
    Binreloc.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf9732f..205fbcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,23 @@ OPTION (AUTOTOOLS_IN_DIST "Add autotools support to distribution tarballs." ON)
 # These are also settable from the command line in a similar way.
 
 SET(GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead")
+
+# Check that all of the absolute install paths are inside
+# ${CMAKE_INSTALL_PREFIX}. If they're not, disable binreloc as it
+# won't be able to find paths that aren't relative to the location of
+# the executable.
+foreach(install_dir ${CMAKE_INSTALL_FULL_BINDIR}
+    ${CMAKE_INSTALL_FULL_SYSCONFDIR} ${CMAKE_INSTALL_FULL_DATAROOTDIR}
+    ${CMAKE_INSTALL_FULL_DATADIR} ${CMAKE_INSTALL_FULL_LIBDIR})
+  string(FIND ${install_dir} ${CMAKE_INSTALL_PREFIX} in_prefix)
+  if(in_prefix EQUAL -1)
+    set(ENABLE_BINRELOC OFF)
+    message(WARNING "${install_dir} is set outside of the intallation prefix ${CMAKE_INSTALL_PREFIX}. That will break relocation so ENABLE_BINRELOC is set to off. With relocation disabled GnuCash will run only in its configured install location. You must set GNC_UNINSTALLED=1 and GNC_BUILDDIR=/path/to/builddir to run from the build directory. GnuCash will not run from a DESTDIR.")
+    break()
+  endif()
+endforeach()
+
+# GnuCash installs two files in ${CMAKE_INSTALL_SYSCONFDIR}
 SET(BINDIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "user executables")
 SET(SYSCONFDIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE STRING "read-only single-machine data")
 SET(DATAROOTDIR ${CMAKE_INSTALL_DATAROOTDIR} CACHE STRING "read-only arch.-independent data root")
@@ -82,7 +99,7 @@ SET(LOCALEDIR ${DATAROOTDIR}/locale CACHE STRING "locale-dependent data")
 SET(GNC_HELPDIR ${DATADIR} CACHE STRING "where to store help files")
 SET(DATADIRNAME share)
 SET(GNC_SYSTEM_XDG_DATA_DIRS /usr/local/share /usr/share)
-SET(GNC_DBD_DIR ${CMAKE_PREFIX_PATH}/lib/dbd CACHE PATH "specify location of libdbi drivers")
+SET(GNC_DBD_DIR ${CMAKE_PREFIX_LIBDIR}/dbd CACHE PATH "specify location of libdbi drivers")
 SET(PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/gnucash)
 SET(TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing")
 SET(TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing")
diff --git a/libgnucash/core-utils/CMakeLists.txt b/libgnucash/core-utils/CMakeLists.txt
index 52e1251..a6f1c7b 100644
--- a/libgnucash/core-utils/CMakeLists.txt
+++ b/libgnucash/core-utils/CMakeLists.txt
@@ -43,10 +43,19 @@ ADD_CUSTOM_TARGET(swig-runtime-h DEPENDS ${SWIG_RUNTIME_H})
 SET_SOURCE_FILES_PROPERTIES (gnc-guile-utils.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
 
 SET(prefix ${CMAKE_INSTALL_PREFIX})
-SET(datadir ${DATADIR})
-SET(bindir ${BINDIR})
-SET(libdir ${LIBDIR})
-SET(sysconfdir ${SYSCONFDIR})
+if(ENABLE_BINRELOC)
+  SET(datadir ${DATADIR})
+  SET(bindir ${BINDIR})
+  SET(libdir ${LIBDIR})
+  SET(sysconfdir ${SYSCONFDIR})
+  SET(localedir ${LOCALEDIR})
+else()
+  SET(datadir ${CMAKE_INSTALL_FULL_DATADIR})
+  SET(bindir ${CMAKE_INSTALL_FULL_BINDIR})
+  SET(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+  SET(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
+  SET(localedir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale")
+endif()
 GNC_CONFIGURE(gncla-dir.h.in gncla-dir.h)
 
 ### Create gnc-version.h ###
diff --git a/libgnucash/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c
index 55b7905..1b7b1b6 100644
--- a/libgnucash/core-utils/binreloc.c
+++ b/libgnucash/core-utils/binreloc.c
@@ -33,7 +33,6 @@
 #ifndef __BINRELOC_C__
 #define __BINRELOC_C__
 #include <config.h>
-#include "gncla-dir.h"
 
 #include <platform.h>
 #if PLATFORM(WINDOWS)
@@ -53,7 +52,9 @@
 #include <limits.h>
 #include <string.h>
 #include "binreloc.h"
+#include "gnc-filepath-utils.h"
 #include <glib.h>
+#include "gncla-dir.h"
 
 G_BEGIN_DECLS
 
@@ -84,7 +85,7 @@ _br_find_exe (Gnc_GbrInitError *error)
        the current process */
     prefix = g_win32_get_package_installation_directory_of_module (NULL);
     result = g_build_filename (prefix,
-                               "bin", "gnucash.exe",
+                               BINDIR, "gnucash.exe",
                                (char*)NULL);
     g_free (prefix);
     return result;
@@ -385,13 +386,14 @@ gnc_gbr_find_exe_dir (const gchar *default_dir)
  *         will be returned. If default_prefix is NULL, then NULL will be
  *         returned.
  */
-gchar *
-gnc_gbr_find_prefix (const gchar *default_prefix)
+
+static inline gchar *
+get_mac_bundle_prefix()
 {
 #if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
     gchar *id = gtkosx_application_get_bundle_id ();
     gchar *path = gtkosx_application_get_resource_path ();
-    if (id == NULL)
+     if (id == NULL)
     {
         gchar *dirname = g_path_get_dirname (path);
         g_free (path);
@@ -400,9 +402,24 @@ gnc_gbr_find_prefix (const gchar *default_prefix)
     }
     g_free (id);
     return path;
-#else
-    gchar *dir1, *dir2;
+#endif
+    return NULL;
+}
+
+static inline gchar*
+get_builddir_prefix()
+{
+    if (g_getenv ("GNC_UNINSTALLED"))
+        return g_strdup (g_getenv ("GNC_BUILDDIR"));
+    return NULL;
+}
 
+gchar *
+gnc_gbr_find_prefix (const gchar *default_prefix)
+{
+    gchar *dir1, *dir2;
+    if ((dir2 = get_builddir_prefix()) || (dir2 = get_mac_bundle_prefix()))
+        return dir2;
     if (exe == NULL)
     {
         /* BinReloc not initialized. */
@@ -415,7 +432,6 @@ gnc_gbr_find_prefix (const gchar *default_prefix)
     dir2 = g_path_get_dirname (dir1);
     g_free (dir1);
     return dir2;
-#endif //ENABLE_BINRELOC && defined MAC_INTEGRATION
 }
 
 
@@ -435,7 +451,7 @@ gnc_gbr_find_prefix (const gchar *default_prefix)
 gchar *
 gnc_gbr_find_bin_dir (const gchar *default_bin_dir)
 {
-    gchar *prefix, *dir;
+    gchar *prefix, *dir, *bindir;
     prefix = gnc_gbr_find_prefix (NULL);
     if (prefix == NULL)
     {
@@ -445,47 +461,13 @@ gnc_gbr_find_bin_dir (const gchar *default_bin_dir)
         else
             return NULL;
     }
-
-    dir = g_build_filename (prefix, "bin", NULL);
+    bindir = gnc_file_path_relative_part(PREFIX, BINDIR);
+    dir = g_build_filename (prefix, bindir, NULL);
+    g_free (bindir);
     g_free (prefix);
     return dir;
 }
 
-
-/** Locate the application's superuser binary folder.
- *
- * The path is generated by the following pseudo-code evaluation:
- * \code
- * prefix + "/sbin"
- * \endcode
- *
- * @param default_sbin_dir  A default path which will used as fallback.
- * @return A string containing the sbin folder's path, which must be freed when
- *         no longer necessary. If BinReloc is not initialized, or if the
- *         initialization function failed, then a copy of default_sbin_dir will
- *         be returned. If default_bin_dir is NULL, then NULL will be returned.
- */
-gchar *
-gnc_gbr_find_sbin_dir (const gchar *default_sbin_dir)
-{
-    gchar *prefix, *dir;
-
-    prefix = gnc_gbr_find_prefix (NULL);
-    if (prefix == NULL)
-    {
-        /* BinReloc not initialized. */
-        if (default_sbin_dir != NULL)
-            return g_strdup (default_sbin_dir);
-        else
-            return NULL;
-    }
-
-    dir = g_build_filename (prefix, "sbin", NULL);
-    g_free (prefix);
-    return dir;
-}
-
-
 /** Locate the application's data folder.
  *
  * The path is generated by the following pseudo-code evaluation:
@@ -503,7 +485,7 @@ gnc_gbr_find_sbin_dir (const gchar *default_sbin_dir)
 gchar *
 gnc_gbr_find_data_dir (const gchar *default_data_dir)
 {
-    gchar *prefix, *dir;
+    gchar *prefix, *dir, *datadir;
 
     prefix = gnc_gbr_find_prefix (NULL);
     if (prefix == NULL)
@@ -515,12 +497,13 @@ gnc_gbr_find_data_dir (const gchar *default_data_dir)
             return NULL;
     }
 
-    dir = g_build_filename (prefix, "share", NULL);
+    datadir = gnc_file_path_relative_part(PREFIX, DATADIR);
+    dir = g_build_filename (prefix, datadir, NULL);
+    g_free (datadir);
     g_free (prefix);
     return dir;
 }
 
-
 /** Locate the application's library folder.
  *
  * The path is generated by the following pseudo-code evaluation:
@@ -537,7 +520,7 @@ gnc_gbr_find_data_dir (const gchar *default_data_dir)
 gchar *
 gnc_gbr_find_lib_dir (const gchar *default_lib_dir)
 {
-    gchar *prefix, *dir;
+    gchar *prefix, *dir, *libdir;
 
     prefix = gnc_gbr_find_prefix (NULL);
     if (prefix == NULL)
@@ -549,46 +532,13 @@ gnc_gbr_find_lib_dir (const gchar *default_lib_dir)
             return NULL;
     }
 
-    dir = g_build_filename (prefix, LIBDIR, NULL);
-    g_free (prefix);
-    return dir;
-}
-
-
-/** Locate the application's libexec folder.
- *
- * The path is generated by the following pseudo-code evaluation:
- * \code
- * prefix + "/libexec"
- * \endcode
- *
- * @param default_libexec_dir  A default path which will used as fallback.
- * @return A string containing the libexec folder's path, which must be freed when
- *         no longer necessary. If BinReloc is not initialized, or if the initialization
- *         function failed, then a copy of default_libexec_dir will be returned.
- *         If default_libexec_dir is NULL, then NULL will be returned.
- */
-gchar *
-gnc_gbr_find_libexec_dir (const gchar *default_libexec_dir)
-{
-    gchar *prefix, *dir;
-
-    prefix = gnc_gbr_find_prefix (NULL);
-    if (prefix == NULL)
-    {
-        /* BinReloc not initialized. */
-        if (default_libexec_dir != NULL)
-            return g_strdup (default_libexec_dir);
-        else
-            return NULL;
-    }
-
-    dir = g_build_filename (prefix, "libexec", NULL);
+    libdir = gnc_file_path_relative_part(PREFIX, LIBDIR);
+    dir = g_build_filename (prefix, libdir, NULL);
+    g_free (libdir);
     g_free (prefix);
     return dir;
 }
 
-
 /** Locate the application's configuration files folder.
  *
  * The path is generated by the following pseudo-code evaluation:
@@ -605,7 +555,7 @@ gnc_gbr_find_libexec_dir (const gchar *default_libexec_dir)
 gchar *
 gnc_gbr_find_etc_dir (const gchar *default_etc_dir)
 {
-    gchar *prefix, *dir;
+    gchar *prefix, *dir, *sysconfdir;
 
     prefix = gnc_gbr_find_prefix (NULL);
     if (prefix == NULL)
@@ -617,7 +567,9 @@ gnc_gbr_find_etc_dir (const gchar *default_etc_dir)
             return NULL;
     }
 
-    dir = g_build_filename (prefix, "etc", NULL);
+    sysconfdir = gnc_file_path_relative_part(PREFIX, SYSCONFDIR);
+    dir = g_build_filename (prefix, sysconfdir, NULL);
+    g_free (sysconfdir);
     g_free (prefix);
     return dir;
 }
diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp
index ab2c216..881bfcf 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.cpp
+++ b/libgnucash/core-utils/gnc-filepath-utils.cpp
@@ -193,6 +193,14 @@ gnc_resolve_file_path (const gchar * filefrag)
 
 }
 
+gchar *gnc_file_path_relative_part (const gchar *prefix, const gchar *path)
+{
+    std::string p{path};
+    if (p.find(prefix) == 0)
+        return g_strdup(p.substr(strlen(prefix)).c_str());
+    return g_strdup(path);
+}
+
 /* Searches for a file fragment paths set via GNC_DOC_PATH environment
  * variable. If this variable is not set, fall back to search in
  * - a html directory in the local user's gnucash settings directory
diff --git a/libgnucash/core-utils/gnc-filepath-utils.h b/libgnucash/core-utils/gnc-filepath-utils.h
index 9c2a93a..d0e9ff4 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.h
+++ b/libgnucash/core-utils/gnc-filepath-utils.h
@@ -41,6 +41,14 @@
  */
 gchar *gnc_resolve_file_path (const gchar *filefrag);
 
+/** Given a prefix and a path return the relative portion of the path.
+ * @param prefix The prefix that might be the first part of the path
+ * @param path The path from which the prefix might be removed
+ * @return a char* that must be g_freed containing the path without
+ *        the prefix if path begins with prefix, otherwise a copy of path.
+ */
+gchar *gnc_file_path_relative_part (const gchar *prefix, const gchar *path);
+
 /** @brief Find an absolute path to a localized version of a given
  *  relative path to a html or html related file.
  *  If no localized version exists, an absolute path to the file
diff --git a/libgnucash/core-utils/gnc-path.c b/libgnucash/core-utils/gnc-path.c
index 4a0607d..c979c1f 100644
--- a/libgnucash/core-utils/gnc-path.c
+++ b/libgnucash/core-utils/gnc-path.c
@@ -138,11 +138,16 @@ gchar *gnc_path_get_gtkbuilderdir()
  * @returns A newly allocated string. */
 gchar *gnc_path_get_localedir()
 {
-    gchar *prefix = gnc_path_get_prefix();
-    gchar *result = g_build_filename (prefix, LOCALE_DATADIRNAME, "locale", (char*)NULL);
-    g_free (prefix);
-    //printf("Returning localedir %s\n", result);
-    return result;
+    if (g_path_is_absolute (LOCALEDIR))
+        return g_strdup(LOCALEDIR);
+    else
+    {
+        gchar *prefix = gnc_path_get_prefix();
+        gchar *result = g_build_filename (prefix, LOCALEDIR, (char*)NULL);
+        g_free (prefix);
+        //printf("Returning localedir %s\n", result);
+        return result;
+    }
 }
 
 /** Returns the accounts file path, usually
diff --git a/libgnucash/core-utils/gncla-dir.h.in b/libgnucash/core-utils/gncla-dir.h.in
index c692178..a55d90f 100644
--- a/libgnucash/core-utils/gncla-dir.h.in
+++ b/libgnucash/core-utils/gncla-dir.h.in
@@ -30,4 +30,4 @@
 #define BINDIR "@-bindir-@"
 #define LIBDIR "@-libdir-@"
 
-#define LOCALE_DATADIRNAME "@-DATADIRNAME-@"
+#define LOCALEDIR "@-localedir-@"
diff --git a/libgnucash/core-utils/test/CMakeLists.txt b/libgnucash/core-utils/test/CMakeLists.txt
index f1aa444..2d7f46b 100644
--- a/libgnucash/core-utils/test/CMakeLists.txt
+++ b/libgnucash/core-utils/test/CMakeLists.txt
@@ -1,8 +1,8 @@
-
+set(MODULEPATH ${CMAKE_SOURCE_DIR}/libgnucash/core-utils)
 
 SET(CORE_UTILS_TEST_INCLUDE_DIRS
   ${CMAKE_BINARY_DIR}/common # for config.h
-  ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
+  ${MODULEPATH}
   ${CMAKE_SOURCE_DIR}/common/test-core
   ${GLIB2_INCLUDE_DIRS}
   ${GTK_MAC_INCLUDE_DIRS}
@@ -27,5 +27,31 @@ IF (MAC_INTEGRATION)
   TARGET_COMPILE_DEFINITIONS(test-userdata-dir PRIVATE ${GTK_MAC_CFLAGS_OTHER})
 ENDIF(MAC_INTEGRATION)
 
-SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am test-gnc-glib-utils.c
-    test-resolve-file-path.c test-userdata-dir.c test-userdata-dir-invalid-home.c)
+set(gtest_core_utils_INCLUDES
+  ${MODULEPATH}
+  ${CMAKE_BINARY_DIR}/common # for config.h
+  ${CMAKE_SOURCE_DIR}/common # for platform.h
+  ${CMAKE_BINARY_DIR}/libgnucash/core-utils # for gncla-dir.h
+  ${GLIB2_INCLUDE_DIRS}
+  ${GTEST_INCLUDE_DIR}
+  )
+
+SET(gtest_core_utils_LIBS
+  ${GLIB2_LDFLAGS}
+  ${Boost_LIBRARIES}
+  ${GTHREAD_LDFLAGS}
+  ${GTEST_LIB})
+
+set(test_gnc_path_util_SOURCES
+  ${MODULEPATH}/gnc-path.c
+  ${MODULEPATH}/binreloc.c
+  ${MODULEPATH}/gnc-filepath-utils.cpp
+  gtest-path-utilities.cpp
+  ${GTEST_SRC})
+
+gnc_add_test(test-gnc-path-util "${test_gnc_path_util_SOURCES}"
+  gtest_core_utils_INCLUDES gtest_core_utils_LIBS "GNC_UNINSTALLED=yes")
+
+SET_DIST_LIST(test_core_utils_DIST CMakeLists.txt Makefile.am
+  test-gnc-glib-utils.c test-resolve-file-path.c test-userdata-dir.c
+  test-userdata-dir-invalid-home.c gtest-path-utilities.cpp)
diff --git a/libgnucash/core-utils/test/gtest-path-utilities.cpp b/libgnucash/core-utils/test/gtest-path-utilities.cpp
new file mode 100644
index 0000000..94e8356
--- /dev/null
+++ b/libgnucash/core-utils/test/gtest-path-utilities.cpp
@@ -0,0 +1,125 @@
+extern "C"
+{
+#include <config.h>
+#include <glib.h>
+#include <gncla-dir.h>
+#include <gnc-path.h>
+#include <binreloc.h>
+#include <gnc-filepath-utils.h>
+}
+
+#include <gtest/gtest.h>
+
+struct PathTest : public testing::Test
+{
+    PathTest() : m_prefix{nullptr} {}
+    void SetUp()
+    {
+#ifdef ENABLE_BINRELOC
+        gnc_gbr_init(nullptr);
+#endif
+        char *builddir = g_strdup(g_getenv("GNC_BUILDDIR"));
+        if (builddir)
+            m_prefix = builddir;
+        else
+            m_prefix = g_get_current_dir();
+    }
+    void TearDown()
+    {
+        if (m_prefix)
+            g_free(m_prefix);
+    }
+    char *m_prefix;
+};
+
+TEST_F(PathTest, gnc_path_get_prefix)
+{
+#ifdef ENABLE_BINRELOC
+    EXPECT_STREQ(gnc_path_get_prefix(), m_prefix);
+#else
+    g_setenv("GNC_UNINSTALLED", "1", TRUE);
+    g_setenv("GNC_BUILDDIR", m_prefix, 1);
+    EXPECT_STREQ(gnc_path_get_prefix(), m_prefix);
+    g_unsetenv("GNC_UNINSTALLED");
+    g_unsetenv("GNC_BUILDDIR");
+    EXPECT_STREQ(gnc_path_get_prefix(), PREFIX);
+#endif
+}
+
+TEST_F(PathTest, gnc_path_get_bindir)
+{
+    gchar *dirname = gnc_file_path_relative_part(PREFIX, BINDIR);
+    gchar *binpath = g_build_filename(m_prefix, dirname, NULL);
+    g_free(dirname);
+#ifdef ENABLE_BINRELOC
+    EXPECT_STREQ(gnc_path_get_bindir(), binpath);
+    g_free(binpath);
+#else
+    g_setenv("GNC_UNINSTALLED", "1", TRUE);
+    g_setenv("GNC_BUILDDIR", m_prefix, 1);
+    EXPECT_STREQ(gnc_path_get_bindir(), binpath);
+    g_free(binpath);
+    g_unsetenv("GNC_UNINSTALLED");
+    g_unsetenv("GNC_BUILDDIR");
+    EXPECT_STREQ(gnc_path_get_bindir(), BINDIR);
+#endif
+}
+
+TEST_F(PathTest, gnc_path_get_libdir)
+{
+    gchar *dirname = gnc_file_path_relative_part(PREFIX, LIBDIR);
+    gchar *libpath = g_build_filename(m_prefix, dirname, NULL);
+    g_free(dirname);
+#ifdef ENABLE_BINRELOC
+    EXPECT_STREQ(gnc_path_get_libdir(), libpath);
+    g_free(libpath);
+#else
+    g_setenv("GNC_UNINSTALLED", "1", TRUE);
+    g_setenv("GNC_BUILDDIR", m_prefix, 1);
+    EXPECT_STREQ(gnc_path_get_libdir(), libpath);
+    g_free(libpath);
+    g_unsetenv("GNC_UNINSTALLED");
+    g_unsetenv("GNC_BUILDDIR");
+    EXPECT_STREQ(gnc_path_get_libdir(), LIBDIR);
+#endif
+}
+
+TEST_F(PathTest, gnc_path_get_datadir)
+{
+    gchar *dirname = gnc_file_path_relative_part(PREFIX, DATADIR);
+    gchar *datapath = g_build_filename(m_prefix, dirname, NULL);
+    g_free(dirname);
+#ifdef ENABLE_BINRELOC
+    EXPECT_STREQ(gnc_path_get_datadir(), datapath);
+    g_free(datapath);
+#else
+    g_setenv("GNC_UNINSTALLED", "1", TRUE);
+    g_setenv("GNC_BUILDDIR", m_prefix, 1);
+    EXPECT_STREQ(gnc_path_get_datadir(), datapath);
+    g_free(datapath);
+    g_unsetenv("GNC_UNINSTALLED");
+    g_unsetenv("GNC_BUILDDIR");
+    EXPECT_STREQ(gnc_path_get_datadir(), DATADIR);
+#endif
+}
+
+TEST_F(PathTest, gnc_path_get_sysconfdir)
+{
+    gchar *dirname = gnc_file_path_relative_part(PREFIX, SYSCONFDIR);
+    gchar *sysconfpath = g_build_filename(m_prefix, dirname, "gnucash", NULL);
+    g_free(dirname);
+#ifdef ENABLE_BINRELOC
+    EXPECT_STREQ(gnc_path_get_pkgsysconfdir(), sysconfpath);
+    g_free(sysconfpath);
+#else
+    g_setenv("GNC_UNINSTALLED", "1", TRUE);
+    g_setenv("GNC_BUILDDIR", m_prefix, 1);
+    EXPECT_STREQ(gnc_path_get_pkgsysconfdir(), sysconfpath);
+    g_free(sysconfpath);
+    g_unsetenv("GNC_UNINSTALLED");
+    g_unsetenv("GNC_BUILDDIR");
+    sysconfpath = g_build_filename(SYSCONFDIR, "gnucash", NULL);
+    EXPECT_STREQ(gnc_path_get_pkgsysconfdir(), sysconfpath);
+    g_free(sysconfpath);
+#endif
+}
diff --git a/libgnucash/engine/qof-backend.cpp b/libgnucash/engine/qof-backend.cpp
index 06ee78c..b954ec8 100644
--- a/libgnucash/engine/qof-backend.cpp
+++ b/libgnucash/engine/qof-backend.cpp
@@ -105,12 +105,7 @@ static char* get_default_module_dir(const char* rel_path)
     if (uninstalled)
     {
 #ifdef CMAKE_BUILD
-    #ifdef WIN32
-        #define MODULE_LIBDIR "bin"
-    #else
-        #define MODULE_LIBDIR LIBDIR "/gnucash"
-    #endif
-        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, MODULE_LIBDIR, NULL);
+        pkglibdir = gnc_path_get_pkglibdir ();
 #else
         if (rel_path)
             pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,

commit 84929c8e5bce2388108a18c94054a9a30c6310eb
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Dec 2 10:34:07 2017 -0800

    One more stray header in libexec.

diff --git a/common/test-core/CMakeLists.txt b/common/test-core/CMakeLists.txt
index 3309232..7774b9c 100644
--- a/common/test-core/CMakeLists.txt
+++ b/common/test-core/CMakeLists.txt
@@ -73,4 +73,3 @@ ADD_LIBRARY(gmock STATIC  ${lib_gmock_SOURCES})
 TARGET_INCLUDE_DIRECTORIES(gmock PUBLIC
   ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR}
   ${GMOCK_INCLUDE_DIR} ${GMOCK_SRC_DIR})
-INSTALL(FILES unittest-support.h DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/gnucash/libgnucash/engine/test)

commit ad11afefb48dbcfa958e332042f3be80159f78dd
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 20:31:44 2017 -0800

    LIBDIR is not lib--two more CMakeLists.txt.

diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 5c8f129..2038a35 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -96,7 +96,7 @@ IF(WITH_PYTHON)
     DEPENDS ${SWIG_GNUCASH_CORE_C})
 
   ADD_CUSTOM_TARGET(gnucash-core-c-build ALL
-    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/gnucash/_gnucash_core_c${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
+    COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_gnucash_core_c${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
     DEPENDS gnucash_core_c)
     
 ENDIF()
diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt
index 201bde7..75bc92e 100644
--- a/bindings/python/tests/CMakeLists.txt
+++ b/bindings/python/tests/CMakeLists.txt
@@ -3,7 +3,7 @@ IF (WITH_PYTHON)
   ADD_TEST(python-bindings ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runTests.py.in)
   SET_PROPERTY(TEST python-bindings PROPERTY ENVIRONMENT
     GNC_BUILDDIR=${CMAKE_BINARY_DIR}
-    PYTHONPATH=${PYTHON_SYSCONFIG_BUILD}:${CMAKE_BINARY_DIR}/lib/gnucash:${CMAKE_BINARY_DIR}/common/test-core
+    PYTHONPATH=${PYTHON_SYSCONFIG_BUILD}:${LIBDIR_BUILD}/gnucash:${CMAKE_BINARY_DIR}/common/test-core
   )
 ENDIF()
 

commit e319a16747d8b9b9d91ed60de22f77a75c0e5320
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 20:10:55 2017 -0800

    Remove gnucash/test.
    
    The only purpose of which was to test overrides/gnucash-env.

diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
index bb57499..2fb80db 100644
--- a/common/cmake_modules/MakeDistFiles.cmake
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -46,7 +46,6 @@ SET(COPY_FROM_BUILD
   libgnucash/app-utils/swig-app-utils-python.c
   libgnucash/backend/xml/test/test-real-data.sh
   gnucash/gnucash.rc
-  gnucash/test/test-version
   libgnucash/core-utils/gnc-vcs-info.h
   libgnucash/core-utils/swig-core-utils-guile.c
   libgnucash/core-utils/swig-core-utils-python.c
diff --git a/configure.ac b/configure.ac
index 83f76fb..cdc0a5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1777,8 +1777,6 @@ AC_CONFIG_FILES(
 dnl # Shell scripts, to have their shells set
 AC_CONFIG_FILES([libgnucash/backend/xml/test/test-real-data.sh],
                 [chmod +x libgnucash/backend/xml/test/test-real-data.sh])
-AC_CONFIG_FILES([gnucash/test/test-version],
-                [chmod +x gnucash/test/test-version])
 
 
 #Link (copy on Windows) test data files:
diff --git a/gnucash/test/CMakeLists.txt b/gnucash/test/CMakeLists.txt
deleted file mode 100644
index 2ec82f0..0000000
--- a/gnucash/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIGURE_FILE(test-version.in test-version)
-
-ADD_TEST(NAME test-version
-         COMMAND ${CMAKE_BINARY_DIR}/bin/gnucash --version)
-
-SET_DIST_LIST(test_bin_DIST CMakeLists.txt Makefile.am test-version.in)
\ No newline at end of file
diff --git a/gnucash/test/Makefile.am b/gnucash/test/Makefile.am
deleted file mode 100644
index b8d3ad4..0000000
--- a/gnucash/test/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-TESTS = test-version
-
-TESTS_ENVIRONMENT = \
-	PATH="..:${PATH}"
-
-EXTRA_DIST = \
-	test-version \
-	CMakeLists.txt
diff --git a/gnucash/test/test-version.in b/gnucash/test/test-version.in
deleted file mode 100755
index d5b1356..0000000
--- a/gnucash/test/test-version.in
+++ /dev/null
@@ -1,5 +0,0 @@
-#! @SHELL@
-GUILE_WARN_DEPRECATED="no"
-export GUILE_WARN_DEPRECATED
-
-exec ../overrides/gnucash-build-env ../gnucash --version

commit fcb4bdac9efef0d813d00356edf312463c053f1a
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 17:00:26 2017 -0800

    Some fixes to complete removing gnucash/overrides.

diff --git a/.gitignore b/.gitignore
index 9db59d0..d6c752e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -192,9 +192,6 @@ gnucash/gnucash-launcher
 gnucash/gnucash-make-guids
 gnucash/gnucash-setup-env
 gnucash/gnucash-valgrind
-gnucash/overrides/gnucash-build-env
-gnucash/overrides/gnucash-env
-gnucash/overrides/guile
 gnucash/gnome/gnucash
 gnucash/gnome/gnucash.desktop
 gnucash/gnome/gnucash.desktop.in
diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
index 405c87d..bb57499 100644
--- a/common/cmake_modules/MakeDistFiles.cmake
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -46,7 +46,6 @@ SET(COPY_FROM_BUILD
   libgnucash/app-utils/swig-app-utils-python.c
   libgnucash/backend/xml/test/test-real-data.sh
   gnucash/gnucash.rc
-  gnucash/overrides/gnucash-make-guids
   gnucash/test/test-version
   libgnucash/core-utils/gnc-vcs-info.h
   libgnucash/core-utils/swig-core-utils-guile.c
diff --git a/configure.ac b/configure.ac
index 21d62ad..83f76fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1654,7 +1654,6 @@ AC_CONFIG_FILES(
   doc/Makefile
   doc/examples/Makefile
   gnucash/Makefile
-  gnucash/test/Makefile
   gnucash/gnome/Makefile
   gnucash/gnome/gtkbuilder/Makefile
   gnucash/gnome/gschemas/Makefile
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index fe928ce..e18aaa1 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -9,7 +9,6 @@ ADD_SUBDIRECTORY (import-export)
 ADD_SUBDIRECTORY (python)
 ADD_SUBDIRECTORY (register)
 ADD_SUBDIRECTORY (report)
-ADD_SUBDIRECTORY (test)
 
 ADD_DEFINITIONS (-DHAVE_CONFIG_H)
 
@@ -87,25 +86,6 @@ ENDIF(MAC_INTEGRATION)
 INSTALL(TARGETS gnucash DESTINATION ${CMAKE_INSTALL_BINDIR})
 # No headers to install.
 
-# Generate the gnucash-env script
-SET(SCRIPT_LIST  "")
-SET(SCRIPT_OUTPUT_DIR ${BINDIR_BUILD})
-
-FOREACH (script gnucash-env gnucash-make-guids)
-  SET (GNUCASH_ENV_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${script})
-  LIST(APPEND SCRIPT_LIST ${SCRIPT_OUTPUT_DIR}/${script})
-  SET (GNC_OVERRIDES_DIR ${CMAKE_INSTALL_LIBEXECDIR}/gnucash/overrides)
-  FILE(WRITE ${GNUCASH_ENV_SCRIPT} "#!/bin/sh\n")
-  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "PATH=\"${GNC_OVERRIDES_DIR}:\${PATH}\"\n")
-  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export PATH\n")
-  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nGUILE_WARN_DEPRECATED=\"no\"\n")
-  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "export GUILE_WARN_DEPRECATED\n")
-  FILE(APPEND ${GNUCASH_ENV_SCRIPT} "\nexec \"${script}\" \"\$@\"\n")
-  FILE(COPY ${GNUCASH_ENV_SCRIPT}
-       DESTINATION ${SCRIPT_OUTPUT_DIR}
-       FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-  )
-ENDFOREACH(script)
 
 SET(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
 SET(GNUCASH_BIN_INSTALL_NAME "gnucash")
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index 8170ee7..9e77444 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -11,8 +11,7 @@ SUBDIRS = \
   register \
   gnome \
   import-export \
-  . \
-  test
+  .
 
 AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
   -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
@@ -118,40 +117,6 @@ endif
 
 CLEANFILES = $(BUILT_SOURCES) ${config_DATA} ${PLATFORM_FILES}
 
-if !PLATFORM_WIN32
-# The gnucash scripts don't make sense on Windows, so will only be
-# generated and included on the other platforms.
-# We handle gnucash scripts in a somewhat unexpected way, but we do
-# this so that a user who doesn't necessarily have the right
-# directories in their path can still invoke these commands via their
-# full path, say /some/dir/not/in/path/gnucash and still have the
-# right thing happen (i.e. they'll still get the right guile, and the
-# right scripts if they sub-exec anything from their scripts).  If you
-# want to add another gnucash script, please add the name here (which
-# will cause the bindir wrapper to be created, and then put the actual
-# code in a script of the same name in ./overrides.  Oh, and don't
-# forget to add your script to configure.in's "Adjustments" section if
-# you need to.
-#
-# For testing and other reasons, overrides/* scripts should not modify
-# the path to re-insert the overrides dir.  This should only be done
-# by these top-level "common" scripts.
-gnc_common_scripts = gnucash-env gnucash-make-guids
-
-bin_SCRIPTS = \
-    ${gnc_common_scripts} \
-	${PLATFORM_FILES}
-
-# if you change gncoverridedir, make sure you change ./overrides/Makefile.am too.
-gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
-
-## Gnucash scripts -- real code is in overrides, these just get you there.
-${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status
-	${srcdir}/generate-gnc-script $@ "${gncoverridesdir}"
-
-CLEANFILES += ${gnc_common_scripts}
-
-endif
 
 EXTRA_DIST = \
 	generate-gnc-script \

commit e7b7974a3c13937b99aaf66f6f12382d1cec378f
Author: Rob Gowin <robgowin at gmail.com>
Date:   Fri Dec 1 12:53:17 2017 -0600

    Handle cases where LIBDIR is not "lib"
    
    For example, Fedora installs to lib64, Debian to lib/<arch-tuple>

diff --git a/libgnucash/engine/Makefile.am b/libgnucash/engine/Makefile.am
index 9e4e868..5b8ae45 100644
--- a/libgnucash/engine/Makefile.am
+++ b/libgnucash/engine/Makefile.am
@@ -8,6 +8,7 @@ pkglib_LTLIBRARIES = libgncmod-engine.la
 AM_CPPFLAGS = \
 	-I${top_srcdir}/borrowed/libc \
 	-I${top_srcdir}/libgnucash/core-utils \
+	-I${top_builddir}/libgnucash/core-utils \
 	-I${top_srcdir}/common \
 	-I${top_builddir}/common \
 	-I${top_srcdir}/libgnucash/gnc-module \

commit 2be5642a7d8e63741ae140a259e2b8369b42e9fc
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 15:25:28 2017 -0800

    Fix autotools build after removing gnucash/overrides.

diff --git a/configure.ac b/configure.ac
index d1a680b..21d62ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1654,7 +1654,6 @@ AC_CONFIG_FILES(
   doc/Makefile
   doc/examples/Makefile
   gnucash/Makefile
-  gnucash/overrides/Makefile
   gnucash/test/Makefile
   gnucash/gnome/Makefile
   gnucash/gnome/gtkbuilder/Makefile
@@ -1782,8 +1781,7 @@ AC_CONFIG_FILES([libgnucash/backend/xml/test/test-real-data.sh],
 AC_CONFIG_FILES([gnucash/test/test-version],
                 [chmod +x gnucash/test/test-version])
 
-# A few files need extra actions at creation time
-AC_CONFIG_FILES([gnucash/overrides/gnucash-make-guids], [chmod u+x gnucash/overrides/gnucash-make-guids])
+
 #Link (copy on Windows) test data files:
 AC_CONFIG_LINKS([gnucash/import-export/csv-imp/test/sample1.csv:gnucash/import-export/csv-imp/test/sample1.csv])
 LDFLAGS="${LDFLAGS} ${NOUNDEF}"
diff --git a/gnucash/Makefile.am b/gnucash/Makefile.am
index c79855f..8170ee7 100644
--- a/gnucash/Makefile.am
+++ b/gnucash/Makefile.am
@@ -1,9 +1,6 @@
 if WITH_PYTHON
    PYTHON_DIR = python
 endif
-if !PLATFORM_WIN32
-  OVERRIDES_DIR = overrides
-endif
 # Order is important here.
 SUBDIRS = \
   ${PYTHON_DIR} \
@@ -15,7 +12,6 @@ SUBDIRS = \
   gnome \
   import-export \
   . \
-  ${OVERRIDES_DIR} \
   test
 
 AM_CPPFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \

commit 778b86e29e3d82ef076fd9df80509490061c2bcf
Author: Rob Gowin <robgowin at gmail.com>
Date:   Fri Dec 1 12:53:17 2017 -0600

    Handle cases where LIBDIR is not "lib"
    
    For example, Fedora installs to lib64, Debian to lib/<arch-tuple>

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0dc6124..bf9732f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,8 +88,10 @@ SET(TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing")
 SET(TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing")
 
 SET(DATADIR_BUILD    ${CMAKE_BINARY_DIR}/${DATADIRNAME})
-SET(LIBDIR_BUILD     ${CMAKE_BINARY_DIR}/lib)
+STRING(REPLACE ${CMAKE_INSTALL_PREFIX} "" LIBDIR_BUILD ${LIBDIR})
+SET(LIBDIR_BUILD     ${CMAKE_BINARY_DIR}/${LIBDIR_BUILD})
 SET(SYSCONFDIR_BUILD ${CMAKE_BINARY_DIR}/etc)
+SET(LIBEXECDIR_BUILD ${CMAKE_BINARY_DIR}/libexec)
 SET(BINDIR_BUILD     ${CMAKE_BINARY_DIR}/bin)
 
 SET(SHELL_FROM_ENV $ENV{SHELL})
@@ -506,13 +508,13 @@ SET(BUILD_SHARED_LIBS ON)
 # (after the targets have been read in).
 
 
-SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/lib/gnucash)
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY         ${LIBDIR_BUILD}/gnucash)
 IF (XCODE_VERSION)
   # FIXME: These settings break the ability to manipulate different configurations (Debug,
   # FIXME: Release, etc.) in Xcode. We'll need to change the module loading C code if
   # we want to support multi config.
-  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${CMAKE_BINARY_DIR}/lib/gnucash)
-  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib/gnucash)
+  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${LIBDIR_BUILD}/gnucash)
+  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBDIR_BUILD}/gnucash)
 ENDIF()
 
 # For binarines
@@ -808,10 +810,10 @@ add_custom_target(uninstall
 
 SET_TARGET_PROPERTIES(gnc-core-utils gnc-module gnc-backend-sql gnc-backend-xml-utils
   gnc-gnome PROPERTIES
-  LIBRARY_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/lib
+  LIBRARY_OUTPUT_DIRECTORY         ${LIBDIR_BUILD}
   IF (XCODE_VERSION)
-    LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${CMAKE_BINARY_DIR}/lib
-    LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib
+    LIBRARY_OUTPUT_DIRECTORY_DEBUG   ${LIBDIR_BUILD}
+    LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBDIR_BUILD}
   ENDIF()
 
   RUNTIME_OUTPUT_DIRECTORY         ${CMAKE_BINARY_DIR}/bin
diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
index fa8a8c5..0f11a63 100644
--- a/common/cmake_modules/GncAddTest.cmake
+++ b/common/cmake_modules/GncAddTest.cmake
@@ -1,7 +1,7 @@
 
 
 FUNCTION(GET_GUILE_ENV)
-  SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/lib/gnucash)
+  SET(_GNC_MODULE_PATH ${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash)
   IF (WIN32)
     SET(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/bin)
   ENDIF()
@@ -25,7 +25,7 @@ FUNCTION(GET_GUILE_ENV)
       set(fpath "${fpath}${dir}:")
     endforeach(dir)
     LIST(APPEND env "PATH=${fpath}")
-    set(compiled_path "${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
+    set(compiled_path "${LIBDIR_BUILD}/gnucash/scm/ccache/2.0")
     string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
     LIST(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
   ENDIF(MINGW64)
@@ -33,7 +33,7 @@ FUNCTION(GET_GUILE_ENV)
   LIST(APPEND env "GUILE=${GUILE_EXECUTABLE}")
 
   IF (NOT WIN32)
-    LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/scm/ccache/2.0")
+    LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${LIBDIR_BUILD}/gnucash/scm/ccache/2.0")
   ENDIF()
   SET(guile_load_paths "")
   LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo)
diff --git a/libgnucash/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c
index b44115f..55b7905 100644
--- a/libgnucash/core-utils/binreloc.c
+++ b/libgnucash/core-utils/binreloc.c
@@ -33,6 +33,7 @@
 #ifndef __BINRELOC_C__
 #define __BINRELOC_C__
 #include <config.h>
+#include "gncla-dir.h"
 
 #include <platform.h>
 #if PLATFORM(WINDOWS)
@@ -548,7 +549,7 @@ gnc_gbr_find_lib_dir (const gchar *default_lib_dir)
             return NULL;
     }
 
-    dir = g_build_filename (prefix, "lib", NULL);
+    dir = g_build_filename (prefix, LIBDIR, NULL);
     g_free (prefix);
     return dir;
 }
diff --git a/libgnucash/engine/qof-backend.cpp b/libgnucash/engine/qof-backend.cpp
index 79943b1..06ee78c 100644
--- a/libgnucash/engine/qof-backend.cpp
+++ b/libgnucash/engine/qof-backend.cpp
@@ -28,6 +28,7 @@ extern "C"
 #include <config.h>
 #include "qof.h"
 #include <gnc-path.h>
+#include "gncla-dir.h"
 }
 
 #include <string>
@@ -105,11 +106,11 @@ static char* get_default_module_dir(const char* rel_path)
     {
 #ifdef CMAKE_BUILD
     #ifdef WIN32
-        #define LIBDIR "bin"
+        #define MODULE_LIBDIR "bin"
     #else
-        #define LIBDIR "lib/gnucash"
+        #define MODULE_LIBDIR LIBDIR "/gnucash"
     #endif
-        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, LIBDIR, NULL);
+        pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir, MODULE_LIBDIR, NULL);
 #else
         if (rel_path)
             pkglibdir = g_build_path (G_DIR_SEPARATOR_S, builddir,
diff --git a/libgnucash/gnc-module/test/CMakeLists.txt b/libgnucash/gnc-module/test/CMakeLists.txt
index a6ab0ee..f666299 100644
--- a/libgnucash/gnc-module/test/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/CMakeLists.txt
@@ -22,7 +22,7 @@ FUNCTION(RUN_TEST_WITH_GUILE _TARGET _SOURCE_FILE)
   GET_GUILE_ENV()
   SET(CMAKE_COMMAND_TMP "")
   IF (${CMAKE_VERSION} VERSION_GREATER 3.1)
-  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV};GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test")
+  SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "${GUILE_ENV};GNC_MODULE_PATH=$${LIBDIR_BUILD}/gnucash/test")
   ENDIF()
   ADD_TEST(NAME ${_TARGET}
     COMMAND ${CMAKE_COMMAND_TMP}
@@ -32,7 +32,7 @@ FUNCTION(RUN_TEST_WITH_GUILE _TARGET _SOURCE_FILE)
   SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")
 ENDFUNCTION()
 
-GNC_ADD_TEST_WITH_GUILE(test-load-c test-load-c.c GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS "GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test")
+GNC_ADD_TEST_WITH_GUILE(test-load-c test-load-c.c GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test")
 
 GNC_ADD_TEST_WITH_GUILE(test-modsysver test-modsysver.c
   GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
@@ -42,10 +42,10 @@ GNC_ADD_TEST_WITH_GUILE(test-incompatdep test-incompatdep.c
 )
 GNC_ADD_TEST_WITH_GUILE(test-agedver test-agedver.c
   GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS
-  "GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test"
+  "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test"
 )
 
-SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib)
+SET(_LIBDIR ${LIBDIR_BUILD})
 IF (WIN32)
   SET(_LIBDIR ${CMAKE_BINARY_DIR}/bin)
 ENDIF()
@@ -78,7 +78,7 @@ IF(NOT WIN32)
   # This little dance is needed because gnc_module_init will assert if
   # it finds libgncmod_futuremod.so outside of a test that expects it.
   GET_GUILE_ENV()
-  SET(_GNC_MODULE_PATH "${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/lib/gnucash:${CMAKE_BINARY_DIR}/lib/gnucash/test")
+  SET(_GNC_MODULE_PATH "${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${LIBDIR_BUILD}/gnucash/test")
   FOREACH(test_file ${test_gnc_module_SCHEME})
     GET_FILENAME_COMPONENT(basename ${test_file} NAME_WE)
     SET_TESTS_PROPERTIES(${basename} PROPERTIES ENVIRONMENT "${GUILE_ENV};GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
diff --git a/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt b/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
index 49a0520..e9a5b99 100644
--- a/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/misc-mods/CMakeLists.txt
@@ -14,8 +14,8 @@ ADD_LIBRARY(gncmod_incompatdep  EXCLUDE_FROM_ALL incompatdep.c)
 TARGET_LINK_LIBRARIES(gncmod_incompatdep gnc-module ${GLIB2_LDFLAGS})
 
 SET_TARGET_PROPERTIES(gncmod_agedver gncmod_futuremodsys gncmod_incompatdep PROPERTIES
-LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
-ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
+LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
+ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
 SET_DIST_LIST(misc_mods_DIST CMakeLists.txt Makefile.am agedver.c futuremodsys.c incompatdep.c)
diff --git a/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
index 8a90648..56f9f21 100644
--- a/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
@@ -22,8 +22,8 @@ TARGET_INCLUDE_DIRECTORIES(gncmodbar PRIVATE
 )
 
 SET_TARGET_PROPERTIES(bar gncmodbar PROPERTIES
-LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
-ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
+LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
+ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
 SET_DIST_LIST(mod_bar_DIST CMakeLists.txt Makefile.am bar.c gnucash/bar.scm bar.h bar.i gnc-mod-bar.c)
diff --git a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
index 17c3c56..6f18ed8 100644
--- a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
@@ -35,8 +35,8 @@ GNC_ADD_SCHEME_TARGETS(scm-mod-baz
   )
 
 SET_TARGET_PROPERTIES(baz gncmodbaz PROPERTIES
-LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
-ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
+LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
+ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
 SET_DIST_LIST(mod_baz_DIST CMakeLists.txt Makefile.am baz.c gnucash/baz.scm baz.h baz.i gnc-mod-baz.c)
diff --git a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
index 0a6d37f..ba8cb42 100644
--- a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
@@ -29,8 +29,8 @@ GNC_ADD_SCHEME_TARGETS(scm-mod-foo
   )
 
 SET_TARGET_PROPERTIES(foo gncmodfoo PROPERTIES
-LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
-ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
+LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
+ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
 SET_DIST_LIST(mod_foo_DIST CMakeLists.txt Makefile.am foo.i gnucash/foo.scm foo.c foo.h gnc-mod-foo.c)

commit 0a8e50069c7e0d82389fc18a2198cc8580686e46
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 13:56:43 2017 -0800

    Remove overrides directory as being obsolete.
    
    Also don't install qof test headers to libexec.

diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index 49b9d40..fe928ce 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -9,7 +9,6 @@ ADD_SUBDIRECTORY (import-export)
 ADD_SUBDIRECTORY (python)
 ADD_SUBDIRECTORY (register)
 ADD_SUBDIRECTORY (report)
-ADD_SUBDIRECTORY (overrides)
 ADD_SUBDIRECTORY (test)
 
 ADD_DEFINITIONS (-DHAVE_CONFIG_H)
diff --git a/gnucash/overrides/CMakeLists.txt b/gnucash/overrides/CMakeLists.txt
deleted file mode 100644
index 1ca1c47..0000000
--- a/gnucash/overrides/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-
-SET(GNC_PKGLIB_INSTALLDIR ${PKGLIBDIR})
-SET(GNC_SCM_INSTALLDIR ${SCHEME_INSTALLED_SOURCE_DIR})
-SET(GNC_LIB_INSTALLDIR ${LIBDIR})
-SET(GNC_PYTHON_DIR ${GNUCASH_PATH_DIR})
-SET(GUILE ${GUILE_EXECUTABLE})
-SET(GNC_SRCDIR ${CMAKE_SOURCE_DIR})
-SET(GNC_BUILDDIR ${CMAKE_BINARY_DIR})
-
-CONFIGURE_FILE(gnucash-make-guids.in gnucash-make-guids)
-CONFIGURE_FILE(gnucash-make-guids.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-make-guids)
-GNC_CONFIGURE(gnucash-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-env)
-GNC_CONFIGURE(guile.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/guile) #not installed
-GNC_CONFIGURE(gnucash-build-env.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gnucash-build-env)   # not installed
-
-SET_DIST_LIST(overrides_DIST CMakeLists.txt gnucash-build-env.in gnucash-env.in gnucash-make-guids.in guile.in Makefile.am)
-
-SET(SCRIPT_OUTPUT_DIR ${LIBDIR_BUILD}exec/gnucash/overrides)
-
-FOREACH(file gnucash-make-guids gnucash-env guile gnucash-build-env)
-  FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${file}
-       DESTINATION ${SCRIPT_OUTPUT_DIR}
-       FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-  )
-ENDFOREACH(file)
-
-INSTALL(
-    PROGRAMS
-      ${SCRIPT_OUTPUT_DIR}/gnucash-env
-      ${SCRIPT_OUTPUT_DIR}/gnucash-make-guids
-    DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/gnucash/overrides
-)
diff --git a/gnucash/overrides/Makefile.am b/gnucash/overrides/Makefile.am
deleted file mode 100644
index 29bbe10..0000000
--- a/gnucash/overrides/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-gncoverridesdir = ${GNC_LIBEXECDIR}/overrides
-# When you add a file here, please modify ../test/Makefile.am's overrides.stamp
-gncoverrides_SCRIPTS = \
-  gnucash-env \
-  gnucash-make-guids
-
-EXTRA_DIST = \
-  gnucash-env.in \
-  gnucash-build-env.in \
-  gnucash-make-guids \
-  guile.in \
-  CMakeLists.txt
-
-noinst_DATA = gnucash-build-env guile
-
-PWD := $(shell pwd)
-
-## We borrow guile's convention and use @-...-@ as the substitution
-## brackets below, instead of the usual @... at .  This prevents autoconf
-## from substituting the values directly into the left-hand sides of
-## the sed substitutions.  *sigh*
-
-guile: guile.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e 's#@-GUILE-@#${GUILE}#'
-	mv $@.tmp $@
-	chmod u+x $@
-CLEANFILES = guile
-
-gnucash-env: gnucash-env.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-	    -e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
-            -e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
-            -e 's#@-GNC_PKGLIB_INSTALLDIR-@#${pkglibdir}#g' \
-            -e 's#@-GNC_SCRIPT_OVERRIDE_DIR-@#${gncoverridedir}#g' \
-            -e 's#@-GNC_PYTHON_DIR-@#${pythondir}#g'
-	mv $@.tmp $@
-	chmod u+x $@
-CLEANFILES += gnucash-env
-
-gnucash-build-env: gnucash-build-env.in ${top_builddir}/config.status Makefile
-	rm -f $@.tmp
-	sed < $< > $@.tmp \
-            -e 's#@-GNC_BUILDDIR-@#${abs_top_builddir}#g' \
-            -e 's#@-GNC_SRCDIR-@#${abs_top_srcdir}#g'
-	mv $@.tmp $@
-	chmod u+x $@
-CLEANFILES += gnucash-build-env
diff --git a/gnucash/overrides/gnucash-build-env.in b/gnucash/overrides/gnucash-build-env.in
deleted file mode 100644
index 0a3fb65..0000000
--- a/gnucash/overrides/gnucash-build-env.in
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-# Usage: gnucash-build-env
-
-# Usage: gnucash-build-env any-cmd [ args ... ]
-# runs any-cmd in gnucash's build environment.
-
-# As with all the other gnucash overrides scripts, expects PATH to be
-# set appropriately.
-
-top_srcdir="@-GNC_SRCDIR-@"
-top_builddir="@-GNC_BUILDDIR-@"
-
-if test "${GNC_CONFIG_PATH}"x = x
-then
-  GNC_CONFIG_PATH="(\"${top_srcdir}/libgnucash/scm\")"
-  export GNC_CONFIG_PATH
-fi
-
-if test "${GNC_SHARE_PATH}"x = x
-then
-  GNC_SHARE_PATH="(\"${top_srcdir}/libgnucash/scm\" \"${top_srcdir}/libgnucash/quotes\")"
-  export GNC_SHARE_PATH
-fi
-
-if test "${GNC_DOC_PATH}"x = x
-then
-  GNC_DOC_PATH="(\"${top_srcdir}/libgnucash/scm\")"
-  export GNC_DOC_PATH
-fi
-
-set +x
-eval `${top_srcdir}/common/gnc-test-env.pl \
-  --gnc-module-dir ${top_builddir}/libgnucash/engine \
-  --gnc-module-dir ${top_builddir}/libgnucash/tax/us \
-  --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
-  --gnc-module-dir ${top_builddir}/gnucash/gnome-utils \
-  --gnc-module-dir ${top_builddir}/gnucash/gnome-search \
-  --gnc-module-dir ${top_builddir}/gnucash/import-export \
-  --gnc-module-dir ${top_builddir}/gnucash/import-export/hbci \
-  --gnc-module-dir ${top_builddir}/gnucash/import-export/log-replay \
-  --gnc-module-dir ${top_builddir}/gnucash/import-export/ofx \
-  --gnc-module-dir ${top_builddir}/gnucash/import-export/qif-import \
-  --gnc-module-dir ${top_builddir}/gnucash/report/locale-specific/us \
-  --gnc-module-dir ${top_builddir}/gnucash/report/report-gnome \
-  --gnc-module-dir ${top_builddir}/gnucash/report/stylesheets \
-  --gnc-module-dir ${top_builddir}/gnucash/register/register-core \
-  --gnc-module-dir ${top_builddir}/gnucash/register/register-gnome \
-  --gnc-module-dir ${top_builddir}/gnucash/register/ledger-core \
-\
-  --guile-load-dir ${top_builddir}/libgnucash/app-utils \
-  --guile-load-dir ${top_builddir}/libgnucash/core-utils \
-  --guile-load-dir ${top_builddir}/libgnucash/gnc-module \
-  --guile-load-dir ${top_builddir}/libgnucash/engine \
-  --guile-load-dir ${top_builddir}/libgnucash/scm \
-  --guile-load-dir ${top_builddir}/libgnucash/tax/us \
-  --guile-load-dir ${top_builddir}/gnucash/gnome-utils \
-  --guile-load-dir ${top_builddir}/gnucash/import-export/qif-import \
-  --guile-load-dir ${top_builddir}/gnucash/report/report-system \
-  --guile-load-dir ${top_builddir}/gnucash/report/standard-reports \
-  --guile-load-dir ${top_builddir}/gnucash/report/business-reports \
-  --guile-load-dir ${top_builddir}/gnucash/report/utility-reports \
-  --guile-load-dir ${top_builddir}/gnucash/report/locale-specific/us \
-  --guile-load-dir ${top_builddir}/gnucash/report/report-gnome \
-  --guile-load-dir ${top_builddir}/gnucash/report/stylesheets \
-\
-  --library-dir    ${top_builddir}/common/test-core \
-  --library-dir    ${top_builddir}/libgnucash/core-utils \
-  --library-dir    ${top_builddir}/libgnucash/app-utils \
-  --library-dir    ${top_builddir}/libgnucash/app-utils/calculation \
-  --library-dir    ${top_builddir}/libgnucash/engine \
-  --library-dir    ${top_builddir}/libgnucash/backend/xml \
-  --library-dir    ${top_builddir}/libgnucash/backend/sql  \
-  --library-dir    ${top_builddir}/libgnucash/gnc-module \
-  --library-dir    ${top_builddir}/gnucash/gnome \
-  --library-dir    ${top_builddir}/gnucash/gnome-search \
-  --library-dir    ${top_builddir}/gnucash/gnome-utils \
-  --library-dir    ${top_builddir}/gnucash/html \
-  --library-dir    ${top_builddir}/gnucash/import-export \
-  --library-dir    ${top_builddir}/gnucash/register/register-gnome \
-  --library-dir    ${top_builddir}/gnucash/register/ledger-core \
-  --library-dir    ${top_builddir}/gnucash/register/register-core \
-  --library-dir    ${top_builddir}/gnucash/report/report-gnome \
-  --library-dir    ${top_builddir}/gnucash/report/report-system
-  `
-LD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}"
-
-exec "$@"
diff --git a/gnucash/overrides/gnucash-env.in b/gnucash/overrides/gnucash-env.in
deleted file mode 100644
index e9fc640..0000000
--- a/gnucash/overrides/gnucash-env.in
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# Usage: gnucash-env any-cmd [ args ... ]
-# runs any-cmd in an environment appropriate for gnucash.
-# we'll also add a gnucash-build-env later for running from the install tree.
-
-GNC_MODULE_PATH="@-GNC_PKGLIB_INSTALLDIR-@:${GNC_MODULE_PATH}"
-
-EXTRA_PATH="${EXTRA_PATH}:@-GNC_SCM_INSTALL_DIR-@"
-
-GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
-
-EXTRA_LIBS="${GNC_MODULE_PATH}"
-EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_LIB_INSTALLDIR-@"
-EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_PKGLIB_INSTALLDIR-@"
-
-LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
-DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"
-
-PYTHONPATH="${PYTHONPATH}:@-GNC_PYTHON_DIR-@"
-
-export GNC_MODULE_PATH
-export GUILE_LOAD_PATH
-export LD_LIBRARY_PATH
-export DYLD_LIBRARY_PATH
-export PYTHONPATH
-
-exec "$@"
diff --git a/gnucash/overrides/gnucash-make-guids.in b/gnucash/overrides/gnucash-make-guids.in
deleted file mode 100755
index df501ce..0000000
--- a/gnucash/overrides/gnucash-make-guids.in
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-exec gnucash-env guile -s "$0" "$@"
-!#
-
-(define (usage)
-  (display "Usage: gnucash-make-guids [number-to-make (default is 100)]\n")
-  (exit 1))
-
-(define args (cdr (program-arguments)))
-(define num-to-make 100)
-
-;; Too many arguments
-(if (> (length args) 1)
-    (usage))
-
-(if (= (length args) 1)
-    (let ((arg (string->number (car args))))
-      (if (not (number? arg))
-          (usage))
-      (set! arg (inexact->exact arg))
-      (if (<= arg 0)
-          (usage))
-      (set! num-to-make arg)))
-
-(use-modules (gnucash gnc-module))
-(gnc:module-system-init)
-(gnc:module-load "gnucash/engine" 0)
-
-(let loop ((remaining num-to-make))
-  (display (guid-new-return)) (newline)
-  (if (> remaining 1)
-      (loop (- remaining 1))))
-
-;; Local Variables:
-;; mode: scheme
-;; End:
diff --git a/gnucash/overrides/guile.in b/gnucash/overrides/guile.in
deleted file mode 100644
index 00ace3f..0000000
--- a/gnucash/overrides/guile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-if test "${GNC_GUILE}"x = x
-then
-  GNC_GUILE="@-GUILE-@"
-fi
-
-exec ${GNC_GUILE} "$@"
diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt
index b7dbd69..eeeb7f9 100644
--- a/libgnucash/engine/CMakeLists.txt
+++ b/libgnucash/engine/CMakeLists.txt
@@ -259,16 +259,6 @@ INSTALL(TARGETS gncmod-engine
 
 INSTALL(FILES ${engine_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
 
-SET(qof_test_HEADERS
-kvp-frame.hpp
-qofbook.h
-qofinstance.h
-qofobject.h
-qofsession.h
-)
-
-INSTALL(FILES ${qof_test_HEADERS} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/gnucash/libgnucash/engine/test)
-
 # Scheme
 
 SET (engine_SCHEME_0

commit 9b0a8723a4cda8e0a7add96017ceafaab7de86a1
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 30 13:56:47 2017 -0800

    More GNUInstallDirs path fixes.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8188e2..0dc6124 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -402,7 +402,7 @@ IF (WITH_PYTHON)
 
   # Determine where to install the python libraries.
   EXECUTE_PROCESS(
-    COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print sysconfig.get_path('platlib', vars = { 'platbase' : '${CMAKE_INSTALL_PREFIX}' }  )"
+    COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True)"
     RESULT_VARIABLE PYTHON_SYSCONFIG_RESULT
     OUTPUT_VARIABLE PYTHON_SYSCONFIG_OUTPUT
     ERROR_VARIABLE PYTHON_SYSCONFIG_ERROR
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index d79d108..211daff 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -33,6 +33,6 @@ ADD_CUSTOM_COMMAND(
 
 ADD_CUSTOM_TARGET(compiled-schemas ALL DEPENDS ${SCHEMA_BUILD_DIR}/gschemas.compiled)
 
-INSTALL(FILES ${SCHEMA_BUILD_DIR}/gschemas.compiled DESTINATION ${DATADIR}/glib-2.0/schemas)
+INSTALL(FILES ${SCHEMA_BUILD_DIR}/gschemas.compiled DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas)
 
 SET_DIST_LIST(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in)
diff --git a/data/pixmaps/CMakeLists.txt b/data/pixmaps/CMakeLists.txt
index 6ea8604..fa72a96 100644
--- a/data/pixmaps/CMakeLists.txt
+++ b/data/pixmaps/CMakeLists.txt
@@ -1,5 +1,5 @@
 
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION share/gnucash
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash
         PATTERN Makefile.* EXCLUDE
         PATTERN CMakeLists.txt EXCLUDE
         PATTERN hicolor EXCLUDE
@@ -11,7 +11,7 @@ FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}
     PATTERN hicolor EXCLUDE
 )
 INSTALL(
-    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION share/gnucash/icons
+    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/icons
     REGEX ".*/apps.*" EXCLUDE
 )
 FILE(
@@ -21,7 +21,7 @@ FILE(
 )
 
 INSTALL(
-    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION share/icons
+    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION  ${CMAKE_INSTALL_DATADIR}/icons
     REGEX ".*/actions.*" EXCLUDE
 )
 FILE(
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 5d8548e..52f933e 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -21,7 +21,7 @@ SET(doc_noinst_DATA
         Makefile.am misc-notes.txt README.build-system README.HBCI README.OFX README.translator.txt tip_of_the_day.list.in
         TRANSLATION_HOWTO)
 
-INSTALL(FILES ${doc_DATA} DESTINATION share/doc/gnucash)
+INSTALL(FILES ${doc_DATA} DESTINATION  ${CMAKE_INSTALL_DATADIR}/doc/gnucash)
 
 SET_LOCAL_DIST(doc_DIST_local ${doc_DATA} ${doc_noinst_DATA})
 SET(doc_DIST ${doc_DIST_local} ${examples_DIST} PARENT_SCOPE)
@@ -49,7 +49,7 @@ STRING(CONCAT FINAL_TOTD ${TOTD_OUTPUT})
 
 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list "${FINAL_TOTD}")
 
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION share/gnucash)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash)
 
 FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list
   DESTINATION ${DATADIR_BUILD}/gnucash)
@@ -85,4 +85,4 @@ ADD_CUSTOM_COMMAND(OUTPUT gnucash.1
   )
 ADD_CUSTOM_TARGET(gnucash-manpage DEPENDS gnucash.1)
 
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1 DESTINATION share/man/man1)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1 DESTINATION  ${CMAKE_INSTALL_MANDIR}/man1)
diff --git a/doc/examples/CMakeLists.txt b/doc/examples/CMakeLists.txt
index a73eb4f..f4c024c 100644
--- a/doc/examples/CMakeLists.txt
+++ b/doc/examples/CMakeLists.txt
@@ -21,6 +21,6 @@ SET(examples_DATA
   web.qif
 )
 
-INSTALL(FILES ${examples_DATA} DESTINATION share/doc/gnucash)
+INSTALL(FILES ${examples_DATA} DESTINATION  ${CMAKE_INSTALL_DATADIR}/doc/gnucash)
 
 SET_DIST_LIST(examples_DIST ${examples_DATA} CMakeLists.txt Makefile.am)
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index 1ba974a..49b9d40 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -235,7 +235,7 @@ IF (WIN32)
   ENDFOREACH(line)
   FILE(APPEND ${BUILD_CMD_FILE} "\nstart gnucash %*\n")
 
-  INSTALL(PROGRAMS ${CMD_FILE} DESTINATION })
+  INSTALL(PROGRAMS ${CMD_FILE} DESTINATION  ${CMAKE_INSTALL_BINDIR})
 ENDIF(WIN32)
 
 # The GResource Files are absolute paths but SET_LOCAL_DIST requires
diff --git a/gnucash/gnome-search/CMakeLists.txt b/gnucash/gnome-search/CMakeLists.txt
index f754c17..5b6c7f7 100644
--- a/gnucash/gnome-search/CMakeLists.txt
+++ b/gnucash/gnome-search/CMakeLists.txt
@@ -65,7 +65,7 @@ INSTALL(FILES ${gnome_search_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gn
 
 SET(gnome_search_GLADE dialog-search.glade)
 
-INSTALL(FILES ${gnome_search_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${gnome_search_GLADE} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 FILE(COPY .
     DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 5c939f0..11fc7ec 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -180,7 +180,7 @@ ADD_CUSTOM_COMMAND(
 
 ADD_CUSTOM_TARGET(gnucash-appdata ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml)
 
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION share/appdata)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.appdata.xml DESTINATION  ${CMAKE_INSTALL_DATADIR}/appdata)
 
 #=======
 
@@ -198,7 +198,7 @@ ADD_CUSTOM_COMMAND(
 
 ADD_CUSTOM_TARGET(gnucash-desktop ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop)
 
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION share/applications)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.desktop DESTINATION  ${CMAKE_INSTALL_DATADIR}/applications)
 
 SET_LOCAL_DIST(gnome_DIST_local
         CMakeLists.txt Makefile.am gnome.i gnucash.appdata.xml.in gnucash.desktop.in.in
diff --git a/gnucash/import-export/CMakeLists.txt b/gnucash/import-export/CMakeLists.txt
index 57808e1..d873dd2 100644
--- a/gnucash/import-export/CMakeLists.txt
+++ b/gnucash/import-export/CMakeLists.txt
@@ -78,7 +78,7 @@ INSTALL(FILES ${generic_import_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/
 
 SET(generic_import_GLADE dialog-import.glade)
 
-INSTALL(FILES ${generic_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${generic_import_GLADE} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 
 FILE(COPY ${generic_import_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
diff --git a/gnucash/import-export/aqb/CMakeLists.txt b/gnucash/import-export/aqb/CMakeLists.txt
index 06e7c26..e7173f7 100644
--- a/gnucash/import-export/aqb/CMakeLists.txt
+++ b/gnucash/import-export/aqb/CMakeLists.txt
@@ -81,9 +81,9 @@ ENDIF()
 # No headers to install
 
 
-  INSTALL(FILES ${aqbanking_GLADE} DESTINATION share/gnucash/gtkbuilder)
+  INSTALL(FILES ${aqbanking_GLADE} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
-  INSTALL(FILES ${aqbanking_UI} DESTINATION share/gnucash/ui)
+  INSTALL(FILES ${aqbanking_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
   FILE(COPY ${aqbanking_UI}
     DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/import-export/csv-exp/CMakeLists.txt b/gnucash/import-export/csv-exp/CMakeLists.txt
index dccaefa..536f366 100644
--- a/gnucash/import-export/csv-exp/CMakeLists.txt
+++ b/gnucash/import-export/csv-exp/CMakeLists.txt
@@ -37,11 +37,11 @@ INSTALL(TARGETS gncmod-csv-export
 
 SET(csv_export_GLADE assistant-csv-export.glade)
 
-INSTALL(FILES ${csv_export_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${csv_export_GLADE} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 SET(csv_export_UI gnc-plugin-csv-export-ui.xml)
 
-INSTALL(FILES ${csv_export_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${csv_export_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${csv_export_UI}
   DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/import-export/csv-imp/CMakeLists.txt b/gnucash/import-export/csv-imp/CMakeLists.txt
index 0360e5d..c2a77b8 100644
--- a/gnucash/import-export/csv-imp/CMakeLists.txt
+++ b/gnucash/import-export/csv-imp/CMakeLists.txt
@@ -86,11 +86,11 @@ INSTALL(TARGETS gncmod-csv-import
 SET(csv_import_GLADE assistant-csv-account-import.glade
       assistant-csv-trans-import.glade)
 
-INSTALL(FILES ${csv_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${csv_import_GLADE} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 SET(csv_import_UI gnc-plugin-csv-import-ui.xml)
 
-INSTALL(FILES ${csv_import_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${csv_import_UI} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${csv_import_UI}
   DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/import-export/log-replay/CMakeLists.txt b/gnucash/import-export/log-replay/CMakeLists.txt
index cea9116..0e3ba33 100644
--- a/gnucash/import-export/log-replay/CMakeLists.txt
+++ b/gnucash/import-export/log-replay/CMakeLists.txt
@@ -32,7 +32,7 @@ INSTALL(TARGETS gncmod-log-replay
 
 SET(log_replay_UI gnc-plugin-log-replay-ui.xml)
 
-INSTALL(FILES ${log_replay_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${log_replay_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${log_replay_UI}
   DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt
index 905b0fa..bf858c0 100644
--- a/gnucash/import-export/ofx/CMakeLists.txt
+++ b/gnucash/import-export/ofx/CMakeLists.txt
@@ -38,7 +38,7 @@ ENDIF()
   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
-  INSTALL(FILES ${ofx_UI} DESTINATION share/gnucash/ui)
+  INSTALL(FILES ${ofx_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
   FILE(COPY ${ofx_UI}
     DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/import-export/qif-imp/CMakeLists.txt b/gnucash/import-export/qif-imp/CMakeLists.txt
index 98cb79c..09158b1 100644
--- a/gnucash/import-export/qif-imp/CMakeLists.txt
+++ b/gnucash/import-export/qif-imp/CMakeLists.txt
@@ -72,11 +72,11 @@ GNC_ADD_SCHEME_TARGETS(scm-qif-import
 
 SET(qif_import_GLADE assistant-qif-import.glade dialog-account-picker.glade)
 
-INSTALL(FILES ${qif_import_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${qif_import_GLADE} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 SET(qif_import_UI gnc-plugin-qif-import-ui.xml)
 
-INSTALL(FILES ${qif_import_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${qif_import_UI} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${qif_import_UI}
   DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/gnucash/python/CMakeLists.txt b/gnucash/python/CMakeLists.txt
index 8028c65..1888e37 100644
--- a/gnucash/python/CMakeLists.txt
+++ b/gnucash/python/CMakeLists.txt
@@ -16,8 +16,8 @@ IF (WITH_PYTHON)
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
   )
 
-  INSTALL(DIRECTORY pycons DESTINATION share/gnucash/python)
-  INSTALL(FILES init.py DESTINATION share/gnucash/python)
+  INSTALL(DIRECTORY pycons DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/python)
+  INSTALL(FILES init.py DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/python)
 
   FILE(COPY init.py DESTINATION ${CMAKE_BINARY_DIR}/share/gnucash/python)
   FILE(COPY pycons DESTINATION ${CMAKE_BINARY_DIR}/share/gnucash/python)
diff --git a/gnucash/report/jqplot/CMakeLists.txt b/gnucash/report/jqplot/CMakeLists.txt
index 504bb3a..cd7fbf8 100644
--- a/gnucash/report/jqplot/CMakeLists.txt
+++ b/gnucash/report/jqplot/CMakeLists.txt
@@ -30,6 +30,6 @@ SET(gncjqplot_DATA
   plugins/jqplot.trendline.js
 )
 
-INSTALL(FILES ${gncjqplot_DATA} DESTINATION share/gnucash/jqplot)
+INSTALL(FILES ${gncjqplot_DATA} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/jqplot)
 
-SET_DIST_LIST(jqplot_DIST CMakeLists.txt Makefile.am jquery.js ${gncjqplot_DATA})
\ No newline at end of file
+SET_DIST_LIST(jqplot_DIST CMakeLists.txt Makefile.am jquery.js ${gncjqplot_DATA})
diff --git a/gnucash/report/report-gnome/CMakeLists.txt b/gnucash/report/report-gnome/CMakeLists.txt
index d95a57f..96845ec 100644
--- a/gnucash/report/report-gnome/CMakeLists.txt
+++ b/gnucash/report/report-gnome/CMakeLists.txt
@@ -65,11 +65,11 @@ GNC_ADD_SCHEME_TARGETS(scm-report-gnome
 
 SET(report_gnome_GLADE dialog-custom-report.glade dialog-report.glade)
 
-INSTALL(FILES ${report_gnome_GLADE} DESTINATION share/gnucash/gtkbuilder)
+INSTALL(FILES ${report_gnome_GLADE} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
 SET(report_gnome_UI gnc-plugin-page-report-ui.xml)
 
-INSTALL(FILES ${report_gnome_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${report_gnome_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${report_gnome_UI} DESTINATION ${DATADIR_BUILD}/gnucash/ui)
 FILE(COPY ${report_gnome_GLADE} DESTINATION ${DATADIR_BUILD}/gnucash/gtkbuilder)
diff --git a/gnucash/report/stylesheets/CMakeLists.txt b/gnucash/report/stylesheets/CMakeLists.txt
index 33c69af..573f1b5 100644
--- a/gnucash/report/stylesheets/CMakeLists.txt
+++ b/gnucash/report/stylesheets/CMakeLists.txt
@@ -68,7 +68,7 @@ ADD_CUSTOM_TARGET(scm-report-stylesheets ALL DEPENDS scm-report-stylesheets-1 sc
 
 SET(stylesheets_UI gnc-plugin-stylesheets-ui.xml)
 
-INSTALL(FILES ${stylesheets_UI} DESTINATION share/gnucash/ui)
+INSTALL(FILES ${stylesheets_UI} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/ui)
 
 FILE(COPY ${stylesheets_UI}
   DESTINATION ${DATADIR_BUILD}/gnucash/ui)
diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
index 6107bf0..b2c0305 100644
--- a/libgnucash/app-utils/CMakeLists.txt
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -150,8 +150,8 @@ CONFIGURE_FILE(migratable-prefs.xml.in ${MIGRATABLE_PREFS_XML})
 # This configure_file is to generate the file for autotools
 CONFIGURE_FILE(migratable-prefs.xml.in migratable-prefs.xml)
 
-INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION share/gnucash)
-INSTALL(FILES make-prefs-migration-script.xsl DESTINATION share/gnucash)
+INSTALL(FILES ${MIGRATABLE_PREFS_XML} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash)
+INSTALL(FILES make-prefs-migration-script.xsl DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash)
 
 # And now handle scheme files
 
diff --git a/libgnucash/quotes/CMakeLists.txt b/libgnucash/quotes/CMakeLists.txt
index 5ba5e9c..aa7477e 100644
--- a/libgnucash/quotes/CMakeLists.txt
+++ b/libgnucash/quotes/CMakeLists.txt
@@ -46,7 +46,7 @@ ENDFOREACH(file)
 
 ADD_CUSTOM_TARGET(quotes-man ALL DEPENDS ${_MAN_FILES})
 ADD_CUSTOM_TARGET(quotes-bin ALL DEPENDS gnc-fq-check gnc-fq-update)
-INSTALL(FILES ${_MAN_FILES} DESTINATION share/man/man1)
+INSTALL(FILES ${_MAN_FILES} DESTINATION  ${CMAKE_INSTALL_MANDIR}/man1)
 INSTALL(PROGRAMS ${_BIN_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET_DIST_LIST(quotes_DIST CMakeLists.txt gnc-fq-check.in gnc-fq-dump gnc-fq-helper.in gnc-fq-update.in
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index d9e2a1f..21139a9 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -50,7 +50,7 @@ ADD_CUSTOM_TARGET(po-gmo-build ALL DEPENDS ${BUILD_CATALOGS})
 
 
 FOREACH(lingua ${ALL_LINGUAS})
-  INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lingua}.mo RENAME gnucash.mo DESTINATION share/locale/${lingua}/LC_MESSAGES)
+  INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lingua}.mo RENAME gnucash.mo DESTINATION ${CMAKE_INSTALL_DATADIR}/locale/${lingua}/LC_MESSAGES)
 ENDFOREACH(lingua)
 
 FUNCTION(READ_FILE_REMOVING_COMMENTS OUTPUT PATH)

commit a120c48fb10d2256cac5abe7066b7a61db64ea2e
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 1 08:59:51 2017 -0800

    Fix the fixed path to compiled guile files.

diff --git a/gnucash/environment.in b/gnucash/environment.in
index 82e0209..0ef4568 100644
--- a/gnucash/environment.in
+++ b/gnucash/environment.in
@@ -64,7 +64,9 @@ GUILE_WARN_DEPRECATED=no
 # GUILE_COMPILED_LIBS=
 GUILE_LOAD_PATH={GNC_DATA}/scm;{GUILE_LIBS};{GUILE_LOAD_PATH}
 
-GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/2.0/ccache;{GNC_LIB}/scm/ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
+# On Windows {GNC_LIB} points to {GNC_HOME}/bin because that's where the DLLs
+# are. It's not where the compiled scheme files are so we use {SYS_LIB} here.
+GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/2.0/ccache;{SYS_LIB}/gnucash/scm/ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
 
 # Tell Guile where to find GnuCash specific shared libraries
 GNC_LIBRARY_PATH={SYS_LIB};{GNC_LIB}

commit 062851a8fe8c55e49008b78d17cee9d61f41daea
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 30 20:15:54 2017 -0800

    Fix path to compiled guile files in environment.in.
    
    Thanks to Rob Gowin for the catch.

diff --git a/gnucash/environment.in b/gnucash/environment.in
index f8e3a1b..82e0209 100644
--- a/gnucash/environment.in
+++ b/gnucash/environment.in
@@ -64,7 +64,7 @@ GUILE_WARN_DEPRECATED=no
 # GUILE_COMPILED_LIBS=
 GUILE_LOAD_PATH={GNC_DATA}/scm;{GUILE_LIBS};{GUILE_LOAD_PATH}
 
-GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/2.0/ccache;{GNC_LIB}ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
+GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/2.0/ccache;{GNC_LIB}/scm/ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
 
 # Tell Guile where to find GnuCash specific shared libraries
 GNC_LIBRARY_PATH={SYS_LIB};{GNC_LIB}

commit 4a84fca9b1867636e82243e937ecf205c81fdfff
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 30 13:32:57 2017 -0800

    Add GLIB_CFLAGS and srcdir to SWIG includes.

diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index 06e8e81..1a6c883 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -71,8 +71,9 @@ _gnucash_core_c_includes= \
 
 gnucash_core.c: $(SWIG_FILES) ${top_srcdir}/common/base-typemaps.i ${top_srcdir}/libgnucash/engine/engine-common.i $(_gnucash_core_c_includes)
 	$(SWIG) -python -Wall -Werror \
-	-I$(top_srcdir)/common -I$(top_srcdir)/libgnucash/engine \
-	-I$(top_srcdir)/libgnucash/app-utils -o $@ $<
+	-I$(GLIB_CFLAGS) -I$(top_srcdir)/common \
+	-I$(top_srcdir)/libgnucash/engine \
+	-I$(top_srcdir)/libgnucash/app-utils -I${srcdir} -o $@ $<
 
 gnucash_core_c.py: gnucash_core.c $(SWIG_FILES)
 endif

commit 5ca129d82d7eb8afef231fe227a7ccecadb59eb0
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 30 13:31:23 2017 -0800

    Remove unset variable SWIG_ARGS from Makefile.am

diff --git a/common/test-core/Makefile.am b/common/test-core/Makefile.am
index 0aa560b..30d5a98 100644
--- a/common/test-core/Makefile.am
+++ b/common/test-core/Makefile.am
@@ -25,7 +25,7 @@ libtest_core_la_LDFLAGS = \
 
 if BUILDING_FROM_VCS
 swig-unittest-support-guile.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common \
 	${AM_CPPFLAGS} -o $@ $<
 if ! OS_WIN32
@@ -37,7 +37,7 @@ endif
 endif
 
 swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
-	$(SWIG) -python  -Wall -Werror $(SWIG_ARGS) \
+	$(SWIG) -python  -Wall -Werror \
 	-I${GLIB_CFLAGS} -I${top_srcdir}/common \
 	${AM_CPPFLAGS} -o $@ $<
 
diff --git a/gnucash/gnome-utils/Makefile.am b/gnucash/gnome-utils/Makefile.am
index 4cfba43..0692968 100644
--- a/gnucash/gnome-utils/Makefile.am
+++ b/gnucash/gnome-utils/Makefile.am
@@ -220,7 +220,7 @@ gnc-warnings.h: gschemas/org.gnucash.warnings.gschema.xml.in make-gnc-warnings-h
 if BUILDING_FROM_VCS
 swig-gnome-utils.c: gnome-utils.i \
                     ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/gnucash/gnome/Makefile.am b/gnucash/gnome/Makefile.am
index e47054e..8fe2b65 100644
--- a/gnucash/gnome/Makefile.am
+++ b/gnucash/gnome/Makefile.am
@@ -150,7 +150,7 @@ noinst_HEADERS = \
 
 if BUILDING_FROM_VCS
 swig-gnome.c: gnome.i dialog-progress.h ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/gnucash/html/Makefile.am b/gnucash/html/Makefile.am
index 9f78dae..db57fd7 100644
--- a/gnucash/html/Makefile.am
+++ b/gnucash/html/Makefile.am
@@ -55,7 +55,7 @@ libgncmod_html_la_LIBADD = \
 if BUILDING_FROM_VCS
 swig-gnc-html.c: gnc-html.i gnc-html.h \
                     ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/gnucash/report/report-gnome/Makefile.am b/gnucash/report/report-gnome/Makefile.am
index c52927d..38c11d7 100644
--- a/gnucash/report/report-gnome/Makefile.am
+++ b/gnucash/report/report-gnome/Makefile.am
@@ -49,7 +49,7 @@ libgncmod_report_gnome_la_LIBADD = \
 
 if BUILDING_FROM_VCS
 swig-report-gnome.c: report-gnome.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/gnucash/report/report-system/Makefile.am b/gnucash/report/report-system/Makefile.am
index 6673447..0cdeeef 100644
--- a/gnucash/report/report-system/Makefile.am
+++ b/gnucash/report/report-system/Makefile.am
@@ -25,7 +25,7 @@ libgncmod_report_system_la_LIBADD = \
 
 if BUILDING_FROM_VCS
 swig-report-system.c: report-system.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/libgnucash/app-utils/Makefile.am b/libgnucash/app-utils/Makefile.am
index 4200b56..84e7f8b 100644
--- a/libgnucash/app-utils/Makefile.am
+++ b/libgnucash/app-utils/Makefile.am
@@ -103,7 +103,7 @@ libgncmod_app_utils_la_LIBADD = \
 
 if BUILDING_FROM_VCS
 swig-app-utils-guile.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
@@ -113,7 +113,7 @@ if ! SWIG_DIST_FAIL
 endif
 endif
 swig-app-utils-python.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
+	$(SWIG) -python -Wall -Werror \
 	-I${GLIB_CFLAGS} -I${top_srcdir}/common -o $@ $<
 endif
 
diff --git a/libgnucash/core-utils/Makefile.am b/libgnucash/core-utils/Makefile.am
index c71072c..da63a34 100644
--- a/libgnucash/core-utils/Makefile.am
+++ b/libgnucash/core-utils/Makefile.am
@@ -40,7 +40,7 @@ noinst_HEADERS = \
 
 if BUILDING_FROM_VCS
 swig-core-utils-guile.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
@@ -50,8 +50,8 @@ if ! SWIG_DIST_FAIL
 endif
 endif
 swig-core-utils-python.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
-	-I${GLIB_CFLAGS} -I${top_srcdir}/common -o $@ $<
+	$(SWIG) -python -Wall -Werror \
+	-I${GLIB_CFLAGS} -I${top_srcdir}/common -I${srcdir} -o $@ $<
 endif
 
 AM_CPPFLAGS = \
diff --git a/libgnucash/engine/Makefile.am b/libgnucash/engine/Makefile.am
index 4943aef..9e4e868 100644
--- a/libgnucash/engine/Makefile.am
+++ b/libgnucash/engine/Makefile.am
@@ -300,7 +300,7 @@ if BUILDING_FROM_VCS
 
 swig-engine.c: engine.i $(top_srcdir)/common/base-typemaps.i \
                $(gncinclude_HEADERS) $(noinst_HEADERS)
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/libgnucash/gnc-module/Makefile.am b/libgnucash/gnc-module/Makefile.am
index 5701472..9246715 100644
--- a/libgnucash/gnc-module/Makefile.am
+++ b/libgnucash/gnc-module/Makefile.am
@@ -31,7 +31,7 @@ noinst_DATA = .scm-links
 
 if BUILDING_FROM_VCS
 swig-gnc-module.c: gnc-module.i ${top_srcdir}/common/base-typemaps.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
+	$(SWIG) -guile -Linkage module \
 	-I${top_srcdir}/common -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
diff --git a/libgnucash/gnc-module/test/mod-bar/Makefile.am b/libgnucash/gnc-module/test/mod-bar/Makefile.am
index 9261530..76b158c 100644
--- a/libgnucash/gnc-module/test/mod-bar/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-bar/Makefile.am
@@ -24,7 +24,7 @@ libgncmodbar_la_LIBADD=libbar.la \
 
 if BUILDING_FROM_VCS
 swig-bar.c: bar.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+	$(SWIG) -guile -Linkage module -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
 	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
diff --git a/libgnucash/gnc-module/test/mod-baz/Makefile.am b/libgnucash/gnc-module/test/mod-baz/Makefile.am
index 6914f93..b5d1064 100644
--- a/libgnucash/gnc-module/test/mod-baz/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-baz/Makefile.am
@@ -28,7 +28,7 @@ libgncmodbaz_la_LIBADD = \
 
 if BUILDING_FROM_VCS
 swig-baz.c: baz.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+	$(SWIG) -guile -Linkage module -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
 	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
diff --git a/libgnucash/gnc-module/test/mod-foo/Makefile.am b/libgnucash/gnc-module/test/mod-foo/Makefile.am
index bc92a3e..a1536f4 100644
--- a/libgnucash/gnc-module/test/mod-foo/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-foo/Makefile.am
@@ -30,7 +30,7 @@ EXTRA_DIST = \
 
 if BUILDING_FROM_VCS
 swig-foo.c: foo.i
-	$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+	$(SWIG) -guile -Linkage module -o $@ $<
 if ! OS_WIN32
 if ! SWIG_DIST_FAIL
 	if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \

commit 649a6a263e939bf6a7c91d44558d442b943ba89d
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 30 17:37:32 2017 +0100

    Fix installation destinations for overrides and quotes scripts
    
    Mentioned by Robert Gowin and Christopher Lam

diff --git a/gnucash/overrides/CMakeLists.txt b/gnucash/overrides/CMakeLists.txt
index 620f6ea..1ca1c47 100644
--- a/gnucash/overrides/CMakeLists.txt
+++ b/gnucash/overrides/CMakeLists.txt
@@ -28,5 +28,5 @@ INSTALL(
     PROGRAMS
       ${SCRIPT_OUTPUT_DIR}/gnucash-env
       ${SCRIPT_OUTPUT_DIR}/gnucash-make-guids
-    DESTINATION }exec/gnucash/overrides
+    DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/gnucash/overrides
 )
diff --git a/libgnucash/quotes/CMakeLists.txt b/libgnucash/quotes/CMakeLists.txt
index 21118ed..5ba5e9c 100644
--- a/libgnucash/quotes/CMakeLists.txt
+++ b/libgnucash/quotes/CMakeLists.txt
@@ -47,7 +47,7 @@ ENDFOREACH(file)
 ADD_CUSTOM_TARGET(quotes-man ALL DEPENDS ${_MAN_FILES})
 ADD_CUSTOM_TARGET(quotes-bin ALL DEPENDS gnc-fq-check gnc-fq-update)
 INSTALL(FILES ${_MAN_FILES} DESTINATION share/man/man1)
-INSTALL(PROGRAMS ${_BIN_FILES} DESTINATION })
+INSTALL(PROGRAMS ${_BIN_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET_DIST_LIST(quotes_DIST CMakeLists.txt gnc-fq-check.in gnc-fq-dump gnc-fq-helper.in gnc-fq-update.in
         gnc-value-portfolio Makefile.am Quote_example.pl README)

commit 41656c920e54f9e4f7693086a410372257229b00
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 28 17:57:00 2017 -0800

    Fix python test failure on Travis.
    
    It seems that there are two possible exceptions depending on OS.

diff --git a/bindings/python/tests/test_numeric.py b/bindings/python/tests/test_numeric.py
index 2c367eb..86217c6 100644
--- a/bindings/python/tests/test_numeric.py
+++ b/bindings/python/tests/test_numeric.py
@@ -28,11 +28,13 @@ class TestGncNumeric( TestCase ):
         self.assertEqual(num.num(), 3)
         self.assertEqual(num.denom(), 1)
 
-        #One might think this would be an overflow error, but SWIG type-checks
-        #it first and discovers that it's too big to be an int64_t.
-        with self.assertRaises(TypeError):
+        with self.assertRaises(Exception) as context:
             GncNumeric((2**64)+1)
 
+        #On Linux it raises an OverflowError while on MacOS it's a TypeError.
+        self.assertTrue(isinstance(context.exception, TypeError) or
+                        isinstance(context.exception, OverflowError))
+
     def test_from_float(self):
         num = GncNumeric(3.1, 20, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
         self.assertEqual(str(num), "62/20")

commit c6ae007bda0e3a4b3eaeb3e55193b150f6472461
Merge: 5aa048e 744cdac
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 28 17:09:38 2017 -0800

    Merge branch 'PyGncNumeric' into unstable


commit 744cdac5a4dfb3e62f5d447d4f71be872f182c88
Author: Guy Taylor <thebigguy.co.uk at gmail.com>
Date:   Sat Jun 3 17:51:54 2017 +0100

    Use builtin SWIG conversions for glib types
    
    Where possible in the Python SWIG code use the builtin SWIG conversion
    code over custom code. This ensures appropriate overflow/type checking.
    With this I have enabled GncNumeric from longs and tested for correct
    overflow handling.
    
    Note: This could be extended to GUILE but I am not familiar enought to
    safely enable this.

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index 6fc9a62..e3c1dd7 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -294,7 +294,7 @@ class GncNumeric(GnuCashCoreClass):
             return gnc_numeric_zero()
         elif len(args) == 1:
             arg = args[0]
-            if type(arg) == int:
+            if type(arg) in (int, long):
                 return gnc_numeric_create(arg ,1)
             elif type(arg) == float:
                 return double_to_gnc_numeric(arg, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt
index ef38aa1..201bde7 100644
--- a/bindings/python/tests/CMakeLists.txt
+++ b/bindings/python/tests/CMakeLists.txt
@@ -13,6 +13,7 @@ SET(test_python_bindings_DATA
         test_book.py
         test_business.py
         test_commodity.py
+        test_numeric.py
         test_split.py
         test_transaction.py)
 
diff --git a/bindings/python/tests/Makefile.am b/bindings/python/tests/Makefile.am
index d8ac3eb..62c50cb 100644
--- a/bindings/python/tests/Makefile.am
+++ b/bindings/python/tests/Makefile.am
@@ -48,6 +48,8 @@ EXTRA_DIST = \
   test_account.py \
   test_book.py \
   test_split.py \
+  test_commodity.py \
+  test_numeric.py \
   test_transaction.py \
   test_business.py \
   CMakeLists.txt
diff --git a/bindings/python/tests/test_numeric.py b/bindings/python/tests/test_numeric.py
new file mode 100644
index 0000000..2c367eb
--- /dev/null
+++ b/bindings/python/tests/test_numeric.py
@@ -0,0 +1,106 @@
+from unittest import TestCase, main
+
+from gnucash import GncNumeric, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED, \
+    GNC_HOW_RND_NEVER, GNC_HOW_RND_FLOOR, GNC_HOW_RND_CEIL
+
+class TestGncNumeric( TestCase ):
+    def test_defaut(self):
+        num = GncNumeric()
+        self.assertEqual(str(num), "0/1")
+        self.assertEqual(num.num(), 0)
+        self.assertEqual(num.denom(), 1)
+
+    def test_from_num_denom(self):
+        num = GncNumeric(1, 2)
+        self.assertEqual(str(num), "1/2")
+        self.assertEqual(num.num(), 1)
+        self.assertEqual(num.denom(), 2)
+
+    def test_from_int(self):
+        num = GncNumeric(3)
+        self.assertEqual(str(num), "3/1")
+        self.assertEqual(num.num(), 3)
+        self.assertEqual(num.denom(), 1)
+
+    def test_from_long(self):
+        num = GncNumeric(3L)
+        self.assertEqual(str(num), "3/1")
+        self.assertEqual(num.num(), 3)
+        self.assertEqual(num.denom(), 1)
+
+        #One might think this would be an overflow error, but SWIG type-checks
+        #it first and discovers that it's too big to be an int64_t.
+        with self.assertRaises(TypeError):
+            GncNumeric((2**64)+1)
+
+    def test_from_float(self):
+        num = GncNumeric(3.1, 20, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
+        self.assertEqual(str(num), "62/20")
+        self.assertEqual(num.num(), 62)
+        self.assertEqual(num.denom(), 20)
+
+        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_FLOOR)
+        self.assertEqual(str(num), "3333333333/10000000000")
+        self.assertEqual(num.num(), 3333333333)
+        self.assertEqual(num.denom(), 10000000000)
+
+        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_CEIL)
+        self.assertEqual(str(num), "3333333334/10000000000")
+        self.assertEqual(num.num(), 3333333334)
+        self.assertEqual(num.denom(), 10000000000)
+
+    def test_from_float_auto(self):
+        num = GncNumeric(3.1)
+        self.assertEqual(str(num), "31/10")
+        self.assertEqual(num.num(), 31)
+        self.assertEqual(num.denom(), 10)
+
+    def test_from_instance(self):
+        orig = GncNumeric(3)
+        num = GncNumeric(instance=orig.instance)
+        self.assertEqual(str(num), "3/1")
+        self.assertEqual(num.num(), 3)
+        self.assertEqual(num.denom(), 1)
+
+    def test_from_str(self):
+        num = GncNumeric("3.1")
+        self.assertEqual(str(num), "31/10")
+        self.assertEqual(num.num(), 31)
+        self.assertEqual(num.denom(), 10)
+
+        num = GncNumeric("1/3")
+        self.assertEqual(str(num), "1/3")
+        self.assertEqual(num.num(), 1)
+        self.assertEqual(num.denom(), 3)
+
+    def test_to_str(self):
+        num = GncNumeric("1000/3")
+        self.assertEqual(str(num), "1000/3")
+
+        num = GncNumeric(1, 0)
+        self.assertEqual(str(num), "1/0")
+
+    def test_to_double(self):
+        for test_num in [0.0, 1.1, -1.1, 1/3.0]:
+            self.assertEqual(GncNumeric(test_num).to_double(), test_num)
+
+    def test_to_fraction(self):
+        fraction = GncNumeric("1000/3").to_fraction()
+        self.assertEqual(fraction.numerator, 1000)
+        self.assertEqual(fraction.denominator, 3)
+
+    def test_incorect_args(self):
+        with self.assertRaises(TypeError):
+            GncNumeric(1, 2, 3)
+
+        with self.assertRaises(TypeError):
+            GncNumeric("1", 2)
+
+        with self.assertRaises(TypeError):
+            GncNumeric(1.1, "round")
+
+        with self.assertRaises(TypeError):
+            GncNumeric(complex(1, 1))
+
+if __name__ == '__main__':
+    main()
diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index 728186f..62c8f96 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -169,38 +169,16 @@ typedef char gchar;
 #elif defined(SWIGPYTHON) /* Typemaps for Python */
 
 %import "glib.h"
-
-%typemap(in) gint8, gint16, gint32, gint64, gshort, glong {
-    $1 = ($1_type)PyInt_AsLong($input);
-}
-
-%typemap(out) gint8, gint16, gint32, gint64, gshort, glong {
-    $result = PyInt_FromLong($1);
-}
-
-%typemap(in) guint8, guint16, guint32, guint64, gushort, gulong {
-    $1 = ($1_type)PyLong_AsUnsignedLong($input);
-}
-
-%typemap(out) guint8, guint16, guint32, guint64, gushort, gulong {
-    $result = PyLong_FromUnsignedLong($1);
-}
-
-%typemap(in) gdouble {
-    $1 = ($1_type)PyFloat_AsDouble($input);
-}
-
-%typemap(out) gdouble {
-    $result = PyFloat_FromDouble($1);
-}
-
-%typemap(in) gchar * {
-    $1 = ($1_ltype)PyString_AsString($input);
-}
-
-%typemap(out) gchar * {
-    $result = PyString_FromString($1);
-}
+%include <stdint.i>
+
+%apply int { gint };
+%apply unsigned int { guint };
+%apply long { glong };
+%apply int64_t { gint64 };
+%apply unsigned long { gulong };
+%apply uint64_t { guint64 };
+%apply double { gdouble };
+%apply char* { gchar* };
 
 %typemap(in) gboolean {
     if ($input == Py_True)
diff --git a/common/cmake_modules/GncAddSwigCommand.cmake b/common/cmake_modules/GncAddSwigCommand.cmake
index 7671aa9..1fdcaa5 100644
--- a/common/cmake_modules/GncAddSwigCommand.cmake
+++ b/common/cmake_modules/GncAddSwigCommand.cmake
@@ -26,10 +26,9 @@ MACRO (GNC_ADD_SWIG_PYTHON_COMMAND _target _output _input)
   )
   set (DEFAULT_SWIG_PYTHON_C_INCLUDES
     ${GLIB2_INCLUDE_DIRS}
-    ${CMAKE_SOURCE_DIR}/src/libqof/qof
-    ${CMAKE_SOURCE_DIR}/src
-    ${CMAKE_SOURCE_DIR}/src/engine
-    ${CMAKE_SOURCE_DIR}/src/app-utils
+    ${CMAKE_SOURCE_DIR}/common
+    ${CMAKE_SOURCE_DIR}/libgnucash/engine
+    ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
   )
 
 

commit c9c58764318ab7e82ac21958326a64a27f6d409a
Author: Guy Taylor <thebigguy.co.uk at gmail.com>
Date:   Sat Jun 3 16:06:09 2017 +0100

    Use glib.h over custom typedefs in Python SWIG
    
    Use the native glib.h (mainly gint, gfloat ...) over custom typedefs in
    SWIG type files. This is for Python only.

diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index 187b64e..728186f 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -22,18 +22,16 @@
  *                                                                  *
 \********************************************************************/
 
+typedef void * gpointer; // Not sure why SWIG doesn't figure this out.
+%typemap(newfree) gchar * "g_free($1);"
+
+#if defined(SWIGGUILE)
 
-/* Not sure why SWIG doesn't figure this out. */
 typedef int gint;
 typedef gint64 time64;
 typedef unsigned int guint;
 typedef double gdouble;
 typedef float gfloat;
-typedef void * gpointer;
-
-%typemap(newfree) gchar * "g_free($1);"
-
-#if defined(SWIGGUILE)
 typedef char gchar;
 
 %typemap (out) char * {
@@ -169,6 +167,9 @@ typedef char gchar;
 }
 %enddef
 #elif defined(SWIGPYTHON) /* Typemaps for Python */
+
+%import "glib.h"
+
 %typemap(in) gint8, gint16, gint32, gint64, gshort, glong {
     $1 = ($1_type)PyInt_AsLong($input);
 }
@@ -185,6 +186,14 @@ typedef char gchar;
     $result = PyLong_FromUnsignedLong($1);
 }
 
+%typemap(in) gdouble {
+    $1 = ($1_type)PyFloat_AsDouble($input);
+}
+
+%typemap(out) gdouble {
+    $result = PyFloat_FromDouble($1);
+}
+
 %typemap(in) gchar * {
     $1 = ($1_ltype)PyString_AsString($input);
 }
diff --git a/common/cmake_modules/GncAddSwigCommand.cmake b/common/cmake_modules/GncAddSwigCommand.cmake
index 440b6b9..7671aa9 100644
--- a/common/cmake_modules/GncAddSwigCommand.cmake
+++ b/common/cmake_modules/GncAddSwigCommand.cmake
@@ -19,12 +19,26 @@ ENDMACRO (GNC_ADD_SWIG_COMMAND)
 
 MACRO (GNC_ADD_SWIG_PYTHON_COMMAND _target _output _input)
 
-  ADD_CUSTOM_COMMAND(OUTPUT ${_output}
+  set (DEFAULT_SWIG_PYTHON_FLAGS
+    -python
+    -Wall -Werror
+    ${SWIG_ARGS}
+  )
+  set (DEFAULT_SWIG_PYTHON_C_INCLUDES
+    ${GLIB2_INCLUDE_DIRS}
+    ${CMAKE_SOURCE_DIR}/src/libqof/qof
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/engine
+    ${CMAKE_SOURCE_DIR}/src/app-utils
+  )
 
-    COMMAND ${SWIG_EXECUTABLE} -python -Wall -Werror ${SWIG_ARGS}
-       -I${CMAKE_SOURCE_DIR}/common
-       -I${CMAKE_SOURCE_DIR}/libgnucash/engine -I${CMAKE_SOURCE_DIR}/libgnucash/app-utils
-       -o ${_output} ${_input}
+
+  set (PYTHON_SWIG_FLAGS ${DEFAULT_SWIG_PYTHON_FLAGS})
+  foreach (dir ${DEFAULT_SWIG_PYTHON_C_INCLUDES})
+    list (APPEND PYTHON_SWIG_FLAGS "-I${dir}")
+  endforeach (dir)
+  ADD_CUSTOM_COMMAND(OUTPUT ${_output}
+    COMMAND ${SWIG_EXECUTABLE} ${PYTHON_SWIG_FLAGS} -o ${_output} ${_input}
     DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${ARGN}
   )
   ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${_output} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${_input} ${ARGN})
diff --git a/common/test-core/Makefile.am b/common/test-core/Makefile.am
index 2d20337..0aa560b 100644
--- a/common/test-core/Makefile.am
+++ b/common/test-core/Makefile.am
@@ -38,7 +38,7 @@ endif
 
 swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
 	$(SWIG) -python  -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/common \
+	-I${GLIB_CFLAGS} -I${top_srcdir}/common \
 	${AM_CPPFLAGS} -o $@ $<
 
 unittest-support.py: swig-unittest-support-python.c ${SWIG_FILES}
diff --git a/libgnucash/app-utils/Makefile.am b/libgnucash/app-utils/Makefile.am
index 6296bb2..4200b56 100644
--- a/libgnucash/app-utils/Makefile.am
+++ b/libgnucash/app-utils/Makefile.am
@@ -114,7 +114,7 @@ endif
 endif
 swig-app-utils-python.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
 	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/common -o $@ $<
+	-I${GLIB_CFLAGS} -I${top_srcdir}/common -o $@ $<
 endif
 
 if WITH_PYTHON
diff --git a/libgnucash/core-utils/Makefile.am b/libgnucash/core-utils/Makefile.am
index fdd2ebe..c71072c 100644
--- a/libgnucash/core-utils/Makefile.am
+++ b/libgnucash/core-utils/Makefile.am
@@ -51,7 +51,7 @@ endif
 endif
 swig-core-utils-python.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
 	$(SWIG) -python -Wall -Werror $(SWIG_ARGS) \
-	-I${top_srcdir}/common -o $@ $<
+	-I${GLIB_CFLAGS} -I${top_srcdir}/common -o $@ $<
 endif
 
 AM_CPPFLAGS = \
diff --git a/src/optional/python-bindings/tests/test_numeric.py b/src/optional/python-bindings/tests/test_numeric.py
deleted file mode 100644
index abb0278..0000000
--- a/src/optional/python-bindings/tests/test_numeric.py
+++ /dev/null
@@ -1,101 +0,0 @@
-from unittest import TestCase, main
-
-from gnucash import GncNumeric, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED, \
-    GNC_HOW_RND_NEVER, GNC_HOW_RND_FLOOR, GNC_HOW_RND_CEIL
-
-class TestGncNumeric( TestCase ):
-    def test_defaut(self):
-        num = GncNumeric()
-        self.assertEqual(str(num), "0/1")
-        self.assertEqual(num.num(), 0)
-        self.assertEqual(num.denom(), 1)
-
-    def test_from_num_denom(self):
-        num = GncNumeric(1, 2)
-        self.assertEqual(str(num), "1/2")
-        self.assertEqual(num.num(), 1)
-        self.assertEqual(num.denom(), 2)
-
-    def test_from_int(self):
-        num = GncNumeric(3)
-        self.assertEqual(str(num), "3/1")
-        self.assertEqual(num.num(), 3)
-        self.assertEqual(num.denom(), 1)
-
-    # Safest outcome at current. This can be fixed but correct bounds checks
-    # are required to ensure gint64 is not overflowed.
-    def test_from_long(self):
-        with self.assertRaises(TypeError):
-            GncNumeric(3L)
-
-    def test_from_float(self):
-        num = GncNumeric(3.1, 20, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
-        self.assertEqual(str(num), "62/20")
-        self.assertEqual(num.num(), 62)
-        self.assertEqual(num.denom(), 20)
-
-        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_FLOOR)
-        self.assertEqual(str(num), "3333333333/10000000000")
-        self.assertEqual(num.num(), 3333333333)
-        self.assertEqual(num.denom(), 10000000000)
-
-        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_CEIL)
-        self.assertEqual(str(num), "3333333334/10000000000")
-        self.assertEqual(num.num(), 3333333334)
-        self.assertEqual(num.denom(), 10000000000)
-
-    def test_from_float_auto(self):
-        num = GncNumeric(3.1)
-        self.assertEqual(str(num), "31/10")
-        self.assertEqual(num.num(), 31)
-        self.assertEqual(num.denom(), 10)
-
-    def test_from_instance(self):
-        orig = GncNumeric(3)
-        num = GncNumeric(instance=orig.instance)
-        self.assertEqual(str(num), "3/1")
-        self.assertEqual(num.num(), 3)
-        self.assertEqual(num.denom(), 1)
-
-    def test_from_str(self):
-        num = GncNumeric("3.1")
-        self.assertEqual(str(num), "31/10")
-        self.assertEqual(num.num(), 31)
-        self.assertEqual(num.denom(), 10)
-
-        num = GncNumeric("1/3")
-        self.assertEqual(str(num), "1/3")
-        self.assertEqual(num.num(), 1)
-        self.assertEqual(num.denom(), 3)
-
-    def test_to_str(self):
-        num = GncNumeric("1000/3")
-        self.assertEqual(str(num), "1000/3")
-
-        num = GncNumeric(1, 0)
-        self.assertEqual(str(num), "1/0")
-
-    def test_to_double(self):
-        for test_num in [0.0, 1.1, -1.1, 1/3.0]:
-            self.assertEqual(GncNumeric(test_num).to_double(), test_num)
-
-    def test_to_fraction(self):
-        fraction = GncNumeric("1000/3").to_fraction()
-        self.assertEqual(fraction.numerator, 1000)
-        self.assertEqual(fraction.denominator, 3)
-
-    def test_incorect_args(self):
-        with self.assertRaises(TypeError):
-            GncNumeric(1, 2, 3)
-
-        with self.assertRaises(TypeError):
-            GncNumeric("1", 2)
-
-        with self.assertRaises(TypeError):
-            GncNumeric(1.1, "round")
-
-        with self.assertRaises(TypeError):
-            GncNumeric(complex(1, 1))
-
-if __name__ == '__main__':
-    main()

commit e011576e37e25c2876c6ed8578a8ccc2573573f1
Author: Guy Taylor <thebigguy.co.uk at gmail.com>
Date:   Sun May 28 22:13:39 2017 +0100

    Add GncNumeric to native Python Fraction
    
    Add helper method to return the native Python fraction type from GncNumeric.

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index 76d838e..6fc9a62 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -320,6 +320,10 @@ class GncNumeric(GnuCashCoreClass):
         else:
             raise TypeError('Required single int/float/str or two ints: ' + str(args))
 
+    def to_fraction(self):
+        from fractions import Fraction
+        return Fraction(self.num(), self.denom())
+
     def __unicode__(self):
         """Returns a human readable numeric value string as UTF8."""
         return gnc_numeric_to_string(self.instance)
diff --git a/src/optional/python-bindings/tests/test_numeric.py b/src/optional/python-bindings/tests/test_numeric.py
index 3d8f9da..abb0278 100644
--- a/src/optional/python-bindings/tests/test_numeric.py
+++ b/src/optional/python-bindings/tests/test_numeric.py
@@ -79,6 +79,11 @@ class TestGncNumeric( TestCase ):
         for test_num in [0.0, 1.1, -1.1, 1/3.0]:
             self.assertEqual(GncNumeric(test_num).to_double(), test_num)
 
+    def test_to_fraction(self):
+        fraction = GncNumeric("1000/3").to_fraction()
+        self.assertEqual(fraction.numerator, 1000)
+        self.assertEqual(fraction.denominator, 3)
+
     def test_incorect_args(self):
         with self.assertRaises(TypeError):
             GncNumeric(1, 2, 3)

commit 1ef379a704e070a174eebb894487a230008d9977
Author: Guy Taylor <thebigguy.co.uk at gmail.com>
Date:   Wed May 17 11:37:20 2017 +0100

    Fix Python GncNumeric for non (int, int) pairs
    
    At current the Python GncNumeric has issues with type conversion eg.
     * GncNumeric(1.3) = 1.00
     * GncNumeric("1.3") is OK but any future methods error
    
    This behaviour was relied on for the Account tests to pass as it used
    GncNumeric(0.5) == GncNumeric(1.0) but this is not what many users would
    expect.
    
    This fix alows GncNumeric to be constructed from a (int, int)
    numerator/denominator pair or int/float/str where double_to_gnc_numeric
    and string_to_gnc_numeric from C is used.

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index b72ecb1..76d838e 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -42,7 +42,9 @@ from gnucash_core_c import gncInvoiceLookup, gncInvoiceGetInvoiceFromTxn, \
     gncTaxTableLookup, gncTaxTableLookupByName, gnc_search_invoice_on_id, \
     gnc_search_customer_on_id, gnc_search_bill_on_id , \
     gnc_search_vendor_on_id, gncInvoiceNextID, gncCustomerNextID, \
-    gncVendorNextID, gncTaxTableGetTables
+    gncVendorNextID, gncTaxTableGetTables, gnc_numeric_zero, \
+    gnc_numeric_create, double_to_gnc_numeric, string_to_gnc_numeric, \
+    gnc_numeric_to_string
 
 class GnuCashCoreClass(ClassFromFunctions):
     _module = gnucash_core_c
@@ -271,26 +273,56 @@ class GncNumeric(GnuCashCoreClass):
     Look at gnc-numeric.h to see how to use these
     """
 
-    def __init__(self, num=0, denom=1, **kargs):
-        """Constructor that allows you to set the numerator and denominator or
-        leave them blank with a default value of 0 (not a good idea since there
-        is currently no way to alter the value after instantiation)
+    def __init__(self, *args, **kargs):
+        """Constructor that supports the following formats:
+        * No arguments defaulting to zero: eg. GncNumeric() == 0/1
+        * A integer: e.g. GncNumeric(1) == 1/1
+        * Numerator and denominator intager pair: eg. GncNumeric(1, 2) == 1/2
+        * A floating point number: e.g. GncNumeric(0.5) == 1/2
+        * A floating point number with defined conversion: e.g.
+          GncNumeric(0.5, GNC_DENOM_AUTO,
+                    GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER) == 1/2
+        * A string: e.g. GncNumeric("1/2") == 1/2
         """
-        GnuCashCoreClass.__init__(self, num, denom, **kargs)
-        #if INSTANCE_ARG in kargs:
-        #    GnuCashCoreClass.__init__(**kargs)
-        #else:
-        #    self.set_denom(denom) # currently undefined
-        #    self.set_num(num)     # currently undefined
+        if 'instance' not in kargs:
+            kargs['instance'] = GncNumeric.__args_to_instance(args)
+        GnuCashCoreClass.__init__(self, [], **kargs)
+
+    @staticmethod
+    def __args_to_instance(args):
+        if len(args) == 0:
+            return gnc_numeric_zero()
+        elif len(args) == 1:
+            arg = args[0]
+            if type(arg) == int:
+                return gnc_numeric_create(arg ,1)
+            elif type(arg) == float:
+                return double_to_gnc_numeric(arg, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
+            elif type(arg) == str:
+                instance = gnc_numeric_zero()
+                if not string_to_gnc_numeric(arg, instance):
+                    raise TypeError('Failed to convert to GncNumeric: ' + str(args))
+                return instance
+            else:
+                raise TypeError('Only single int/float/str allowed: ' + str(args))
+        elif len(args) == 2:
+            if type(args[0]) == int and type(args[1]) == int:
+                return gnc_numeric_create(*args)
+            else:
+                raise TypeError('Only two ints allowed: ' + str(args))
+        elif len(args) == 3:
+            if type(args[0]) == float \
+                and type(args[1]) == type(GNC_DENOM_AUTO) \
+                and type(args[2]) == type(GNC_HOW_DENOM_FIXED):
+                return double_to_gnc_numeric(*args)
+            else:
+                raise TypeError('Only (float, GNC_HOW_RND_*, GNC_HOW_RND_*, GNC_HOW_RND_*) allowed: ' + str(args))
+        else:
+            raise TypeError('Required single int/float/str or two ints: ' + str(args))
 
     def __unicode__(self):
         """Returns a human readable numeric value string as UTF8."""
-        if self.denom() == 0:
-            return "Division by zero"
-        else:
-            value_float = self.to_double() 
-            value_str   = u"{0:.{1}f}".format(value_float,2) ## The second argument is the precision. It would be nice to be able to make it configurable.
-            return value_str
+        return gnc_numeric_to_string(self.instance)
 
     def __str__(self):
         """returns a human readable numeric value string as bytes."""
diff --git a/bindings/python/tests/runTests.py.in b/bindings/python/tests/runTests.py.in
index 0a1d269..60d040f 100755
--- a/bindings/python/tests/runTests.py.in
+++ b/bindings/python/tests/runTests.py.in
@@ -13,9 +13,10 @@ from test_split import TestSplit
 from test_transaction import TestTransaction
 from test_business import TestBusiness
 from test_commodity import TestCommodity, TestCommodityNamespace
+from test_numeric import TestGncNumeric
 
 def test_main():
-    test_support.run_unittest(TestBook, TestAccount, TestSplit, TestTransaction, TestBusiness, TestCommodity, TestCommodityNamespace)
+    test_support.run_unittest(TestBook, TestAccount, TestSplit, TestTransaction, TestBusiness, TestCommodity, TestCommodityNamespace, TestGncNumeric)
 
 if __name__ == '__main__':
     test_main()
diff --git a/bindings/python/tests/test_account.py b/bindings/python/tests/test_account.py
index b05f171..5ba972e 100644
--- a/bindings/python/tests/test_account.py
+++ b/bindings/python/tests/test_account.py
@@ -40,7 +40,7 @@ class TestAccount( AccountSession ):
         s1a = Split(self.book)
         s1a.SetParent(tx)
         s1a.SetAccount(self.account)
-        s1a.SetAmount(GncNumeric(1.0))
+        s1a.SetAmount(GncNumeric(1.3))
         s1a.SetValue(GncNumeric(100.0))
 
         s1b = Split(self.book)
@@ -52,7 +52,7 @@ class TestAccount( AccountSession ):
         s2a = Split(self.book)
         s2a.SetParent(tx)
         s2a.SetAccount(self.account)
-        s2a.SetAmount(GncNumeric(-0.5))
+        s2a.SetAmount(GncNumeric(-1.3))
         s2a.SetValue(GncNumeric(-100.0))
 
         s2b = Split(self.book)
diff --git a/src/optional/python-bindings/tests/test_numeric.py b/src/optional/python-bindings/tests/test_numeric.py
new file mode 100644
index 0000000..3d8f9da
--- /dev/null
+++ b/src/optional/python-bindings/tests/test_numeric.py
@@ -0,0 +1,96 @@
+from unittest import TestCase, main
+
+from gnucash import GncNumeric, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED, \
+    GNC_HOW_RND_NEVER, GNC_HOW_RND_FLOOR, GNC_HOW_RND_CEIL
+
+class TestGncNumeric( TestCase ):
+    def test_defaut(self):
+        num = GncNumeric()
+        self.assertEqual(str(num), "0/1")
+        self.assertEqual(num.num(), 0)
+        self.assertEqual(num.denom(), 1)
+
+    def test_from_num_denom(self):
+        num = GncNumeric(1, 2)
+        self.assertEqual(str(num), "1/2")
+        self.assertEqual(num.num(), 1)
+        self.assertEqual(num.denom(), 2)
+
+    def test_from_int(self):
+        num = GncNumeric(3)
+        self.assertEqual(str(num), "3/1")
+        self.assertEqual(num.num(), 3)
+        self.assertEqual(num.denom(), 1)
+
+    # Safest outcome at current. This can be fixed but correct bounds checks
+    # are required to ensure gint64 is not overflowed.
+    def test_from_long(self):
+        with self.assertRaises(TypeError):
+            GncNumeric(3L)
+
+    def test_from_float(self):
+        num = GncNumeric(3.1, 20, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
+        self.assertEqual(str(num), "62/20")
+        self.assertEqual(num.num(), 62)
+        self.assertEqual(num.denom(), 20)
+
+        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_FLOOR)
+        self.assertEqual(str(num), "3333333333/10000000000")
+        self.assertEqual(num.num(), 3333333333)
+        self.assertEqual(num.denom(), 10000000000)
+
+        num = GncNumeric(1/3.0, 10000000000, GNC_HOW_RND_CEIL)
+        self.assertEqual(str(num), "3333333334/10000000000")
+        self.assertEqual(num.num(), 3333333334)
+        self.assertEqual(num.denom(), 10000000000)
+
+    def test_from_float_auto(self):
+        num = GncNumeric(3.1)
+        self.assertEqual(str(num), "31/10")
+        self.assertEqual(num.num(), 31)
+        self.assertEqual(num.denom(), 10)
+
+    def test_from_instance(self):
+        orig = GncNumeric(3)
+        num = GncNumeric(instance=orig.instance)
+        self.assertEqual(str(num), "3/1")
+        self.assertEqual(num.num(), 3)
+        self.assertEqual(num.denom(), 1)
+
+    def test_from_str(self):
+        num = GncNumeric("3.1")
+        self.assertEqual(str(num), "31/10")
+        self.assertEqual(num.num(), 31)
+        self.assertEqual(num.denom(), 10)
+
+        num = GncNumeric("1/3")
+        self.assertEqual(str(num), "1/3")
+        self.assertEqual(num.num(), 1)
+        self.assertEqual(num.denom(), 3)
+
+    def test_to_str(self):
+        num = GncNumeric("1000/3")
+        self.assertEqual(str(num), "1000/3")
+
+        num = GncNumeric(1, 0)
+        self.assertEqual(str(num), "1/0")
+
+    def test_to_double(self):
+        for test_num in [0.0, 1.1, -1.1, 1/3.0]:
+            self.assertEqual(GncNumeric(test_num).to_double(), test_num)
+
+    def test_incorect_args(self):
+        with self.assertRaises(TypeError):
+            GncNumeric(1, 2, 3)
+
+        with self.assertRaises(TypeError):
+            GncNumeric("1", 2)
+
+        with self.assertRaises(TypeError):
+            GncNumeric(1.1, "round")
+
+        with self.assertRaises(TypeError):
+            GncNumeric(complex(1, 1))
+
+if __name__ == '__main__':
+    main()

commit 5aa048e01d4ae949505a5ccd5ad15c13bf1edc44
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 28 15:39:41 2017 -0800

    Fix null pointer dereference segfault.
    
    Reported via PR 21y by github user ethaden.
    This is a simpler fix than the one in the PR.

diff --git a/gnucash/import-export/aqb/gnc-ab-kvp.c b/gnucash/import-export/aqb/gnc-ab-kvp.c
index 764afa3..80be042 100644
--- a/gnucash/import-export/aqb/gnc-ab-kvp.c
+++ b/gnucash/import-export/aqb/gnc-ab-kvp.c
@@ -102,7 +102,7 @@ gnc_ab_get_account_trans_retrieval(const Account *a)
     qof_instance_get (QOF_INSTANCE (a),
 		      "ab-trans-retrieval", &t,
 		      NULL);
-    return *t;
+    return t ? *t : (Timespec){0, 0};
 }
 
 void

commit a5bf4e00a4a9f5a9d17e43f99a1cff21d69a45d8
Merge: 5204100 d599658
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 28 15:16:36 2017 -0800

    Merge Aaron Laws's 'unneeded-build-flag' into unstable


commit d599658603917d5c3196006b01296e9a6b1e2cf7
Author: lmat <dartme18 at gmail.com>
Date:   Tue Nov 28 16:10:28 2017 -0500

    Removing Arch Linux Autotools build
    
    It has failed many times, but to my knowledge the failure has never been
    legitimate.

diff --git a/.travis.yml b/.travis.yml
index fde6ab5..ea030e0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,6 @@ language: c++
 compiler: gcc
 env:
     - BUILDENV=arch BUILDTYPE=cmake-ninja
-    - BUILDENV=arch BUILDTYPE=autotools
     - BUILDENV=ubuntu-14.04 BUILDTYPE=cmake-make
     - BUILDENV=ubuntu-14.04 BUILDTYPE=autotools
 services:

commit 04a4849967515adb916001e3211240f4ee799b1c
Author: lmat <dartme18 at gmail.com>
Date:   Tue Nov 28 15:47:23 2017 -0500

    Removing unneeded build flag from docker

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f35ac5c..fa6a51d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,6 @@ OPTION (WITH_GNUCASH "Build all of GnuCash, not just the library" ON)
 OPTION (WITH_OFX "compile with ofx support (needs LibOFX)" ON)
 OPTION (WITH_PYTHON "enable python plugin and bindings" OFF)
 OPTION (ENABLE_BINRELOC "compile with binary relocation support" ON)
-OPTION (ENABLE_DEBUG "compile with debugging flags set" OFF)
 OPTION (ENABLE_REGISTER2 "compile with register2 enabled" OFF)
 OPTION (DISABLE_NLS "do not use Native Language Support" OFF)
 OPTION (DISABLE_DEPRECATED_GLIB "don't use deprecated glib functions" OFF)
diff --git a/util/ci/commonbuild b/util/ci/commonbuild
index 63d4603..f314611 100644
--- a/util/ci/commonbuild
+++ b/util/ci/commonbuild
@@ -11,7 +11,7 @@ if [[ "$BUILDTYPE" == "cmake-make" ]]; then
     make -j 4
     make check || ../afterfailure
 elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then
-    cmake ../gnucash -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=debug -DENABLE_DEBUG=on -G Ninja
+    cmake ../gnucash -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=debug -G Ninja
     ninja
     ninja check || ../afterfailure;
 elif [[ "$BUILDTYPE" == "autotools" ]]; then



Summary of changes:
 .gitignore                                         |   3 -
 .travis.yml                                        |   1 -
 CMakeLists.txt                                     |  38 +++-
 bindings/python/CMakeLists.txt                     |   2 +-
 bindings/python/Makefile.am                        |   5 +-
 bindings/python/gnucash_core.py                    |  70 +++++--
 bindings/python/tests/CMakeLists.txt               |   3 +-
 bindings/python/tests/Makefile.am                  |   2 +
 bindings/python/tests/runTests.py.in               |   3 +-
 bindings/python/tests/test_account.py              |   4 +-
 bindings/python/tests/test_numeric.py              | 108 +++++++++++
 cmake/CMakeLists.txt                               |   2 +-
 common/base-typemaps.i                             |  41 ++--
 common/cmake_modules/GncAddSwigCommand.cmake       |  23 ++-
 common/cmake_modules/GncAddTest.cmake              |   6 +-
 common/cmake_modules/MakeDistFiles.cmake           |   2 -
 common/test-core/CMakeLists.txt                    |   1 -
 common/test-core/Makefile.am                       |   6 +-
 configure.ac                                       |   7 +-
 data/pixmaps/CMakeLists.txt                        |   6 +-
 doc/CMakeLists.txt                                 |   6 +-
 doc/examples/CMakeLists.txt                        |   2 +-
 gnucash/CMakeLists.txt                             |  23 +--
 gnucash/Makefile.am                                |  41 +---
 gnucash/environment.in                             |   4 +-
 gnucash/gnome-search/CMakeLists.txt                |   2 +-
 gnucash/gnome-search/dialog-search.c               |  18 +-
 gnucash/gnome-search/dialog-search.h               |  15 +-
 gnucash/gnome-search/gnc-general-search.c          |   7 +-
 gnucash/gnome-search/gnc-general-search.h          |   2 +-
 gnucash/gnome-utils/Makefile.am                    |   2 +-
 gnucash/gnome-utils/assistant-xml-encoding.c       |   6 +-
 gnucash/gnome-utils/dialog-account.c               |  18 +-
 gnucash/gnome-utils/dialog-book-close.c            |   4 +-
 gnucash/gnome-utils/dialog-commodity.c             |  20 +-
 gnucash/gnome-utils/dialog-options.c               |   2 +-
 gnucash/gnome-utils/dialog-preferences.c           |   2 +-
 gnucash/gnome-utils/dialog-query-view.c            |   9 +-
 gnucash/gnome-utils/dialog-query-view.h            |   6 +-
 gnucash/gnome-utils/dialog-tax-table.c             |  16 +-
 gnucash/gnome-utils/dialog-transfer.c              |  14 +-
 gnucash/gnome-utils/gnc-autosave.c                 |   2 +-
 gnucash/gnome-utils/gnc-file.c                     |  32 ++-
 gnucash/gnome-utils/gnc-gui-query.c                | 127 ++++--------
 gnucash/gnome-utils/gnc-gui-query.h                |   9 +-
 gnucash/gnome-utils/gnc-main-window.c              |  48 +++--
 gnucash/gnome-utils/gnc-splash.c                   |   5 +
 gnucash/gnome-utils/gnc-splash.h                   |   2 +
 gnucash/gnome-utils/gnc-tree-control-split-reg.c   |  30 +--
 gnucash/gnome-utils/gnc-tree-util-split-reg.c      |   4 +-
 gnucash/gnome-utils/gnc-ui.h                       |  53 +++--
 gnucash/gnome-utils/gnome-utils.i                  |  16 +-
 gnucash/gnome/CMakeLists.txt                       |   4 +-
 gnucash/gnome/Makefile.am                          |   2 +-
 gnucash/gnome/assistant-stock-split.c              |   4 +-
 gnucash/gnome/business-gnome-utils.c               |   4 +-
 gnucash/gnome/business-urls.c                      |  12 +-
 gnucash/gnome/dialog-billterms.c                   |  12 +-
 gnucash/gnome/dialog-commodities.c                 |   2 +-
 gnucash/gnome/dialog-customer.c                    |  78 ++++----
 gnucash/gnome/dialog-customer.h                    |  10 +-
 gnucash/gnome/dialog-date-close.c                  |   4 +-
 gnucash/gnome/dialog-employee.c                    |  91 ++++-----
 gnucash/gnome/dialog-employee.h                    |  10 +-
 gnucash/gnome/dialog-fincalc.c                     |   2 +-
 gnucash/gnome/dialog-find-transactions.c           |  14 +-
 gnucash/gnome/dialog-find-transactions2.c          |  14 +-
 gnucash/gnome/dialog-invoice.c                     | 215 ++++++++++++---------
 gnucash/gnome/dialog-invoice.h                     |  24 +--
 gnucash/gnome/dialog-job.c                         |  61 +++---
 gnucash/gnome/dialog-job.h                         |  13 +-
 gnucash/gnome/dialog-order.c                       |  53 ++---
 gnucash/gnome/dialog-order.h                       |  10 +-
 gnucash/gnome/dialog-payment.c                     |  32 +--
 gnucash/gnome/dialog-payment.h                     |  11 +-
 gnucash/gnome/dialog-price-edit-db.c               |   4 +-
 gnucash/gnome/dialog-price-editor.c                |   2 +-
 gnucash/gnome/dialog-sx-editor.c                   |  24 +--
 gnucash/gnome/dialog-sx-editor2.c                  |  26 +--
 gnucash/gnome/dialog-sx-from-trans.c               |   6 +-
 gnucash/gnome/dialog-sx-since-last-run.c           |   8 +-
 gnucash/gnome/dialog-sx-since-last-run.h           |   2 +-
 gnucash/gnome/dialog-trans-assoc.c                 |   3 +-
 gnucash/gnome/dialog-vendor.c                      |  68 +++----
 gnucash/gnome/dialog-vendor.h                      |  10 +-
 gnucash/gnome/gnc-plugin-basic-commands.c          |  10 +-
 gnucash/gnome/gnc-plugin-business.c                |  48 ++---
 gnucash/gnome/gnc-plugin-business.h                |   4 +-
 gnucash/gnome/gnc-plugin-page-invoice.c            |  24 ++-
 gnucash/gnome/gnc-plugin-page-owner-tree.c         |  30 +--
 gnucash/gnome/gnc-plugin-page-register.c           |  22 ++-
 gnucash/gnome/gnc-plugin-page-register2.c          |  12 +-
 gnucash/gnome/gnc-plugin-page-sx-list.c            |   4 +-
 gnucash/gnome/gnc-split-reg.c                      |   8 +-
 gnucash/gnome/gtkbuilder/dialog-customer.glade     |   1 -
 gnucash/gnome/gtkbuilder/dialog-employee.glade     |   1 -
 gnucash/gnome/gtkbuilder/dialog-invoice.glade      |   2 -
 gnucash/gnome/gtkbuilder/dialog-job.glade          |  33 ++--
 gnucash/gnome/gtkbuilder/dialog-order.glade        |   2 -
 gnucash/gnome/gtkbuilder/dialog-payment.glade      |   1 -
 gnucash/gnome/gtkbuilder/dialog-sx.glade           |   1 -
 gnucash/gnome/gtkbuilder/dialog-vendor.glade       |   1 -
 gnucash/gnome/top-level.c                          |   8 +-
 gnucash/gnome/window-reconcile.c                   |   8 +-
 gnucash/gnome/window-reconcile2.c                  |   8 +-
 gnucash/html/Makefile.am                           |   2 +-
 gnucash/html/gnc-html-webkit1.c                    |  13 +-
 gnucash/html/gnc-html-webkit2.c                    |  13 +-
 gnucash/html/gnc-html.h                            |   3 +
 gnucash/import-export/CMakeLists.txt               |   2 +-
 gnucash/import-export/aqb/CMakeLists.txt           |   4 +-
 gnucash/import-export/aqb/assistant-ab-initial.c   |   6 +-
 gnucash/import-export/aqb/dialog-ab-trans.c        |   8 +-
 gnucash/import-export/aqb/gnc-ab-getbalance.c      |  10 +-
 gnucash/import-export/aqb/gnc-ab-gettrans.c        |  10 +-
 gnucash/import-export/aqb/gnc-ab-kvp.c             |   2 +-
 gnucash/import-export/aqb/gnc-ab-transfer.c        |  14 +-
 gnucash/import-export/aqb/gnc-ab-utils.c           |  15 +-
 gnucash/import-export/aqb/gnc-file-aqb-import.c    |   2 +-
 gnucash/import-export/aqb/gnc-gwen-gui.c           |   4 +-
 .../import-export/bi-import/dialog-bi-import-gui.c |  19 +-
 .../import-export/bi-import/dialog-bi-import-gui.h |   2 +-
 gnucash/import-export/bi-import/dialog-bi-import.c |  10 +-
 gnucash/import-export/bi-import/dialog-bi-import.h |   4 +-
 .../import-export/bi-import/gnc-plugin-bi-import.c |   2 +-
 gnucash/import-export/csv-exp/CMakeLists.txt       |   4 +-
 .../import-export/csv-exp/assistant-csv-export.c   |   2 +-
 gnucash/import-export/csv-imp/CMakeLists.txt       |   4 +-
 .../csv-imp/assistant-csv-account-import.c         |   2 +-
 .../csv-imp/assistant-csv-trans-import.cpp         |  28 +--
 gnucash/import-export/csv-imp/csv-account-import.c |   2 +-
 .../customer-import/dialog-customer-import-gui.c   |   6 +-
 .../customer-import/dialog-customer-import.c       |   4 +-
 gnucash/import-export/import-account-matcher.c     |   4 +-
 gnucash/import-export/log-replay/CMakeLists.txt    |   2 +-
 gnucash/import-export/ofx/CMakeLists.txt           |   2 +-
 gnucash/import-export/ofx/gnc-ofx-import.c         |   4 +-
 gnucash/import-export/qif-imp/CMakeLists.txt       |   4 +-
 .../import-export/qif-imp/assistant-qif-import.c   |  63 +++---
 gnucash/overrides/CMakeLists.txt                   |  32 ---
 gnucash/overrides/Makefile.am                      |  50 -----
 gnucash/overrides/gnucash-build-env.in             |  88 ---------
 gnucash/overrides/gnucash-env.in                   |  28 ---
 gnucash/overrides/gnucash-make-guids.in            |  36 ----
 gnucash/overrides/guile.in                         |   8 -
 gnucash/python/CMakeLists.txt                      |   4 +-
 gnucash/register/ledger-core/gncEntryLedger.c      |   4 +-
 .../register/ledger-core/gncEntryLedgerControl.c   |   6 +-
 .../register/ledger-core/split-register-control.c  |  18 +-
 gnucash/register/ledger-core/split-register.c      |  14 +-
 gnucash/report/jqplot/CMakeLists.txt               |   4 +-
 gnucash/report/report-gnome/CMakeLists.txt         |   4 +-
 gnucash/report/report-gnome/Makefile.am            |   2 +-
 gnucash/report/report-gnome/dialog-custom-report.c |   8 +-
 .../report-gnome/dialog-report-style-sheet.c       |   2 +-
 .../report/report-gnome/gnc-plugin-page-report.c   |   2 +-
 gnucash/report/report-gnome/window-report.c        |  12 +-
 gnucash/report/report-gnome/window-report.h        |   2 +-
 gnucash/report/report-system/Makefile.am           |   2 +-
 gnucash/report/stylesheets/CMakeLists.txt          |   2 +-
 gnucash/test/CMakeLists.txt                        |   6 -
 gnucash/test/Makefile.am                           |   9 -
 gnucash/test/test-version.in                       |   5 -
 libgnucash/app-utils/CMakeLists.txt                |   4 +-
 libgnucash/app-utils/Makefile.am                   |   6 +-
 libgnucash/core-utils/CMakeLists.txt               |  17 +-
 libgnucash/core-utils/Makefile.am                  |   6 +-
 libgnucash/core-utils/binreloc.c                   | 127 ++++--------
 libgnucash/core-utils/gnc-filepath-utils.cpp       |   8 +
 libgnucash/core-utils/gnc-filepath-utils.h         |   8 +
 libgnucash/core-utils/gnc-path.c                   |  15 +-
 libgnucash/core-utils/gncla-dir.h.in               |   2 +-
 libgnucash/core-utils/test/CMakeLists.txt          |  34 +++-
 .../core-utils/test/gtest-path-utilities.cpp       | 125 ++++++++++++
 libgnucash/engine/CMakeLists.txt                   |  10 -
 libgnucash/engine/Makefile.am                      |   3 +-
 libgnucash/engine/qof-backend.cpp                  |   8 +-
 libgnucash/gnc-module/Makefile.am                  |   2 +-
 libgnucash/gnc-module/test/CMakeLists.txt          |  10 +-
 .../gnc-module/test/misc-mods/CMakeLists.txt       |   4 +-
 libgnucash/gnc-module/test/mod-bar/CMakeLists.txt  |   4 +-
 libgnucash/gnc-module/test/mod-bar/Makefile.am     |   2 +-
 libgnucash/gnc-module/test/mod-baz/CMakeLists.txt  |   4 +-
 libgnucash/gnc-module/test/mod-baz/Makefile.am     |   2 +-
 libgnucash/gnc-module/test/mod-foo/CMakeLists.txt  |   4 +-
 libgnucash/gnc-module/test/mod-foo/Makefile.am     |   2 +-
 libgnucash/quotes/CMakeLists.txt                   |   4 +-
 po/CMakeLists.txt                                  |   2 +-
 util/ci/commonbuild                                |   2 +-
 189 files changed, 1500 insertions(+), 1482 deletions(-)
 create mode 100644 bindings/python/tests/test_numeric.py
 delete mode 100644 gnucash/overrides/CMakeLists.txt
 delete mode 100644 gnucash/overrides/Makefile.am
 delete mode 100644 gnucash/overrides/gnucash-build-env.in
 delete mode 100644 gnucash/overrides/gnucash-env.in
 delete mode 100755 gnucash/overrides/gnucash-make-guids.in
 delete mode 100644 gnucash/overrides/guile.in
 delete mode 100644 gnucash/test/CMakeLists.txt
 delete mode 100644 gnucash/test/Makefile.am
 delete mode 100755 gnucash/test/test-version.in
 create mode 100644 libgnucash/core-utils/test/gtest-path-utilities.cpp



More information about the gnucash-changes mailing list