gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Wed Jan 5 01:53:54 EST 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/32cfd484 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/778cabb8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/490f646d (commit)
	from  https://github.com/Gnucash/gnucash/commit/43d4c4a6 (commit)



commit 32cfd484fb7529ff353184969fd703963bba5de6
Merge: 778cabb8d 490f646dc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Jan 5 14:53:38 2022 +0800

    Merge branch 'maint-speedup-reconcile-finalize' into maint #1230


commit 778cabb8d2b7753711aa582d9458f076f56a341d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 1 13:24:48 2022 +0800

    Addendum to fd3ec14f6 optionally raises descendants' editlevel

diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index bffe43cd9..a76b347bf 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -2257,6 +2257,19 @@ find_payment_account(Account *account)
     return NULL;
 }
 
+typedef void (*AccountProc) (Account *a);
+static void traverse_fn (Account *acct, AccountProc fn)
+{
+    fn (acct);
+}
+
+static void
+acct_traverse_descendants (Account *acct, AccountProc fn)
+{
+    fn (acct);
+    if (xaccAccountGetReconcileChildrenStatus (acct))
+        gnc_account_foreach_descendant (acct, (AccountCb)traverse_fn, fn);
+}
 
 /********************************************************************\
  * recnFinishCB                                                     *
@@ -2288,10 +2301,10 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
     recnData->delete_refresh = TRUE;
     account = recn_get_account (recnData);
 
-    xaccAccountBeginEdit (account);
+    acct_traverse_descendants (account, xaccAccountBeginEdit);
     gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->credit), date);
     gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->debit), date);
-    xaccAccountCommitEdit (account);
+    acct_traverse_descendants (account, xaccAccountCommitEdit);
 
     auto_payment = gnc_prefs_get_bool(GNC_PREFS_GROUP_RECONCILE, GNC_PREF_AUTO_CC_PAYMENT);
 
@@ -2344,10 +2357,10 @@ recnPostponeCB (GtkAction *action, gpointer data)
     recnData->delete_refresh = TRUE;
     account = recn_get_account (recnData);
 
-    xaccAccountBeginEdit (account);
+    acct_traverse_descendants (account, xaccAccountBeginEdit);
     gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->credit));
     gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->debit));
-    xaccAccountCommitEdit (account);
+    acct_traverse_descendants (account, xaccAccountCommitEdit);
 
     xaccAccountSetReconcilePostponeDate (account, recnData->statement_date);
     xaccAccountSetReconcilePostponeBalance (account, recnData->new_ending);

commit 490f646dc3048cc3e8457fc84cdb391aaa24e983
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jan 1 13:24:48 2022 +0800

    Addendum to fd3ec14f6 optionally raises descendants' editlevel

diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index bffe43cd9..a76b347bf 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -2257,6 +2257,19 @@ find_payment_account(Account *account)
     return NULL;
 }
 
+typedef void (*AccountProc) (Account *a);
+static void traverse_fn (Account *acct, AccountProc fn)
+{
+    fn (acct);
+}
+
+static void
+acct_traverse_descendants (Account *acct, AccountProc fn)
+{
+    fn (acct);
+    if (xaccAccountGetReconcileChildrenStatus (acct))
+        gnc_account_foreach_descendant (acct, (AccountCb)traverse_fn, fn);
+}
 
 /********************************************************************\
  * recnFinishCB                                                     *
@@ -2288,10 +2301,10 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
     recnData->delete_refresh = TRUE;
     account = recn_get_account (recnData);
 
-    xaccAccountBeginEdit (account);
+    acct_traverse_descendants (account, xaccAccountBeginEdit);
     gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->credit), date);
     gnc_reconcile_view_commit(GNC_RECONCILE_VIEW(recnData->debit), date);
-    xaccAccountCommitEdit (account);
+    acct_traverse_descendants (account, xaccAccountCommitEdit);
 
     auto_payment = gnc_prefs_get_bool(GNC_PREFS_GROUP_RECONCILE, GNC_PREF_AUTO_CC_PAYMENT);
 
@@ -2344,10 +2357,10 @@ recnPostponeCB (GtkAction *action, gpointer data)
     recnData->delete_refresh = TRUE;
     account = recn_get_account (recnData);
 
-    xaccAccountBeginEdit (account);
+    acct_traverse_descendants (account, xaccAccountBeginEdit);
     gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->credit));
     gnc_reconcile_view_postpone (GNC_RECONCILE_VIEW(recnData->debit));
-    xaccAccountCommitEdit (account);
+    acct_traverse_descendants (account, xaccAccountCommitEdit);
 
     xaccAccountSetReconcilePostponeDate (account, recnData->statement_date);
     xaccAccountSetReconcilePostponeBalance (account, recnData->new_ending);



Summary of changes:
 gnucash/gnome/window-reconcile.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list