gnucash maint: [Scrub.c] improve responsiveness of progressbar during scrub

Christopher Lam clam at code.gnucash.org
Sun Sep 6 10:55:04 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/f6d34f22 (commit)
	from  https://github.com/Gnucash/gnucash/commit/99101c19 (commit)



commit f6d34f226f7cc0be8918b48f441ca97da9b98ea0
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Sep 6 22:52:13 2020 +0800

    [Scrub.c] improve responsiveness of progressbar during scrub
    
    Formerly would update progress bar every 100 splits. With scrub being
    slow, it's nicer to update every 10 splits. Also remove
    the (percentagefunc)(NULL, 0.0) which seems an error -- it would reset
    the progressbar back to zero immediately.

diff --git a/libgnucash/engine/Scrub.c b/libgnucash/engine/Scrub.c
index 9efb9e93c..a16c0cf91 100644
--- a/libgnucash/engine/Scrub.c
+++ b/libgnucash/engine/Scrub.c
@@ -137,7 +137,7 @@ xaccAccountScrubOrphans (Account *acc, QofPercentageFunc percentagefunc)
     for (node = splits; node; node = node->next)
     {
         Split *split = node->data;
-        if (current_split % 100 == 0)
+        if (current_split % 10 == 0)
         {
             char *progress_msg = g_strdup_printf (message, str, current_split, total_splits);
             (percentagefunc)(progress_msg, (100 * current_split) / total_splits);
@@ -347,7 +347,7 @@ xaccAccountScrubImbalance (Account *acc, QofPercentageFunc percentagefunc)
         PINFO("Start processing split %d of %d",
               curr_split_no + 1, split_count);
 
-        if (curr_split_no % 100 == 0)
+        if (curr_split_no % 10 == 0)
         {
             char *progress_msg = g_strdup_printf (message, str, curr_split_no, split_count);
             (percentagefunc)(progress_msg, (100 * curr_split_no) / split_count);
@@ -356,7 +356,6 @@ xaccAccountScrubImbalance (Account *acc, QofPercentageFunc percentagefunc)
 
         TransScrubOrphansFast (xaccSplitGetParent (split),
                                gnc_account_get_root (acc));
-        (percentagefunc)(NULL, 0.0);
 
         xaccTransScrubCurrency(trans);
 



Summary of changes:
 libgnucash/engine/Scrub.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list