Add some additional places where Check&Repair can be aborted

This commit is contained in:
Robert Fewell 2020-10-20 14:43:39 +01:00
parent 6ee537e1a7
commit 122cd682f6
2 changed files with 21 additions and 0 deletions

View File

@ -84,6 +84,10 @@ void
xaccAccountTreeScrubOrphans (Account *acc, QofPercentageFunc percentagefunc)
{
if (!acc) return;
if (abort_now)
(percentagefunc)(NULL, -1.0);
scrub_depth ++;
xaccAccountScrubOrphans (acc, percentagefunc);
gnc_account_foreach_descendant(acc,
@ -320,6 +324,11 @@ xaccSplitScrub (Split *split)
void
xaccAccountTreeScrubImbalance (Account *acc, QofPercentageFunc percentagefunc)
{
if (!acc) return;
if (abort_now)
(percentagefunc)(NULL, -1.0);
scrub_depth++;
xaccAccountScrubImbalance (acc, percentagefunc);
gnc_account_foreach_descendant(acc,

View File

@ -38,6 +38,7 @@
#include "Account.h"
#include "gncInvoice.h"
#include "gncInvoiceP.h"
#include "Scrub.h"
#include "Scrub2.h"
#include "ScrubBusiness.h"
#include "Transaction.h"
@ -614,6 +615,10 @@ gncScrubBusinessAccountLots (Account *acc, QofPercentageFunc percentagefunc)
const char *message = _( "Checking business lots in account %s: %u of %u");
if (!acc) return;
if (gnc_get_abort_scrub())
(percentagefunc)(NULL, -1.0);
if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
str = xaccAccountGetName(acc);
@ -664,6 +669,10 @@ gncScrubBusinessAccountSplits (Account *acc, QofPercentageFunc percentagefunc)
const char *message = _( "Checking business splits in account %s: %u of %u");
if (!acc) return;
if (gnc_get_abort_scrub())
(percentagefunc)(NULL, -1.0);
if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
str = xaccAccountGetName(acc);
@ -684,6 +693,9 @@ restart:
PINFO("Start processing split %d of %d",
curr_split_no + 1, split_count);
if (gnc_get_abort_scrub ())
break;
if (curr_split_no % 100 == 0)
{
char *progress_msg = g_strdup_printf (message, str, curr_split_no, split_count);