Skip to content

Commit

Permalink
Fix GdkDisplay error in trace file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Bob-IT committed Nov 3, 2020
1 parent 504ca73 commit 761797e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions gnucash/import-export/ofx/gnc-ofx-import.c
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1151,7 +1163,7 @@ gnc_file_ofx_import_process_file (ofx_info* info)
// Create the match dialog, and run the ofx file through the importer.
info->gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, TRUE, 42, FALSE);
libofx_proc_file (libofx_context, selected_filename, AUTODETECT);

// Free the libofx context before recursing to process the next file
libofx_free_context(libofx_context);

Expand All @@ -1173,7 +1185,7 @@ gnc_file_ofx_import_process_file (ofx_info* info)
G_CALLBACK (gnc_ofx_match_done), info);

gnc_gen_trans_list_show_all (info->gnc_ofx_importer_gui);

// Show or hide the check box for reconciling after match, depending on whether a statement was received.
gnc_gen_trans_list_show_reconcile_after_close_button (info->gnc_ofx_importer_gui, info->statement != NULL, info->run_reconcile);

Expand All @@ -1199,7 +1211,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
GSList* iter = NULL;
ofx_info* info = NULL;
GtkFileFilter* filter = gtk_file_filter_new ();


ofx_PARSER_msg = false;
ofx_DEBUG_msg = false;
Expand Down

0 comments on commit 761797e

Please sign in to comment.