gnucash unstable: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Fri Dec 8 09:51: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)
from https://github.com/Gnucash/gnucash/commit/66817bb9 (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(¤t_owner) != GNC_OWNER_UNDEFINED)
- gnc_ui_invoice_new (¤t_owner, gnc_get_current_book());
+ gnc_ui_invoice_new (parent, ¤t_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
Summary of changes:
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/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/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/gnc-html-webkit1.c | 13 +-
gnucash/html/gnc-html-webkit2.c | 13 +-
gnucash/html/gnc-html.h | 3 +
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-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 +-
.../import-export/csv-exp/assistant-csv-export.c | 2 +-
.../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/ofx/gnc-ofx-import.c | 4 +-
.../import-export/qif-imp/assistant-qif-import.c | 63 +++---
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/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 +-
110 files changed, 952 insertions(+), 890 deletions(-)
More information about the gnucash-changes
mailing list