Begin the GObjectification of the Account object. Move some

properties from the public data structure to a private data
structure, and enable access to them as properties of the object.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15885 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2007-04-14 16:01:55 +00:00
parent 8adf99bf51
commit 6536479c48
7 changed files with 692 additions and 252 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,35 +57,6 @@ struct account_s
{
QofInstance inst;
/* The accountName is an arbitrary string assigned by the user.
* It is intended to a short, 5 to 30 character long string that
* is displayed by the GUI as the account mnemonic.
*/
char *accountName;
/* The accountCode is an arbitrary string assigned by the user.
* It is intended to be reporting code that is a synonym for the
* accountName. Typically, it will be a numeric value that follows
* the numbering assignments commonly used by accountants, such
* as 100, 200 or 600 for top-level accounts, and 101, 102.. etc.
* for detail accounts.
*/
char *accountCode;
/* The description is an arbitrary string assigned by the user.
* It is intended to be a longer, 1-5 sentence description of what
* this account is all about.
*/
char *description;
/* The type field is the account type, picked from the enumerated
* list that includes ACCT_TYPE_BANK, ACCT_TYPE_STOCK,
* ACCT_TYPE_CREDIT, ACCT_TYPE_INCOME, etc. Its intended use is to
* be a hint to the GUI as to how to display and format the
* transaction data.
*/
GNCAccountType type;
/*
* The commodity field denotes the kind of 'stuff' stored
* in this account. The 'amount' field of a split indicates
@ -95,12 +66,6 @@ struct account_s
int commodity_scu;
gboolean non_standard_scu;
/* The parent and children pointers are used to implement an account
* hierarchy, of accounts that have sub-accounts ("detail accounts").
*/
Account *parent; /* back-pointer to parent */
GList *children; /* list of sub-accounts */
/* protected data, cached parameters */
gnc_numeric starting_balance;
gnc_numeric starting_cleared_balance;

View File

@ -761,7 +761,7 @@ add_closing_balances (Account *parent,
if (gnc_account_n_children(candidate) > 0)
{
PINFO ("add closing baln to subaccts of %s",
candidate->description);
xaccAccountGetDescription(candidate));
add_closing_balances (candidate, open_book, closed_book,
equity_account,
post_date, date_entered, desc);

View File

@ -606,7 +606,8 @@ xaccTransScrubCurrency (Transaction *trans)
else
{
PWARN (" split=\"%s\" account=\"%s\" commodity=\"%s\"",
split->memo, split->acc->accountName, gnc_commodity_get_mnemonic (split->acc->commodity));
split->memo, xaccAccountGetName(split->acc),
gnc_commodity_get_mnemonic(xaccAccountGetCommodity(split->acc)));
}
}
}
@ -691,7 +692,8 @@ xaccAccountScrubCommodity (Account *account)
return;
}
PERR ("Account \"%s\" does not have a commodity!", account->accountName);
PERR ("Account \"%s\" does not have a commodity!",
xaccAccountGetName(account));
}
/* ================================================================ */

View File

@ -61,7 +61,7 @@ xaccAccountAssignLots (Account *acc)
if (!acc) return;
ENTER ("acc=%s", acc->accountName);
ENTER ("acc=%s", xaccAccountGetName(acc));
xaccAccountBeginEdit (acc);
restart_loop:
@ -79,7 +79,7 @@ restart_loop:
if (xaccSplitAssign (split)) goto restart_loop;
}
xaccAccountCommitEdit (acc);
LEAVE ("acc=%s", acc->accountName);
LEAVE ("acc=%s", xaccAccountGetName(acc));
}
/* ============================================================== */
@ -102,7 +102,7 @@ xaccLotFill (GNCLot *lot)
acc = lot->account;
pcy = acc->policy;
ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName(acc));
/* If balance already zero, we have nothing to do. */
if (gnc_lot_is_closed (lot)) return;
@ -140,7 +140,7 @@ xaccLotFill (GNCLot *lot)
if (!split) break;
}
xaccAccountCommitEdit (acc);
LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName(acc));
}
/* ============================================================== */

View File

@ -160,7 +160,7 @@ xaccAccountScrubLots (Account *acc)
if (!acc) return;
if (FALSE == xaccAccountHasTrades (acc)) return;
ENTER ("(acc=%s)", acc->accountName);
ENTER ("(acc=%s)", xaccAccountGetName(acc));
xaccAccountBeginEdit(acc);
xaccAccountAssignLots (acc);
@ -170,7 +170,7 @@ xaccAccountScrubLots (Account *acc)
xaccScrubLot (lot);
}
xaccAccountCommitEdit(acc);
LEAVE ("(acc=%s)", acc->accountName);
LEAVE ("(acc=%s)", xaccAccountGetName(acc));
}
/* ============================================================== */

View File

@ -358,7 +358,7 @@ main_window_to_account (GncMainWindow *window)
} else {
account = NULL;
}
account_name = xaccAccountGetName (account);
account_name = account ? xaccAccountGetName(account) : NULL;
LEAVE("account %s(%p)", account_name ? account_name : "(null)", account);
return account;
}