mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
[gnc-plugin-page-account-tree.cpp] use c++ algo
This commit is contained in:
parent
6790430ee8
commit
2902f1de0f
@ -34,6 +34,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include "gnc-plugin-page-account-tree.h"
|
||||
@ -1149,21 +1151,11 @@ static gpointer
|
||||
delete_account_helper (Account * account, gpointer data)
|
||||
{
|
||||
auto helper_res = static_cast<delete_helper_t*>(data);
|
||||
auto splits{xaccAccountGetSplits (account)};
|
||||
auto& splits{xaccAccountGetSplits (account)};
|
||||
auto split_ro = [](auto s) -> bool { return xaccTransGetReadOnly (xaccSplitGetParent (s)); };
|
||||
|
||||
if (!splits.empty())
|
||||
{
|
||||
helper_res->has_splits = TRUE;
|
||||
for (auto s : splits)
|
||||
{
|
||||
Transaction *txn = xaccSplitGetParent (s);
|
||||
if (xaccTransGetReadOnly (txn))
|
||||
{
|
||||
helper_res->has_ro_splits = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
helper_res->has_splits = !splits.empty();
|
||||
helper_res->has_ro_splits = std::any_of (splits.begin(), splits.end(), split_ro);
|
||||
|
||||
return GINT_TO_POINTER (helper_res->has_splits || helper_res->has_ro_splits);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user