use xaccAccountGetSplitsSize

This commit is contained in:
Christopher Lam
2024-04-14 16:20:37 +08:00
parent f70ee754fc
commit 606da28d25
3 changed files with 6 additions and 7 deletions

View File

@@ -247,7 +247,7 @@ gnc_account_opening_balance_button_update (AccountWindow *aw, gnc_commodity *com
{
Account *account = aw_get_account (aw);
Account *ob_account = gnc_account_lookup_by_opening_balance (gnc_book_get_root_account (aw->book), commodity);
gboolean has_splits = (xaccAccountGetSplitList (account) != NULL);
gboolean has_splits = (xaccAccountGetSplitsSize (account) != 0);
if (aw->type != ACCT_TYPE_EQUITY)
{
@@ -1614,7 +1614,7 @@ gnc_account_window_create (GtkWindow *parent, AccountWindow *aw)
gtk_box_pack_start (GTK_BOX(box), aw->commodity_edit, TRUE, TRUE, 0);
gtk_widget_show (aw->commodity_edit);
// If the account has transactions, prevent changes by displaying a label and tooltip
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
if (xaccAccountGetSplitsSize (aw_get_account (aw)) != 0)
{
gtk_widget_set_tooltip_text (aw->commodity_edit, tt);
gtk_widget_set_sensitive (aw->commodity_edit, FALSE);
@@ -1714,7 +1714,7 @@ gnc_account_window_create (GtkWindow *parent, AccountWindow *aw)
// immutable if gnucash depends on details that would be lost/missing
// if changing from/to such a type. At the time of this writing the
// immutable types are AR, AP and trading types.
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
if (xaccAccountGetSplitsSize (aw_get_account (aw)) != 0)
{
GNCAccountType atype = xaccAccountGetType (aw_get_account (aw));
compat_types = xaccAccountTypesCompatibleWith (atype);
@@ -2128,7 +2128,7 @@ gnc_ui_edit_account_window (GtkWindow *parent, Account *account)
gnc_resume_gui_refresh ();
gtk_widget_show_all (aw->dialog);
if (xaccAccountGetSplitList (account) != NULL)
if (xaccAccountGetSplitsSize (account) != 0)
gtk_widget_hide (aw->opening_balance_page);
parent_acct = gnc_account_get_parent (account);

View File

@@ -695,7 +695,7 @@ gncScrubBusinessAccountSplits (Account *acc, QofPercentageFunc percentagefunc)
restart:
curr_split_no = 0;
splits = xaccAccountGetSplitList(acc);
split_count = g_list_length (splits);
split_count = xaccAccountGetSplitsSize (acc);
for (node = splits; node; node = node->next)
{
Split *split = node->data;

View File

@@ -329,8 +329,7 @@ test_invoice_doclink ( Fixture *fixture, gconstpointer pData )
static gboolean account_has_one_split (const Account *acc)
{
GList *splits = xaccAccountGetSplitList (acc);
return (splits && !(splits->next));
return (xaccAccountGetSplitsSize (acc) == 1);
}
static void