Move the storage for the account separator character into Account.c

(default ':') and set it with an accessor function at startup and when
it is changed in the preferences/gconf.  Eliminate unnecessary passing
around of the account separator character.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13435 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2006-03-02 07:20:33 +00:00
parent cbedb5a5e9
commit bf46ee7847
42 changed files with 133 additions and 137 deletions

View File

@@ -1,3 +1,11 @@
2006-03-02 David Hampton <hampton@employees.org>
* numerous: Move the storage for the account separator character
into Account.c (default ':') and set it with an accessor function
at startup and when it is changed in the preferences/gconf.
Eliminate unnecessary passing around of the account separator
character.
2006-03-01 David Hampton <hampton@employees.org>
* src/register/register-core/pricecell.c:

View File

@@ -18,12 +18,11 @@ determine_account_merge_disposition(Account *existing_acct, Account *new_acct)
GncAccountMergeDisposition
determine_merge_disposition(AccountGroup *existing_root, Account *new_acct)
{
const char sep_char = '.';
Account *existing_acct;
gchar *full_name;
full_name = xaccAccountGetFullName(new_acct, sep_char);
existing_acct = xaccGetAccountFromFullName(existing_root, full_name, sep_char);
full_name = xaccAccountGetFullName(new_acct);
existing_acct = xaccGetAccountFromFullName(existing_root, full_name);
g_free(full_name);
return determine_account_merge_disposition(existing_acct, new_acct);

View File

@@ -50,6 +50,7 @@
#define KEY_CURRENCY_CHOICE "currency_choice"
#define KEY_CURRENCY_OTHER "currency_other"
#define KEY_REVERSED_ACCOUNTS "reversed_accounts"
static QofLogModule log_module = GNC_MOD_GUI;
@@ -66,8 +67,8 @@ static gboolean reverse_type[NUM_ACCOUNT_TYPES];
* Args: none *
* Returns: account separator character *
\*******************************************************************/
char
gnc_get_account_separator (void)
static void
gnc_configure_account_separator (void)
{
char separator = ':';
char *string;
@@ -88,7 +89,7 @@ gnc_get_account_separator (void)
if (string != NULL)
free(string);
return separator;
gnc_set_account_separator(separator);
}
@@ -101,7 +102,7 @@ gnc_configure_reverse_balance (void)
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
reverse_type[i] = FALSE;
choice = gnc_gconf_get_string(GCONF_GENERAL, "reversed_accounts", NULL);
choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_REVERSED_ACCOUNTS, NULL);
if (safe_strcmp (choice, "none") == 0)
{
@@ -706,7 +707,7 @@ gnc_account_get_full_name (const Account *account)
{
if (!account) return NULL;
return xaccAccountGetFullName (account, gnc_get_account_separator ());
return xaccAccountGetFullName (account);
}
static void
@@ -2042,7 +2043,11 @@ gnc_set_auto_decimal_places (GConfEntry *entry, gpointer user_data)
void
gnc_ui_util_init (void)
{
gnc_gconf_general_register_cb("reversed_accounts",
gnc_configure_account_separator ();
gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
(GncGconfGeneralCb)gnc_configure_account_separator,
NULL);
gnc_gconf_general_register_cb(KEY_REVERSED_ACCOUNTS,
(GncGconfGeneralCb)gnc_configure_reverse_balance,
NULL);
gnc_gconf_general_register_cb("auto_decimal_point",

View File

@@ -45,12 +45,6 @@
typedef QofSession * (*QofSessionCB) (void);
/** Returns the account separation character chosen by the user.
*
* @return The character to use.
*/
char gnc_get_account_separator (void);
gboolean gnc_reverse_balance(const Account *account);
gboolean gnc_reverse_balance_type(GNCAccountType type);

View File

@@ -663,9 +663,8 @@ int gncTaxTableEntryCompare (GncTaxTableEntry *a, GncTaxTableEntry *b)
if (!a) return -1;
if (!b) return 1;
name_a = xaccAccountGetFullName (a->account, ':');
name_b = xaccAccountGetFullName (b->account, ':');
/* for comparison purposes it doesn't matter what we use as a separator */
name_a = xaccAccountGetFullName (a->account);
name_b = xaccAccountGetFullName (b->account);
retval = safe_strcmp(name_a, name_b);
g_free(name_a);
g_free(name_b);

View File

@@ -327,7 +327,7 @@ gnc_fill_account_select_combo (GtkWidget *combo, GNCBook *book,
== -1)
continue;
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
if (name != NULL) {
names = g_list_append (names, name);
if (!safe_strcmp (name, text))

View File

@@ -1455,7 +1455,7 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget)
ts = gncInvoiceGetDatePosted (invoice);
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->posted_date), ts);
tmp_string = xaccAccountGetFullName (acct, gnc_get_account_separator ());
tmp_string = xaccAccountGetFullName (acct);
gtk_entry_set_text (GTK_ENTRY (acct_entry), tmp_string);
g_free(tmp_string);

View File

@@ -253,8 +253,7 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
return;
}
post = xaccGetAccountFromFullName (gnc_book_get_group (pw->book),
text, gnc_get_account_separator ());
post = xaccGetAccountFromFullName (gnc_book_get_group (pw->book), text);
if (!post) {
char *msg = g_strdup_printf (

View File

@@ -88,8 +88,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
Account *account;
/* Find the account */
account = xaccGetAccountFromFullName (gnc_get_current_group (),
name, gnc_get_account_separator ());
account = xaccGetAccountFromFullName (gnc_get_current_group (), name);
if (!account) {
/* Ask if they want to create a new one. */
@@ -106,7 +105,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
*new = TRUE;
/* Now have a new account. Update the cell with the name as created. */
fullname = xaccAccountGetFullName (account, gnc_get_account_separator ());
fullname = xaccAccountGetFullName (account);
gnc_combo_cell_set_value (cell, fullname);
gnc_basic_cell_set_changed (&cell->cell, TRUE);
g_free (fullname);

View File

@@ -219,7 +219,7 @@ load_entry_xfer_cell_cb (Account *account, gpointer data)
if (xaccAccountGetPlaceholder (account)) return NULL;
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
if (NULL == name) return NULL;
gnc_combo_cell_add_menu_item (bce->cell, name);
g_free(name);

View File

@@ -157,8 +157,7 @@ static const char * get_iacct_entry (VirtualLocation virt_loc,
entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
g_free (name);
name = xaccAccountGetFullName (gncEntryGetInvAccount (entry),
gnc_get_account_separator ());
name = xaccAccountGetFullName (gncEntryGetInvAccount (entry));
return name;
}
@@ -175,8 +174,7 @@ static const char * get_bacct_entry (VirtualLocation virt_loc,
entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
g_free (name);
name = xaccAccountGetFullName (gncEntryGetBillAccount (entry),
gnc_get_account_separator ());
name = xaccAccountGetFullName (gncEntryGetBillAccount (entry));
return name;
}

View File

@@ -365,7 +365,7 @@ tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table)
Account *acc = gncTaxTableEntryGetAccount (entry);
gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
row_text[0] = xaccAccountGetFullName (acc, gnc_get_account_separator ());
row_text[0] = xaccAccountGetFullName (acc);
switch (gncTaxTableEntryGetType (entry)) {
case GNC_AMT_TYPE_PERCENT:
row_text[1] =

View File

@@ -40,6 +40,9 @@
static QofLogModule log_module = GNC_MOD_ACCOUNT;
/* The Canonical Account Separator. Pre-Initialized. */
static char account_separator = ':';
/********************************************************************\
* Because I can't use C++ for this project, doesn't mean that I *
* can't pretend to! These functions perform actions on the *
@@ -49,6 +52,26 @@ static QofLogModule log_module = GNC_MOD_ACCOUNT;
static void xaccAccountBringUpToDate (Account *acc);
/********************************************************************\
* gnc_get_account_separator *
* returns the current account separator character *
* *
* Args: none *
* Returns: account separator character *
\*******************************************************************/
char
gnc_get_account_separator (void)
{
return account_separator;
}
void
gnc_set_account_separator (char separator)
{
account_separator = separator;
}
/********************************************************************\
\********************************************************************/
@@ -1408,7 +1431,7 @@ xaccAccountGetName (const Account *acc)
}
char *
xaccAccountGetFullName(const Account *account, const char separator)
xaccAccountGetFullName(const Account *account)
{
const Account *a;
char *fullname;
@@ -1456,7 +1479,7 @@ xaccAccountGetFullName(const Account *account, const char separator)
/* if we're not at the root, add another separator */
if (a != NULL)
*p-- = separator;
*p-- = account_separator;
}
return fullname;

View File

@@ -179,6 +179,13 @@ int xaccAccountOrder (const Account **account_1, const Account **account_2);
/** @name Account lookup and GUID routines
@{ */
/** Returns the account separation character chosen by the user.
*
* @return The character to use.
*/
char gnc_get_account_separator (void);
void gnc_set_account_separator (char separator);
/** @deprecated */
#define xaccAccountGetBook(X) qof_instance_get_book(QOF_INSTANCE(X))
#define xaccAccountGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
@@ -236,7 +243,7 @@ const char * xaccAccountGetLastNum (const Account *account);
* hack alert -- since it breaks the rule of string allocation, maybe this
* routine should not be in this library, but some utility library?
*/
char * xaccAccountGetFullName (const Account *account, const char separator);
char * xaccAccountGetFullName (const Account *account);
/** Set a string that identifies the Finance::Quote backend that
* should be used to retrieve online prices. See price-quotes.scm

View File

@@ -500,12 +500,12 @@ xaccGetAccountFromName (const AccountGroup *grp, const char * name)
Account *
xaccGetAccountFromFullName (const AccountGroup *grp,
const char *name,
const char separator)
const char *name)
{
GList *node;
Account *found;
char *p;
char separator;
if (!grp) return NULL;
if (!name) return NULL;
@@ -513,6 +513,8 @@ xaccGetAccountFromFullName (const AccountGroup *grp,
p = (char *) name;
found = NULL;
separator = gnc_get_account_separator();
while (1)
{
/* Look for the first separator. */
@@ -539,8 +541,7 @@ xaccGetAccountFromFullName (const AccountGroup *grp,
/* There's stuff left to search for.
* Search recursively after the separator. */
found = xaccGetAccountFromFullName(account->children,
p + 1, separator);
found = xaccGetAccountFromFullName(account->children, p + 1);
/* If we found the account, break out. */
if (found != NULL)
@@ -599,8 +600,7 @@ xaccGetPeerAccountFromName (const Account *acc, const char * name)
\********************************************************************/
Account *
xaccGetPeerAccountFromFullName (const Account *acc, const char * name,
const char separator)
xaccGetPeerAccountFromFullName (const Account *acc, const char * name)
{
AccountGroup * root;
Account *peer_acc;
@@ -612,7 +612,7 @@ xaccGetPeerAccountFromFullName (const Account *acc, const char * name,
root = xaccAccountGetRoot (acc);
/* now search all acounts hanging off the root */
peer_acc = xaccGetAccountFromFullName (root, name, separator);
peer_acc = xaccGetAccountFromFullName (root, name);
return peer_acc;
}

View File

@@ -236,8 +236,7 @@ Account *xaccGetAccountFromName (const AccountGroup *group, const char *name);
* using the given separator.
*/
Account *xaccGetAccountFromFullName (const AccountGroup *group,
const char *name,
const char separator);
const char *name);
/** The xaccGetPeerAccountFromName() subroutine fetches the
* account by name from the collection of accounts
@@ -251,8 +250,7 @@ Account *xaccGetPeerAccountFromName (const Account *account, const char *name);
* names using the given separator.
*/
Account *xaccGetPeerAccountFromFullName (const Account *acc,
const char * name,
const char separator);
const char * name);
/** @} */

View File

@@ -1118,7 +1118,7 @@ xaccSplitGetCorrAccountName(const Split *sa)
}
char *
xaccSplitGetCorrAccountFullName(const Split *sa, char separator)
xaccSplitGetCorrAccountFullName(const Split *sa)
{
static const char *split_const = NULL;
const Split *other_split;
@@ -1130,7 +1130,7 @@ xaccSplitGetCorrAccountFullName(const Split *sa, char separator)
return g_strdup(split_const);
}
return xaccAccountGetFullName(other_split->acc, separator);
return xaccAccountGetFullName(other_split->acc);
}
const char *
@@ -1162,9 +1162,8 @@ xaccSplitCompareAccountFullNames(const Split *sa, const Split *sb)
aa = sa->acc;
ab = sb->acc;
full_a = xaccAccountGetFullName(aa, ':');
full_b = xaccAccountGetFullName(ab, ':');
/* for comparison purposes it doesn't matter what we use as a separator */
full_a = xaccAccountGetFullName(aa);
full_b = xaccAccountGetFullName(ab);
retval = safe_strcmp(full_a, full_b);
g_free(full_a);
g_free(full_b);
@@ -1199,8 +1198,8 @@ xaccSplitCompareOtherAccountFullNames(const Split *sa, const Split *sb)
* as long as they are the same
*/
ca = xaccSplitGetCorrAccountFullName(sa, ':');
cb = xaccSplitGetCorrAccountFullName(sb, ':');
ca = xaccSplitGetCorrAccountFullName(sa);
cb = xaccSplitGetCorrAccountFullName(sb);
retval = safe_strcmp(ca, cb);
g_free(ca);
g_free(cb);

View File

@@ -396,7 +396,7 @@ int xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb);
* is silly.
*/
char * xaccSplitGetCorrAccountFullName(const Split *sa, char seperator);
char * xaccSplitGetCorrAccountFullName(const Split *sa);
/** document me */
const char * xaccSplitGetCorrAccountName(const Split *sa);
/** document me */

View File

@@ -1722,14 +1722,13 @@ xaccGetAccountByName (const Transaction *trans, const char * name)
\********************************************************************/
Account *
xaccGetAccountByFullName (const Transaction *trans, const char * name,
const char separator)
xaccGetAccountByFullName (const Transaction *trans, const char * name)
{
Account *acc;
if (!trans || !name) return NULL;
acc = get_any_account(trans);
return acc ? xaccGetPeerAccountFromFullName (acc, name, separator) : NULL;
return acc ? xaccGetPeerAccountFromFullName (acc, name) : NULL;
}
/********************************************************************\

View File

@@ -442,8 +442,7 @@ Account * xaccGetAccountByName (const Transaction *trans, const char *name);
/** The xaccGetAccountByFullName routine is similar to xaccGetAccountByName, but uses
* full names using the given separator.*/
Account * xaccGetAccountByFullName (const Transaction *trans,
const char *name,
const char separator);
const char *name);
/** @name Transaction voiding

View File

@@ -452,7 +452,7 @@ its account")
'gnc:split-get-corr-account-full-name-internal
'(<gw:gchars> caller-owned)
"xaccSplitGetCorrAccountFullName"
'((<gnc:Split*> sa) (<gw:char> separator))
'((<gnc:Split*> sa))
"Find the split on the other side of the transaction, and return the
name of its account. Don't use directly, use
gnc:split-get-corr-account-full-name in src/scm/report-utilities.scm")
@@ -1065,8 +1065,7 @@ group")
'<gnc:Account*>
"xaccGetAccountFromFullName"
'((<gnc:AccountGroup*> g)
((<gw:mchars> caller-owned const) name)
(<gw:char> separator))
((<gw:mchars> caller-owned const) name))
"Return account named name in group g. full path with separators.")
(gw:wrap-function

View File

@@ -93,7 +93,7 @@ listen_for_account_events (GUID *guid, QofIdType type,
if (skip) return;
}
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
if (NULL == name) return;
match = gnc_quickfill_get_string_match (qf, name);
@@ -125,7 +125,7 @@ load_shared_qf_cb (Account *account, gpointer data)
if (skip) return NULL;
}
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
if (NULL == name) return NULL;
gnc_quickfill_insert (qfb->qf, name, QUICKFILL_ALPHA);
g_free(name);

View File

@@ -552,7 +552,7 @@ fill_helper(gpointer key, gpointer value, gpointer data)
if (fs == NULL) return;
if (fs->account == account) return;
full_name = xaccAccountGetFullName(account, gnc_get_account_separator());
full_name = xaccAccountGetFullName(account);
if(!full_name)
full_name = g_strdup("");
@@ -744,15 +744,15 @@ gnc_common_ok (AccountWindow *aw)
parent = gnc_tree_view_account_get_selected_account
(GNC_TREE_VIEW_ACCOUNT (aw->parent_tree));
if (parent == NULL) {
account = xaccGetAccountFromFullName(group, name, separator);
account = xaccGetAccountFromFullName(group, name);
} else {
sep_string[0] = separator;
sep_string[1] = '\0';
fullname_parent = xaccAccountGetFullName(parent, separator);
fullname_parent = xaccAccountGetFullName(parent);
fullname = g_strconcat(fullname_parent, sep_string, name, NULL);
account = xaccGetAccountFromFullName(group, fullname, separator);
account = xaccGetAccountFromFullName(group, fullname);
g_free(fullname_parent);
g_free(fullname);
@@ -1349,8 +1349,7 @@ get_ui_fullname (AccountWindow *aw)
char *parent_name;
char sep_string[2];
parent_name = xaccAccountGetFullName (parent_account,
gnc_get_account_separator());
parent_name = xaccAccountGetFullName (parent_account);
sep_string[0] = gnc_get_account_separator ();
sep_string[1] = '\0';
@@ -1561,7 +1560,7 @@ gnc_split_account_name (const char *in_name, Account **base_account)
Account *account;
char *p;
account = xaccGetAccountFromFullName (group, name, separator);
account = xaccGetAccountFromFullName (group, name);
if (account)
{
*base_account = account;

View File

@@ -1384,11 +1384,9 @@ gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
char *name;
if (xaccAccountGetPlaceholder(from_account))
name = xaccAccountGetFullName(from_account,
gnc_get_account_separator ());
name = xaccAccountGetFullName(from_account);
else
name = xaccAccountGetFullName(to_account,
gnc_get_account_separator ());
name = xaccAccountGetFullName(to_account);
gnc_error_dialog(xferData->dialog, placeholder_format, name);
g_free(name);
LEAVE("placeholder");

View File

@@ -165,7 +165,6 @@ gnc_account_sel_init (GNCAccountSel *gas)
typedef struct {
GNCAccountSel *gas;
GList **outList;
char accountSep;
} accounts_to_names_data;
/**
@@ -203,7 +202,6 @@ gas_populate_list( GNCAccountSel *gas )
nameList = NULL;
atnd.gas = gas;
atnd.outList = &nameList;
atnd.accountSep = gnc_get_account_separator();
g_list_foreach( accts, gas_accounts_to_names,
(gpointer)&atnd );
@@ -266,8 +264,7 @@ gas_accounts_to_names( gpointer data, gpointer user_data )
}
}
*atnd->outList =
g_list_append( *atnd->outList,
xaccAccountGetFullName(a, atnd->accountSep) );
g_list_append( *atnd->outList, xaccAccountGetFullName(a) );
}
#if 0 /* completion not implemented */
@@ -378,8 +375,7 @@ gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct )
gtk_list_select_item( GTK_LIST(gas->combo->list), 0 );
return;
}
acctStr = xaccAccountGetFullName( acct,
gnc_get_account_separator() );
acctStr = xaccAccountGetFullName( acct );
gtk_entry_set_text( GTK_ENTRY(gas->combo->entry), acctStr );
g_free( acctStr );
}
@@ -398,7 +394,7 @@ gnc_account_sel_get_account( GNCAccountSel *gas )
goto cleanup;
}
ag = gnc_book_get_group( gnc_get_current_book() );
ret = xaccGetAccountFromFullName( ag, txt, gnc_get_account_separator() );
ret = xaccGetAccountFromFullName( ag, txt );
cleanup:
g_free( txt );
return ret;

View File

@@ -1746,8 +1746,7 @@ tree_save_expanded_row (GncTreeViewAccount *view,
if (account == NULL)
return;
account_name = xaccAccountGetFullName(account,
gnc_get_account_separator());
account_name = xaccAccountGetFullName(account);
if (account_name == NULL)
return;
@@ -1780,8 +1779,7 @@ tree_save_selected_row (GncTreeViewAccount *view,
if (account == NULL)
return;
account_name = xaccAccountGetFullName (account,
gnc_get_account_separator ());
account_name = xaccAccountGetFullName (account);
if (account_name == NULL)
return;
@@ -1836,8 +1834,7 @@ tree_restore_expanded_row (GncTreeViewAccount *view,
book = qof_session_get_book(gnc_get_current_session());
account = xaccGetAccountFromFullName(xaccGetAccountGroup(book),
account_name,
gnc_get_account_separator());
account_name);
if (account)
gnc_tree_view_account_expand_to_account(view, account);
}
@@ -1859,8 +1856,7 @@ tree_restore_selected_row (GncTreeViewAccount *view,
book = qof_session_get_book(gnc_get_current_session());
account = xaccGetAccountFromFullName(xaccGetAccountGroup(book),
account_name,
gnc_get_account_separator());
account_name);
if (account)
gnc_tree_view_account_set_selected_account(view, account);
}

View File

@@ -664,12 +664,11 @@ placeholder_cell_data_func (GtkTreeViewColumn *tree_column,
{
case GNC_ACCOUNT_MERGE_DISPOSITION_USE_EXISTING: {
/* find the existing account, do whatever it is. */
const char sep_char = '.';
gchar *full_name;
Account *existing_acct;
AccountGroup *root_group = gnc_book_get_group(gnc_get_current_book());
full_name = xaccAccountGetFullName(account, sep_char);
existing_acct = xaccGetAccountFromFullName(root_group, full_name, sep_char);
full_name = xaccAccountGetFullName(account);
existing_acct = xaccGetAccountFromFullName(root_group, full_name);
willbe_placeholder = xaccAccountGetPlaceholder(existing_acct);
g_free(full_name);
} break;

View File

@@ -147,8 +147,7 @@ fill_account_list (StockSplitInfo *info, Account *account)
print_info = gnc_account_print_info (account, FALSE);
strings[0] = xaccAccountGetFullName (account,
gnc_get_account_separator ());
strings[0] = xaccAccountGetFullName (account);
strings[1] = (char *) gnc_commodity_get_mnemonic (commodity);
strings[2] = (char *) xaccPrintAmount (balance, print_info);
strings[3] = NULL;

View File

@@ -874,7 +874,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
return;
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
acct_name = xaccAccountGetFullName(account, gnc_get_account_separator ());
acct_name = xaccAccountGetFullName(account);
if (!acct_name) {
acct_name = g_strdup (_("(no name)"));
}
@@ -999,7 +999,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
lines[0] = g_strdup_printf(format, acct_name);
if (splits) {
if (ta) {
name = xaccAccountGetFullName(ta, gnc_get_account_separator ());
name = xaccAccountGetFullName(ta);
format = _("All transactions in this account will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);
@@ -1010,7 +1010,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
}
if (children) {
if (daa) {
name = xaccAccountGetFullName(daa, gnc_get_account_separator ());
name = xaccAccountGetFullName(daa);
format = _("All of its sub-accounts will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);
@@ -1018,7 +1018,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
format = _("All of its subaccounts will be deleted.");
lines[++i] = g_strdup_printf("%s", format);
if (dta) {
name = xaccAccountGetFullName(ta, gnc_get_account_separator ());
name = xaccAccountGetFullName(ta);
format = _("All sub-account transactions will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);

View File

@@ -847,8 +847,7 @@ gnc_plugin_page_register_save_page (GncPluginPage *plugin_page,
leader = gnc_ledger_display_leader(priv->ledger);
g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME,
xaccAccountGetFullName(leader,
gnc_get_account_separator()));
xaccAccountGetFullName(leader));
} else if (reg->type == GENERAL_LEDGER) {
g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
LABEL_GL);
@@ -962,8 +961,7 @@ gnc_plugin_page_register_recreate_page (GtkWidget *window,
KEY_ACCOUNT_NAME, &error);
book = qof_session_get_book(gnc_get_current_session());
account = xaccGetAccountFromFullName(xaccGetAccountGroup(book),
acct_name,
gnc_get_account_separator());
acct_name);
g_free(acct_name);
if (account == NULL) {
LEAVE("Bad account name");
@@ -1610,8 +1608,7 @@ gnc_reg_get_name (GNCLedgerDisplay *ledger, gboolean for_window)
if ((leader != NULL) && (ledger_type != LD_GL))
{
account_name = xaccAccountGetFullName (leader,
gnc_get_account_separator ());
account_name = xaccAccountGetFullName (leader);
if (ledger_type == LD_SINGLE)
{

View File

@@ -119,8 +119,7 @@ gnc_html_register_url_cb (const char *location, const char *label,
if (strncmp("account=", location, 8) == 0)
{
account = xaccGetAccountFromFullName (gnc_get_current_group (),
location + 8,
gnc_get_account_separator ());
location + 8);
}
/* href="gnc-register:guid=12345678901234567890123456789012" */

View File

@@ -385,7 +385,7 @@ gnc_recn_make_interest_window_name(Account *account, char *text)
char *fullname;
char *title;
fullname = xaccAccountGetFullName(account, gnc_get_account_separator());
fullname = xaccAccountGetFullName(account);
title = g_strconcat(fullname, " - ", text && *text ? _(text) : "", NULL);
g_free(fullname);
@@ -1090,7 +1090,7 @@ gnc_recn_make_window_name(Account *account)
char *fullname;
char *title;
fullname = xaccAccountGetFullName(account, gnc_get_account_separator());
fullname = xaccAccountGetFullName(account);
title = g_strconcat(fullname, " - ", _("Reconcile"), NULL);
g_free(fullname);

View File

@@ -177,8 +177,7 @@ update_accountlist_acc_cb (AB_ACCOUNT *hacc, gpointer user_data)
if (gacc == NULL)
row_text[1] = "";
else
row_text[1] =
xaccAccountGetFullName (gacc, gnc_get_account_separator ());
row_text[1] = xaccAccountGetFullName (gacc);
/* Add this row to the list */
row = gtk_clist_append (GTK_CLIST (info->accountlist), row_text);

View File

@@ -667,8 +667,7 @@ refresh_clist_row (GNCImportMainMatcher *gui,
gtk_clist_set_background (GTK_CLIST (gui->clist), row_number,
&(gui->color_back_green));
tmp = xaccAccountGetFullName
(gnc_import_TransInfo_get_destacc (info),
gnc_get_account_separator ());
(gnc_import_TransInfo_get_destacc (info));
if(gnc_import_TransInfo_get_destacc_selected_manually(info)
== TRUE)
{

View File

@@ -442,8 +442,7 @@ Account* gnc_imap_find_account_bayes(GncImportMatchMap *imap, GList *tokens)
PINFO("found match");
LEAVE(" ");
return xaccGetAccountFromFullName(gnc_book_get_group(imap->book),
account_i.account_name,
gnc_get_account_separator());
account_i.account_name);
}
PINFO("no match");
@@ -471,7 +470,7 @@ void gnc_imap_add_account_bayes(GncImportMatchMap *imap, GList *tokens, Account
return;
}
account_fullname = xaccAccountGetFullName(acc, gnc_get_account_separator());
account_fullname = xaccAccountGetFullName(acc);
PINFO("account name: '%s'\n", account_fullname);

View File

@@ -35,7 +35,6 @@
;; trying to find matches in the new group. If there are matches,
;; push the matches onto a list.
(let* ((new-xtns (gnc:group-get-transactions new-group))
(separator (string-ref (gnc:account-separator-char) 0))
(progress-dialog #f)
(work-to-do (length new-xtns))
(work-done 0)
@@ -90,7 +89,7 @@
sq
(gnc:get-account-from-full-name
old-group (gnc:account-get-full-name
(gnc:split-get-account split)) separator)
(gnc:split-get-account split)))
'query-and)
;; we want the value for the split to match the value

View File

@@ -19,7 +19,7 @@
(gnc-name (qif-map-entry:gnc-name acct-info))
(existing-account (hash-ref gnc-acct-hash gnc-name))
(same-gnc-account
(gnc:get-account-from-full-name old-group gnc-name separator))
(gnc:get-account-from-full-name old-group gnc-name))
(allowed-types
(qif-map-entry:allowed-types acct-info))
(make-new-acct #f)
@@ -38,13 +38,12 @@
#t))))
(define (make-unique-name-variant long-name short-name)
(if (gnc:get-account-from-full-name old-group long-name separator)
(if (gnc:get-account-from-full-name old-group long-name)
(let loop ((count 2))
(let* ((test-name
(string-append long-name (sprintf #f " %a" count)))
(test-acct
(gnc:get-account-from-full-name old-group test-name
separator)))
(gnc:get-account-from-full-name old-group test-name)))
(if (and test-acct (not (compatible? test-acct)))
(loop (+ 1 count))
(string-append short-name (sprintf #f " %a" count)))))

View File

@@ -831,8 +831,7 @@ gnc_split_register_auto_completion (SplitRegister *reg,
/* auto-complete the account name */
cell = gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
fullname = xaccAccountGetFullName (xaccSplitGetAccount (auto_split),
gnc_get_account_separator ());
fullname = xaccAccountGetFullName (xaccSplitGetAccount (auto_split));
gnc_combo_cell_set_value ((ComboCell *) cell, fullname);
g_free(fullname);

View File

@@ -573,7 +573,7 @@ load_xfer_cell_cb (Account *account, gpointer data)
if (xaccAccountGetPlaceholder (account)) return NULL;
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
if (NULL == name) return NULL;
gnc_combo_cell_add_account_menu_item (cell, name);
g_free(name);

View File

@@ -84,9 +84,7 @@ gnc_split_register_use_security_cells (SplitRegister *reg,
const char *name;
name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
account = xaccGetAccountFromFullName (gnc_get_current_group (),
name,
gnc_get_account_separator ());
account = xaccGetAccountFromFullName (gnc_get_current_group (), name);
}
if (!account)
@@ -1221,8 +1219,7 @@ gnc_split_register_get_xfrm_entry (VirtualLocation virt_loc,
g_free (name);
name = xaccAccountGetFullName (xaccSplitGetAccount (split),
gnc_get_account_separator ());
name = xaccAccountGetFullName (xaccSplitGetAccount (split));
return name;
}
@@ -1263,8 +1260,7 @@ gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
g_free (name);
if (s)
name = xaccAccountGetFullName (xaccSplitGetAccount (s),
gnc_get_account_separator ());
name = xaccAccountGetFullName (xaccSplitGetAccount (s));
else
{
/* For multi-split transactions and stock splits,
@@ -1808,7 +1804,7 @@ gnc_template_register_get_xfrm_entry (VirtualLocation virt_loc,
account = xaccAccountLookup (guid, gnc_get_current_book ());
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
name = xaccAccountGetFullName (account);
}
else
name = NULL;

View File

@@ -1551,8 +1551,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
return NULL;
/* Find the account */
account = xaccGetAccountFromFullName (gnc_get_current_group (),
name, gnc_get_account_separator ());
account = xaccGetAccountFromFullName (gnc_get_current_group (), name);
if (!account) {
/* Ask if they want to create a new one. */
@@ -1568,7 +1567,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
*refresh = TRUE;
/* Now have a new account. Update the cell with the name as created. */
fullname = xaccAccountGetFullName (account, gnc_get_account_separator ());
fullname = xaccAccountGetFullName (account);
gnc_combo_cell_set_value (cell, fullname);
gnc_basic_cell_set_changed (&cell->cell, TRUE);
g_free (fullname);

View File

@@ -155,8 +155,7 @@
(gnc:group-get-account-list (gnc:get-current-group))))
(define (gnc:split-get-corr-account-full-name split)
(let ((separator (string-ref (gnc:account-separator-char) 0)))
(gnc:split-get-corr-account-full-name-internal split separator)))
(gnc:split-get-corr-account-full-name-internal split))
;; get children that are the direct descendant of this acct