From 9504b7067de74782c1f432c280e4c421fc4880fc Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Tue, 7 May 2019 15:49:52 +0100 Subject: [PATCH] Bug 728873 - In Qif importer use the enter on account entry Focus is already on the account entry so enable the use of the enter key to proceed to the next page when you are finished changing the account name for a qif file. --- gnucash/gtkbuilder/assistant-qif-import.glade | 1 + .../qif-imp/assistant-qif-import.c | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/gnucash/gtkbuilder/assistant-qif-import.glade b/gnucash/gtkbuilder/assistant-qif-import.glade index af71d2047d..c566847dbb 100644 --- a/gnucash/gtkbuilder/assistant-qif-import.glade +++ b/gnucash/gtkbuilder/assistant-qif-import.glade @@ -381,6 +381,7 @@ Please enter a name for the account. If the file was exported from another accou False False + True diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c index 5505e3ce0c..9a75cf0c2f 100644 --- a/gnucash/import-export/qif-imp/assistant-qif-import.c +++ b/gnucash/import-export/qif-imp/assistant-qif-import.c @@ -237,6 +237,7 @@ void gnc_ui_qif_import_date_valid_cb (GtkWidget *widget, gpointer user_data); void gnc_ui_qif_import_account_prepare (GtkAssistant *assistant, gpointer user_data); void gnc_ui_qif_import_acct_valid_cb (GtkWidget *widget, gpointer user_data); +void gnc_ui_qif_import_acct_enter_cb (GtkWidget * widget, gpointer user_data); void gnc_ui_qif_import_loaded_files_prepare (GtkAssistant *assistant, gpointer user_data); void gnc_ui_qif_import_load_another_cb (GtkButton *button, gpointer user_data); @@ -2134,10 +2135,41 @@ gnc_ui_qif_import_account_prepare (GtkAssistant *assistant, gpointer user_data) } +/******************************************************************** + * gnc_ui_qif_import_acct_enter_cb + * + * Invoked when the "enter" button is clicked on the acct entry. + ********************************************************************/ +void +gnc_ui_qif_import_acct_enter_cb (GtkWidget * widget, + gpointer user_data) +{ + QIFImportWindow * wind = user_data; + + 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 * acct_name = gtk_entry_get_text (GTK_ENTRY(wind->acct_entry)); + + if (!acct_name || acct_name[0] == 0) + { + /* Disable the assistant "Next" Button */ + gtk_assistant_set_page_complete (assistant, page, FALSE); + } + else + { + /* Enable the assistant "Next" Button and proceed */ + gtk_assistant_set_page_complete (assistant, page, TRUE); + gtk_assistant_set_current_page (assistant, num + 1); + } +} + + /******************************************************************** * gnc_ui_qif_import_acct_valid_cb * - * Invoked when the "next" button is clicked on the default acct page. + * Change signal for the acct entry to enable "Next" button. ********************************************************************/ void gnc_ui_qif_import_acct_valid_cb (GtkWidget * widget,