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