Move gnc_account_get_full_name() from app-utils to engine and remove xaccAccountGetFullName

in engine.  The old routine in app-utils just called the one in engine.  There isn't even the
excuse that the one in app-utils was just there for SCM, because there were SCM calls to
xaccAccountGetFullName.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18309 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-09-11 02:11:38 +00:00
parent f110ce2c68
commit f85972c85f
26 changed files with 44 additions and 71 deletions

View File

@ -61,8 +61,6 @@ void gnc_option_db_register_option(GNCOptionDBHandle handle,
const char * gnc_locale_default_iso_currency_code (void);
char * gnc_account_get_full_name (const Account *account);
GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
GNCPrintAmountInfo gnc_account_print_info (const Account *account,
gboolean use_symbol);

View File

@ -39,7 +39,7 @@ determine_merge_disposition(Account *existing_root, Account *new_acct)
Account *existing_acct;
gchar *full_name;
full_name = xaccAccountGetFullName(new_acct);
full_name = gnc_account_get_full_name(new_acct);
existing_acct = gnc_account_lookup_by_full_name(existing_root, full_name);
g_free(full_name);

View File

@ -222,7 +222,7 @@ gnc_get_account_name_for_register(const Account *account)
if (show_leaf_accounts)
return g_strdup (xaccAccountGetName (account));
else
return xaccAccountGetFullName (account);
return gnc_account_get_full_name (account);
}
Account *
@ -747,21 +747,6 @@ gnc_account_create_opening_balance (Account *account,
return TRUE;
}
char *
gnc_account_get_full_name (const Account *account)
{
static gchar result[1000];
gchar* name;
if (!account) return NULL;
name = xaccAccountGetFullName (account);
strncpy( result, name, sizeof(result)-2 );
result[sizeof(result)-1] = '\0';
return result;
}
static void
gnc_lconv_set_utf8 (char **p_value, char *default_value)
{

View File

@ -192,16 +192,6 @@ gboolean gnc_account_create_opening_balance (Account *account,
time_t date,
QofBook *book);
/**
* Returns the account full name. Unlike xaccAccountGetFullName(), the
* string returned must *NOT* be freed.
*
* @param account Account
* @return Account full name
*/
char * gnc_account_get_full_name (const Account *account);
/* Locale functions *************************************************/
/* The gnc_localeconv() subroutine returns an lconv structure

View File

@ -691,8 +691,8 @@ int gncTaxTableEntryCompare (const GncTaxTableEntry *a, const GncTaxTableEntry *
if (!a) return -1;
if (!b) return 1;
name_a = xaccAccountGetFullName (a->account);
name_b = xaccAccountGetFullName (b->account);
name_a = gnc_account_get_full_name (a->account);
name_b = gnc_account_get_full_name (b->account);
retval = safe_strcmp(name_a, name_b);
g_free(name_a);
g_free(name_b);

View File

@ -348,7 +348,7 @@ gnc_fill_account_select_combo (GtkWidget *combo, QofBook *book,
}
}
name = xaccAccountGetFullName (account);
name = gnc_account_get_full_name (account);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
g_free(name);
}

View File

@ -1554,7 +1554,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);
tmp_string = gnc_account_get_full_name (acct);
gtk_entry_set_text (GTK_ENTRY (acct_entry), tmp_string);
g_free(tmp_string);

View File

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

View File

@ -285,7 +285,7 @@ gnc_account_get_property (GObject *object,
g_value_set_string(value, priv->accountName);
break;
case PROP_FULL_NAME:
g_value_take_string(value, xaccAccountGetFullName(account));
g_value_take_string(value, gnc_account_get_full_name(account));
break;
case PROP_CODE:
g_value_set_string(value, priv->accountCode);
@ -2748,7 +2748,7 @@ xaccAccountGetName (const Account *acc)
}
gchar *
xaccAccountGetFullName(const Account *account)
gnc_account_get_full_name(const Account *account)
{
AccountPrivate *priv;
const Account *a;

View File

@ -394,7 +394,7 @@ void xaccAccountRecomputeBalance (Account *);
*/
void xaccAccountSortSplits (Account *acc, gboolean force);
/** The xaccAccountGetFullName routine returns the fully qualified name
/** The gnc_account_get_full_name routine returns the fully qualified name
* of the account using the given separator char. The name must be
* g_free'd after use. The fully qualified name of an account is the
* concatenation of the names of the account and all its ancestor
@ -402,12 +402,12 @@ void xaccAccountSortSplits (Account *acc, gboolean force);
* given account. Each name is separated by the given character.
*
* @note: WAKE UP!
* Unlike all other gets, the string returned by xaccAccountGetFullName()
* Unlike all other gets, the string returned by gnc_account_get_full_name()
* must be freed by you the user !!!
* hack alert -- since it breaks the rule of string allocation, maybe this
* routine should not be in this library, but some utility library?
*/
gchar * xaccAccountGetFullName (const Account *account);
gchar * gnc_account_get_full_name (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

@ -1264,7 +1264,7 @@ xaccSplitGetCorrAccountFullName(const Split *sa)
return g_strdup(split_const);
}
return xaccAccountGetFullName(other_split->acc);
return gnc_account_get_full_name(other_split->acc);
}
const char *
@ -1296,8 +1296,8 @@ xaccSplitCompareAccountFullNames(const Split *sa, const Split *sb)
aa = sa->acc;
ab = sb->acc;
full_a = xaccAccountGetFullName(aa);
full_b = xaccAccountGetFullName(ab);
full_a = gnc_account_get_full_name(aa);
full_b = gnc_account_get_full_name(ab);
retval = g_utf8_collate(full_a, full_b);
g_free(full_a);
g_free(full_b);

View File

@ -37,7 +37,7 @@ GLIST_HELPER_INOUT(CommodityList, SWIGTYPE_p_gnc_commodity);
declarations in the header files, some of which are included by
engine-common.i */
%newobject xaccAccountGetFullName;
%newobject gnc_account_get_full_name;
%include "engine-common.i"

View File

@ -718,7 +718,7 @@ gnc_common_ok (AccountWindow *aw)
if (parent == NULL) {
account = gnc_account_lookup_by_full_name(root, name);
} else {
fullname_parent = xaccAccountGetFullName(parent);
fullname_parent = gnc_account_get_full_name(parent);
fullname = g_strconcat(fullname_parent, separator, name, NULL);
account = gnc_account_lookup_by_full_name(root, fullname);
@ -1297,7 +1297,7 @@ get_ui_fullname (AccountWindow *aw)
char *parent_name;
const gchar *separator;
parent_name = xaccAccountGetFullName (parent_account);
parent_name = gnc_account_get_full_name (parent_account);
separator = gnc_get_account_separator_string ();
fullname = g_strconcat (parent_name, separator, name, NULL);
@ -1838,7 +1838,7 @@ gnc_account_renumber_create_dialog (GtkWidget *window, Account *account)
string = g_strdup_printf(_( "Renumber the immediate sub-accounts of %s? "
"This will replace the account code field of "
"each child account with a newly generated code."),
xaccAccountGetFullName(account));
gnc_account_get_full_name(account));
gtk_label_set_text(GTK_LABEL(widget), string);
g_free(string);

View File

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

View File

@ -208,7 +208,7 @@ gas_populate_list( GNCAccountSel *gas )
gtk_list_store_clear(gas->store);
for (ptr = filteredAccts, i = 0; ptr; ptr = g_list_next(ptr), i++) {
acc = ptr->data;
name = xaccAccountGetFullName(acc);
name = gnc_account_get_full_name(acc);
gtk_list_store_append(gas->store, &iter);
gtk_list_store_set(gas->store, &iter,
ACCT_COL_NAME, name,

View File

@ -1937,7 +1937,7 @@ tree_save_expanded_row (GncTreeViewAccount *view,
if (account == NULL)
return;
account_name = xaccAccountGetFullName(account);
account_name = gnc_account_get_full_name(account);
if (account_name == NULL)
return;
@ -1970,7 +1970,7 @@ tree_save_selected_row (GncTreeViewAccount *view,
if (account == NULL)
return;
account_name = xaccAccountGetFullName (account);
account_name = gnc_account_get_full_name (account);
if (account_name == NULL)
return;

View File

@ -787,7 +787,7 @@ placeholder_cell_data_func (GtkTreeViewColumn *tree_column,
/* find the existing account, do whatever it is. */
gchar *full_name;
Account *existing_acct;
full_name = xaccAccountGetFullName(account);
full_name = gnc_account_get_full_name(account);
existing_acct = gnc_account_lookup_by_full_name(root, full_name);
willbe_placeholder = xaccAccountGetPlaceholder(existing_acct);
g_free(full_name);

View File

@ -151,7 +151,7 @@ fill_account_list (StockSplitInfo *info, Account *selected_account)
commodity = xaccAccountGetCommodity (account);
full_name = xaccAccountGetFullName (account);
full_name = gnc_account_get_full_name (account);
print_info = gnc_account_print_info (account, FALSE);
gtk_list_store_append(list, &iter);

View File

@ -900,7 +900,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);
acct_name = gnc_account_get_full_name(account);
if (!acct_name) {
acct_name = g_strdup (_("(no name)"));
}
@ -1024,7 +1024,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);
name = gnc_account_get_full_name(ta);
format = _("All transactions in this account will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);
@ -1035,7 +1035,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
}
if (gnc_account_n_children(account) > 0) {
if (daa) {
name = xaccAccountGetFullName(daa);
name = gnc_account_get_full_name(daa);
format = _("All of its sub-accounts will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);
@ -1043,7 +1043,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(dta);
name = gnc_account_get_full_name(dta);
format = _("All sub-account transactions will be moved to "
"the account %s.");
lines[++i] = g_strdup_printf(format, name);

View File

@ -903,7 +903,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_account_get_full_name(leader));
} else if (reg->type == GENERAL_LEDGER) {
g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
LABEL_GL);
@ -1200,10 +1200,10 @@ gnc_plugin_page_register_get_long_name (GncPluginPage *plugin_page)
switch (ledger_type) {
case LD_SINGLE:
return g_strdup(xaccAccountGetFullName (leader));
return g_strdup(gnc_account_get_full_name (leader));
case LD_SUBACCOUNT:
return g_strdup_printf("%s+", xaccAccountGetFullName (leader));
return g_strdup_printf("%s+", gnc_account_get_full_name (leader));
default:
break;
@ -1785,7 +1785,7 @@ gnc_reg_get_name (GNCLedgerDisplay *ledger, gboolean for_window)
if ((leader != NULL) && (ledger_type != LD_GL))
{
account_name = xaccAccountGetFullName (leader);
account_name = gnc_account_get_full_name (leader);
if (ledger_type == LD_SINGLE)
{

View File

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

View File

@ -534,7 +534,7 @@ update_account_list_acc_cb(AB_ACCOUNT *ab_acc, gpointer user_data)
/* Build the text for the gnucash account. */
if (gnc_acc)
gnc_name = xaccAccountGetFullName(gnc_acc);
gnc_name = gnc_account_get_full_name(gnc_acc);
else
gnc_name = g_strdup("");
@ -672,7 +672,7 @@ account_list_changed_cb(GtkTreeSelection *selection, gpointer user_data)
/* Map ab_acc to gnc_acc */
g_hash_table_insert(info->gnc_hash, ab_acc, gnc_acc);
gnc_name = xaccAccountGetFullName(gnc_acc);
gnc_name = gnc_account_get_full_name(gnc_acc);
gtk_list_store_set(info->account_store, &iter,
ACCOUNT_LIST_COL_GNC_NAME, gnc_name,
ACCOUNT_LIST_COL_CHECKED, TRUE,

View File

@ -176,7 +176,7 @@ update_accountlist_acc_cb (AB_ACCOUNT *hacc, gpointer user_data)
if (gacc == NULL)
gnc_name = g_strdup("");
else
gnc_name = xaccAccountGetFullName (gacc);
gnc_name = gnc_account_get_full_name (gacc);
gtk_list_store_append(info->accountstore, &iter);
gtk_list_store_set(info->accountstore, &iter,
@ -397,7 +397,7 @@ on_accountlist_changed (GtkTreeSelection *selection,
if (old_value)
g_hash_table_remove (info->gnc_hash, hbci_acc);
g_hash_table_insert (info->gnc_hash, hbci_acc, gnc_acc);
gnc_name = xaccAccountGetFullName (gnc_acc);
gnc_name = gnc_account_get_full_name (gnc_acc);
gtk_list_store_set(info->accountstore, &iter,
ACCOUNT_LIST_COL_GNC_NAME, gnc_name,
-1);

View File

@ -616,7 +616,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
if (gnc_import_TransInfo_get_destacc (info) != NULL)
{
color = COLOR_GREEN;
tmp = xaccAccountGetFullName
tmp = gnc_account_get_full_name
(gnc_import_TransInfo_get_destacc (info));
if(gnc_import_TransInfo_get_destacc_selected_manually(info)
== TRUE)

View File

@ -472,7 +472,7 @@ void gnc_imap_add_account_bayes(GncImportMatchMap *imap, GList *tokens, Account
return;
}
account_fullname = xaccAccountGetFullName(acc);
account_fullname = gnc_account_get_full_name(acc);
PINFO("account name: '%s'\n", account_fullname);

View File

@ -596,7 +596,7 @@
))
(splt-print-amnt (car splt-curr-conv-data))
(splt-account-name (if full-names?
(xaccAccountGetFullName split-acct)
(gnc-account-get-full-name split-acct)
(xaccAccountGetName split-acct)
))
(cell (gnc:make-html-table-cell
@ -804,7 +804,7 @@
(other-account-name (if (null? other-account)
(_ "Split")
(if full-names?
(xaccAccountGetFullName
(gnc-account-get-full-name
other-account)
(xaccAccountGetName other-account)
)))