22 #include "gnc-account-merge.h" 25 GncAccountMergeDisposition
26 determine_account_merge_disposition(
Account *existing_acct,
Account *new_acct)
28 g_assert(new_acct != NULL);
30 if (existing_acct == NULL)
31 return GNC_ACCOUNT_MERGE_DISPOSITION_CREATE_NEW;
33 return GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING;
36 GncAccountMergeDisposition
37 determine_merge_disposition(
Account *existing_root,
Account *new_acct)
46 return determine_account_merge_disposition(existing_acct, new_acct);
50 account_trees_merge(
Account *existing_root,
Account *new_accts_root)
52 GList *accounts, *node;
53 g_return_if_fail(new_accts_root != NULL);
54 g_return_if_fail(existing_root != NULL);
60 for (node = accounts; node; node = g_list_next(node))
62 Account *existing_named, *new_acct;
65 new_acct = (
Account*)node->data;
68 switch (determine_account_merge_disposition(existing_named, new_acct))
70 case GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING:
72 account_trees_merge(existing_named, new_acct);
74 case GNC_ACCOUNT_MERGE_DISPOSITION_CREATE_NEW:
80 g_list_free(accounts);
void gnc_account_append_child(Account *new_parent, Account *child)
This function will remove from the child account any pre-existing parent relationship, and will then add the account as a child of the new parent.
Account * gnc_account_lookup_by_name(const Account *parent, const char *name)
The gnc_account_lookup_by_name() subroutine fetches the account by name from the descendants of the s...
gchar * gnc_account_get_full_name(const Account *account)
The gnc_account_get_full_name routine returns the fully qualified name of the account using the given...
Account handling public routines.
Account * gnc_account_lookup_by_full_name(const Account *any_acc, const gchar *name)
The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses fully-qualified names using the given separator.
GList * gnc_account_get_children(const Account *account)
This routine returns a GList of all children accounts of the specified account.
const char * xaccAccountGetName(const Account *acc)
Get the account's name.