Fix bug loading example accounts into gui.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5462 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-10-03 22:11:06 +00:00
parent 6bb6d59903
commit 891ac0e2b6
2 changed files with 12 additions and 3 deletions

View File

@ -1187,8 +1187,6 @@ AccountGroup *
xaccAccountGetChildren (Account *acc)
{
if (!acc) return NULL;
if (acc->children == NULL)
xaccAccountInsertSubAccount (acc, NULL);
return (acc->children);
}

View File

@ -572,6 +572,7 @@ clone_account (const Account* from, gnc_commodity *com)
struct add_group_data_struct
{
AccountGroup *to;
Account *parent;
gnc_commodity *com;
};
@ -586,7 +587,15 @@ add_groups_for_each (Account *toadd, gpointer data)
if (!foundact)
{
foundact = clone_account (toadd, dadata->com);
if (dadata->to)
xaccGroupInsertAccount (dadata->to, foundact);
else if (dadata->parent)
xaccAccountInsertSubAccount (dadata->parent, foundact);
else
{
g_warning ("add_groups_for_each: no valid parent");
}
}
{
@ -597,6 +606,7 @@ add_groups_for_each (Account *toadd, gpointer data)
struct add_group_data_struct downdata;
downdata.to = xaccAccountGetChildren(foundact);
downdata.parent = foundact;
downdata.com = dadata->com;
xaccGroupForEachAccount (addgrp, add_groups_for_each,
@ -613,6 +623,7 @@ add_groups_to_with_random_guids (AccountGroup *into, AccountGroup *from,
{
struct add_group_data_struct data;
data.to = into;
data.parent = NULL;
data.com = com;
xaccGroupForEachAccount (from, add_groups_for_each, &data, FALSE);