From ba12e3125124b9ea5beaee77e7f7b613452a8d95 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 26 Feb 2023 12:10:41 -0800 Subject: [PATCH] Bug 798753 - UX improvements in new import dialog Rename the dialog to not mention export since we don't use it for that. Change the key-column names to be specific to the listview. Add tooltips to the listviews to explain what they're for Persist the selected imexporter and profile in the book's state file. Stop the inappropriate "there are transactions do you want to import them?" dialog (missing AWAIT_TRANSACTIONS in gnc_ab_import_context call). --- .../aqb/dialog-ab-select-imexporter.c | 44 +++++++++++++++++++ .../aqb/dialog-ab-select-imexporter.h | 16 +++++++ gnucash/import-export/aqb/dialog-ab.glade | 9 ++-- .../import-export/aqb/gnc-file-aqb-import.c | 35 ++++++++++++++- 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/gnucash/import-export/aqb/dialog-ab-select-imexporter.c b/gnucash/import-export/aqb/dialog-ab-select-imexporter.c index 8cbdebea66..f8985fa7e3 100644 --- a/gnucash/import-export/aqb/dialog-ab-select-imexporter.c +++ b/gnucash/import-export/aqb/dialog-ab-select-imexporter.c @@ -28,6 +28,7 @@ #include +#include #include #include "dialog-ab-select-imexporter.h" #include @@ -232,6 +233,35 @@ tree_view_get_name (GtkTreeView *tv) return NULL; } + +static void +tree_view_set_name (GtkTreeView *tree, const char* name) +{ + GtkTreeIter iter; + GtkTreeModel* model = gtk_tree_view_get_model(tree); + bool found = false; + + if (!gtk_tree_model_get_iter_first(model, &iter)) + return; + do + { + char* row_name; + gtk_tree_model_get(model, &iter, NAME_COL, &row_name, -1); + if (!g_strcmp0(name, row_name)) + { + found = true; + break; + } + } + while(gtk_tree_model_iter_next(model, &iter)); + + if (found) + { + GtkTreeSelection *sel = gtk_tree_view_get_selection(tree); + gtk_tree_selection_select_iter(sel, &iter); + } +} + char* gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg* imexd) { @@ -243,3 +273,17 @@ gnc_ab_select_imex_dlg_get_profile_name (GncABSelectImExDlg* imexd) { return tree_view_get_name (GTK_TREE_VIEW (imexd->select_profile)); } + +void +gnc_ab_select_imex_dlg_set_imexporter_name (GncABSelectImExDlg* imexd, const char* name) +{ + if (name) + tree_view_set_name (GTK_TREE_VIEW (imexd->select_imexporter), name); +} + +void +gnc_ab_select_imex_dlg_set_profile_name (GncABSelectImExDlg* imexd, const char* name) +{ + if (name) + tree_view_set_name (GTK_TREE_VIEW (imexd->select_profile), name); +} diff --git a/gnucash/import-export/aqb/dialog-ab-select-imexporter.h b/gnucash/import-export/aqb/dialog-ab-select-imexporter.h index 22c5fe4b70..b2a50833cb 100644 --- a/gnucash/import-export/aqb/dialog-ab-select-imexporter.h +++ b/gnucash/import-export/aqb/dialog-ab-select-imexporter.h @@ -70,6 +70,14 @@ int gnc_ab_select_imex_dlg_run (GncABSelectImExDlg* imexd); char* gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg* imexd); +/** + * Get the selected importer/exporter name + * @param imexd the dialog with the selection + * @para name the importer/exporter name to select. + */ +void +gnc_ab_select_imex_dlg_set_imexporter_name (GncABSelectImExDlg* imexd, const char* name); + /** * Get the selected file format profile name * @param imexd the dialog with the selection @@ -78,6 +86,14 @@ gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg* imexd); char* gnc_ab_select_imex_dlg_get_profile_name (GncABSelectImExDlg* imexd); +/** + * Get the selected file format profile name + * @param imexd the dialog with the selection + * @param name the profile to select. + */ +void +gnc_ab_select_imex_dlg_set_profile_name (GncABSelectImExDlg* imexd, const char* name); + G_END_DECLS #endif //DIALOG_AB_SELECT_IMEXPORTER_H diff --git a/gnucash/import-export/aqb/dialog-ab.glade b/gnucash/import-export/aqb/dialog-ab.glade index 36cfc9cf06..616a2dbcb4 100644 --- a/gnucash/import-export/aqb/dialog-ab.glade +++ b/gnucash/import-export/aqb/dialog-ab.glade @@ -1658,7 +1658,7 @@ False 5 - Select File Importer/Exporter + Select File Import Format and Template dialog @@ -1727,9 +1727,10 @@ imexporter-list True True + This list contains the file formats that AQBanking knows how to import. The profile list contains specializations and is populated according to which format you select in this list. - Name + File Format @@ -1768,12 +1769,14 @@ True never in + 300 profile-list True True + This list one or more specialization templates that adjust the import for different banks uses of fields in the selected import format.