From 3a825c929f789b0c988aec8f16eab2b840ca90f0 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 12 Nov 2014 12:07:51 +0100 Subject: [PATCH] QIF Import crashes when closing via the 'X' button on the last page Using the 'Close' button works correctly. The difference is that the 'X' button triggers a cancel action while the 'Close' button triggers a close action. I have changed this such that when the import already happened (that is when the user is looking at the summary page), a close action will be triggered in both cases. --- src/import-export/qif-imp/assistant-qif-import.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/import-export/qif-imp/assistant-qif-import.c b/src/import-export/qif-imp/assistant-qif-import.c index 983e7cadd5..83b62bb4f0 100644 --- a/src/import-export/qif-imp/assistant-qif-import.c +++ b/src/import-export/qif-imp/assistant-qif-import.c @@ -1309,8 +1309,17 @@ void gnc_ui_qif_import_cancel_cb(GtkAssistant *gtkassistant, gpointer user_data) { QIFImportWindow *wind = user_data; + gint currentpage = gtk_assistant_get_current_page(gtkassistant); + GtkWidget *mypage = gtk_assistant_get_nth_page (gtkassistant, currentpage); + const char *pagename = gtk_buildable_get_name(GTK_BUILDABLE(mypage)); - if (wind->busy) + if (!g_strcmp0 (pagename, "summary_page")) + { + /* Hitting the window close button on the summary page should not + invoke a cancel action. The import has finised at that point. */ + gnc_ui_qif_import_close_cb(gtkassistant, user_data); + } + else if (wind->busy) { /* Cancel any long-running Scheme operation. */ scm_c_eval_string("(qif-import:cancel)");