Fix GdkDisplay error in trace file

When OFX import is first used and the file chosen, an account select
dialog will be shown but the parent was being obtained from a hidden
import-main-matcher dialog. This fails so get the parent from the
transient parent of the import-main-matcher dialog.
This commit is contained in:
Robert Fewell 2020-11-03 14:02:13 +00:00
parent 504ca731e2
commit 761797eb3d

View File

@ -926,6 +926,8 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
gnc_commodity * default_commodity;
GNCAccountType default_type = ACCT_TYPE_NONE;
gchar * account_description;
GtkWidget * main_widget;
GtkWidget * parent;
/* In order to trigger a book options display on the creation of a new book,
* we need to detect when we are dealing with a new book. */
gboolean new_book = gnc_is_new_book();
@ -1006,7 +1008,17 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
"%s \"%s\"",
account_type_name,
data.account_name);
account = gnc_import_select_account (gnc_gen_trans_list_widget(info->gnc_ofx_importer_gui),
main_widget = gnc_gen_trans_list_widget (info->gnc_ofx_importer_gui);
/* On first use, the import-main-matcher is hidden / not realized so to
* get a parent use the transient parent of the matcher */
if (gtk_widget_get_realized (main_widget))
parent = main_widget;
else
parent = GTK_WIDGET(gtk_window_get_transient_for (GTK_WINDOW(main_widget)));
account = gnc_import_select_account (parent,
data.account_id, 1,
account_description, default_commodity,
default_type, NULL, NULL);