gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Mar 22 13:43:09 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/b7f6cfe6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/48f2aab7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3aa9009c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/12788c0c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e780fcdc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3cb49c92 (commit)
	from  https://github.com/Gnucash/gnucash/commit/0620b597 (commit)



commit b7f6cfe607cfd9ecb6776f7a8bd55b5858504f3d
Merge: 0620b597e 48f2aab77
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Mar 22 10:34:12 2020 -0700

    Merge Jean Laroche's 'fix_797042_ofx_return' into maint.


commit 48f2aab77bdd6b8499be977e2713ffd70b87e0f7
Author: jean <you at example.com>
Date:   Sun Mar 15 11:32:25 2020 -0700

    Add code to delay showing dialog until we know we have transactions to show

diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index 4e965fa35..f101e3405 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -940,7 +940,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
     if (!data->generic_importer)
     {
         data->generic_importer = gnc_gen_trans_list_new(data->parent, NULL,
-                                 TRUE, 14);
+                                 TRUE, 14, TRUE);
         if (data->execute_txns)
         {
             gnc_gen_trans_list_add_tp_cb(data->generic_importer,
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 284a19b28..16aca2779 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -187,6 +187,11 @@ gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info)
     return !gtk_tree_model_get_iter_first (model, &iter);
 }
 
+void gnc_gen_trans_list_show_all(GNCImportMainMatcher *info)
+{
+    gtk_widget_show_all (GTK_WIDGET (info->main_widget));
+}
+
 void
 on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
 {
@@ -907,7 +912,8 @@ show_account_column_toggled_cb (GtkToggleButton *togglebutton,
 GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
         const gchar* heading,
         gboolean all_from_same_account,
-        gint match_date_hardlimit)
+        gint match_date_hardlimit,
+        gboolean show_all)
 {
     GNCImportMainMatcher *info;
     GtkBuilder *builder;
@@ -962,7 +968,8 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
         gtk_label_set_text (GTK_LABEL (heading_label), heading);
 
     gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->main_widget), GTK_WINDOW (parent));
-    gtk_widget_show_all (GTK_WIDGET (info->main_widget));
+    if(show_all)
+        gtk_widget_show_all (GTK_WIDGET (info->main_widget));
 
     info->transaction_processed_cb = NULL;
 
diff --git a/gnucash/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
index 76db5bc9e..7e1e33dd5 100644
--- a/gnucash/import-export/import-main-matcher.h
+++ b/gnucash/import-export/import-main-matcher.h
@@ -62,12 +62,15 @@ typedef void (*GNCTransactionProcessedCB) (GNCImportTransInfo *trans_info,
  * with paper checks (e.g. OFX, QIF), values like 42 (days) seem more
  * appropriate.
  *
+ @param show_all if true, all widgets are shown
+ *
  * @return A pointer to the GNCImportMainMatcher which has been setup.
 */
 GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
         const gchar* heading,
         gboolean all_from_same_account,
-        gint match_date_hardlimit);
+        gint match_date_hardlimit,
+        gboolean show_all);
 
 
 
@@ -187,5 +190,11 @@ GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info);
  * @return A boolean indicating whether the transaction list is empty.
  */
 gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info);
+
+/** Shows widgets.
+ * @param info A pointer to a the GNCImportMainMatcher structure.
+ */
+void gnc_gen_trans_list_show_all(GNCImportMainMatcher *info);
+
 #endif
 /**@}*/
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index a9a931a36..b0f7edecf 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -412,7 +412,6 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
     GtkWindow *parent = GTK_WINDOW (user_data);
 
     g_assert(gnc_ofx_importer_gui);
-    num_trans_processed += 1;
 
     if (!data.account_id_valid)
     {
@@ -891,7 +890,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
         xaccTransDestroy(transaction);
         xaccTransCommitEdit(transaction);
     }
-
+    num_trans_processed += 1;
     return 0;
 }//end ofx_proc_transaction()
 
@@ -1066,7 +1065,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
         DEBUG("Filename found: %s", selected_filename);
 
         /* Create the Generic transaction importer GUI. */
-        gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, FALSE, 42);
+        gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, FALSE, 42, FALSE);
 
         /* Look up the needed preferences */
         auto_create_commodity =
@@ -1093,10 +1092,15 @@ void gnc_file_ofx_import (GtkWindow *parent)
         if(gnc_gen_trans_list_empty(gnc_ofx_importer_gui))
         {
             gnc_gen_trans_list_delete (gnc_ofx_importer_gui);
-            g_print("%d transactions imported\n",num_trans_processed);
-            gnc_info_dialog(parent,_("OFX file imported, %d transactions processed, no new transactions"),num_trans_processed);
+            if(num_trans_processed)
+                gnc_info_dialog(parent,_("OFX file imported, %d transactions processed, no transactions to match"),num_trans_processed);
+        }
+        else
+        {
+            gnc_gen_trans_list_show_all(gnc_ofx_importer_gui);
         }
         g_free(selected_filename);
+        
     }
 
     if (ofx_created_commodites)

commit 3aa9009c67650450e6bc42d68f5b55d6b8f0b1c9
Author: jean <you at example.com>
Date:   Sun Mar 15 11:06:32 2020 -0700

    Add display of number of transactions processed

diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index a05ff6ef1..a9a931a36 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -66,6 +66,7 @@ static QofLogModule log_module = GNC_MOD_IMPORT;
 GNCImportMainMatcher *gnc_ofx_importer_gui = NULL;
 static gboolean auto_create_commodity = FALSE;
 static Account *ofx_parent_account = NULL;
+static gint num_trans_processed = 0;
 
 GList *ofx_created_commodites = NULL;
 
@@ -411,6 +412,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
     GtkWindow *parent = GTK_WINDOW (user_data);
 
     g_assert(gnc_ofx_importer_gui);
+    num_trans_processed += 1;
 
     if (!data.account_id_valid)
     {
@@ -1085,12 +1087,14 @@ void gnc_file_ofx_import (GtkWindow *parent)
 #endif
 
         DEBUG("Opening selected file");
+        num_trans_processed = 0;
         libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
         // Now would be a good time to see whether the view has anything in it!
         if(gnc_gen_trans_list_empty(gnc_ofx_importer_gui))
         {
             gnc_gen_trans_list_delete (gnc_ofx_importer_gui);
-            gnc_info_dialog(parent,_("OFX file imported, no new transactions"));
+            g_print("%d transactions imported\n",num_trans_processed);
+            gnc_info_dialog(parent,_("OFX file imported, %d transactions processed, no new transactions"),num_trans_processed);
         }
         g_free(selected_filename);
     }

commit 12788c0c0601f251cc8c85f9ab430f510fc92d8d
Author: jean <you at example.com>
Date:   Sat Mar 14 19:13:23 2020 -0700

    More code cleanup

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 0c0a4ffe8..284a19b28 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -182,9 +182,7 @@ gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info)
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
-    
     g_assert (info);
-    
     model = gtk_tree_view_get_model (info->view);
     return !gtk_tree_model_get_iter_first (model, &iter);
 }

commit e780fcdc33bdc0056b7b54b3fb2a0e06158aca36
Author: jean <you at example.com>
Date:   Sat Mar 14 12:50:10 2020 -0700

    Fix formatting/code issues with previous commit

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 3692220c8..0c0a4ffe8 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -177,7 +177,8 @@ void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
     g_free (info);
 }
 
-gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info) {
+gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info)
+{
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
@@ -200,11 +201,12 @@ on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
     /*   DEBUG ("Begin") */
 
     model = gtk_tree_view_get_model (info->view);
-    if (!gtk_tree_model_get_iter_first (model, &iter)) {
-        // No transaction, we can just close the dialog. JEAN OK CLICKED NO TRANS
+    if (!gtk_tree_model_get_iter_first (model, &iter))
+    {
+        // No transaction, we can just close the dialog.
         gnc_gen_trans_list_delete (info);
         return;
-      }
+    }
 
     /* Don't run any queries and/or split sorts while processing the matcher
     results. */
diff --git a/gnucash/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
index 4a30ace76..76db5bc9e 100644
--- a/gnucash/import-export/import-main-matcher.h
+++ b/gnucash/import-export/import-main-matcher.h
@@ -170,19 +170,22 @@ void gnc_gen_trans_list_add_trans_with_ref_id(GNCImportMainMatcher *gui, Transac
 /** Run this dialog and return only after the user pressed Ok, Cancel,
   or closed the window. This means that all actual importing will
   have been finished upon returning.
- */
+ * @param info A pointer to a the GNCImportMainMatcher structure.
+ * @return The boolean return value of the dialog run.
+*/
 gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info);
 
 
 /** Returns the widget of this dialog.
+ * @param info A pointer to a the GNCImportMainMatcher structure.
+ * @return A GtkWidget pointer to the dialog's widget.
  */
 GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info);
 
 /** Checks whether there are no transactions to match.
+ * @param info A pointer to a the GNCImportMainMatcher structure.
+ * @return A boolean indicating whether the transaction list is empty.
  */
 gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info);
-
-
-
 #endif
 /**@}*/
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index f1811c9bf..a05ff6ef1 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -1064,7 +1064,6 @@ void gnc_file_ofx_import (GtkWindow *parent)
         DEBUG("Filename found: %s", selected_filename);
 
         /* Create the Generic transaction importer GUI. */
-        // JEAN IMPORT: Trans list UI created
         gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, FALSE, 42);
 
         /* Look up the needed preferences */
@@ -1086,12 +1085,10 @@ void gnc_file_ofx_import (GtkWindow *parent)
 #endif
 
         DEBUG("Opening selected file");
-        // JEAN: Where the ofx file is loaded.
         libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
         // Now would be a good time to see whether the view has anything in it!
-        gboolean is_empty = gnc_gen_trans_list_empty(gnc_ofx_importer_gui);
-        if(is_empty) {
-            // JEAN CLOSE THE WINDOW NO TRANS
+        if(gnc_gen_trans_list_empty(gnc_ofx_importer_gui))
+        {
             gnc_gen_trans_list_delete (gnc_ofx_importer_gui);
             gnc_info_dialog(parent,_("OFX file imported, no new transactions"));
         }

commit 3cb49c92d17e5043ae0ba43f35dc6724172d7926
Author: Jean Laroche <27791933+jeanlaroche at users.noreply.github.com>
Date:   Thu Mar 12 23:39:05 2020 -0700

    Bug 797042 - OK button in OFX importer doesn't work if nothing is imported.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index dcc228ed7..3692220c8 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -177,6 +177,17 @@ void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
     g_free (info);
 }
 
+gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info) {
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+    
+    g_assert (info);
+    
+    model = gtk_tree_view_get_model (info->view);
+    return !gtk_tree_model_get_iter_first (model, &iter);
+}
+
 void
 on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
 {
@@ -189,8 +200,11 @@ on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
     /*   DEBUG ("Begin") */
 
     model = gtk_tree_view_get_model (info->view);
-    if (!gtk_tree_model_get_iter_first (model, &iter))
+    if (!gtk_tree_model_get_iter_first (model, &iter)) {
+        // No transaction, we can just close the dialog. JEAN OK CLICKED NO TRANS
+        gnc_gen_trans_list_delete (info);
         return;
+      }
 
     /* Don't run any queries and/or split sorts while processing the matcher
     results. */
diff --git a/gnucash/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
index b98c12319..4a30ace76 100644
--- a/gnucash/import-export/import-main-matcher.h
+++ b/gnucash/import-export/import-main-matcher.h
@@ -178,5 +178,11 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info);
  */
 GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info);
 
+/** Checks whether there are no transactions to match.
+ */
+gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info);
+
+
+
 #endif
 /**@}*/
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index 255fbe87f..f1811c9bf 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -1064,6 +1064,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
         DEBUG("Filename found: %s", selected_filename);
 
         /* Create the Generic transaction importer GUI. */
+        // JEAN IMPORT: Trans list UI created
         gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, FALSE, 42);
 
         /* Look up the needed preferences */
@@ -1085,7 +1086,15 @@ void gnc_file_ofx_import (GtkWindow *parent)
 #endif
 
         DEBUG("Opening selected file");
+        // JEAN: Where the ofx file is loaded.
         libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
+        // Now would be a good time to see whether the view has anything in it!
+        gboolean is_empty = gnc_gen_trans_list_empty(gnc_ofx_importer_gui);
+        if(is_empty) {
+            // JEAN CLOSE THE WINDOW NO TRANS
+            gnc_gen_trans_list_delete (gnc_ofx_importer_gui);
+            gnc_info_dialog(parent,_("OFX file imported, no new transactions"));
+        }
         g_free(selected_filename);
     }
 



Summary of changes:
 gnucash/import-export/aqb/gnc-ab-utils.c    |  2 +-
 gnucash/import-export/import-main-matcher.c | 25 +++++++++++++++++++++++--
 gnucash/import-export/import-main-matcher.h | 22 ++++++++++++++++++++--
 gnucash/import-export/ofx/gnc-ofx-import.c  | 18 ++++++++++++++++--
 4 files changed, 60 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list