|
GnuCash 2.3.0
|
Data Structures | |
| struct | _GNCPrintAmountInfo |
Files | |
| file | gnc-ui-util.h |
utility functions for the GnuCash UI | |
Defines | |
| #define | GCONF_DIR_OPEN_SAVE "dialogs/open_save" |
| #define | GCONF_DIR_EXPORT "dialogs/export_accounts" |
| #define | GCONF_DIR_REPORT "dialogs/report" |
Typedefs | |
| typedef QofSession *(* | QofSessionCB )(void) |
| typedef struct _GNCPrintAmountInfo | GNCPrintAmountInfo |
Enumerations | |
| enum | GNCEquityType { EQUITY_OPENING_BALANCE, EQUITY_RETAINED_EARNINGS, NUM_EQUITY_TYPES } |
Functions | |
| gboolean | gnc_reverse_balance (const Account *account) |
| gchar * | gnc_get_default_directory (const gchar *gconf_section) |
| void | gnc_set_default_directory (const gchar *gconf_section, const gchar *directory) |
| QofBook * | gnc_get_current_book (void) |
| void | gnc_set_current_book_tax_name (const gchar *tax_name) |
| const gchar * | gnc_get_current_book_tax_name (void) |
| void | gnc_set_current_book_tax_type (const gchar *tax_type) |
| const gchar * | gnc_get_current_book_tax_type (void) |
| Account * | gnc_get_current_root_account (void) |
| gnc_commodity_table * | gnc_get_current_commodities (void) |
| gchar * | gnc_get_account_name_for_register (const Account *account) |
| Account * | gnc_account_lookup_for_register (const Account *base_account, const gchar *name) |
| char * | gnc_ui_account_get_tax_info_string (const Account *account) |
| char * | gnc_ui_account_get_tax_info_sub_acct_string (const Account *account) |
| const char * | gnc_get_reconcile_str (char reconciled_flag) |
| const char * | gnc_get_reconcile_valid_flags (void) |
| const char * | gnc_get_reconcile_flag_order (void) |
| Account * | gnc_find_or_create_equity_account (Account *root, GNCEquityType equity_type, gnc_commodity *currency) |
| gboolean | gnc_account_create_opening_balance (Account *account, gnc_numeric balance, time_t date, QofBook *book) |
| gnc_commodity * | gnc_locale_default_currency_nodefault (void) |
| gnc_commodity * | gnc_locale_default_currency (void) |
| const char * | gnc_locale_default_iso_currency_code (void) |
| gnc_commodity * | gnc_default_currency (void) |
| gnc_commodity * | gnc_default_report_currency (void) |
| GNCPrintAmountInfo | gnc_default_print_info (gboolean use_symbol) |
| GNCPrintAmountInfo | gnc_commodity_print_info (const gnc_commodity *commodity, gboolean use_symbol) |
| GNCPrintAmountInfo | gnc_account_print_info (const Account *account, gboolean use_symbol) |
| GNCPrintAmountInfo | gnc_split_amount_print_info (Split *split, gboolean use_symbol) |
| GNCPrintAmountInfo | gnc_share_print_info_places (int decplaces) |
| GNCPrintAmountInfo | gnc_default_share_print_info (void) |
| GNCPrintAmountInfo | gnc_default_price_print_info (void) |
| GNCPrintAmountInfo | gnc_integral_print_info (void) |
| const char * | xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info) |
| int | xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info) |
| const gchar * | printable_value (gdouble val, gint denom) |
| gchar * | number_to_words (gdouble val, gint64 denom) |
| gchar * | numeric_to_words (gnc_numeric val) |
| gboolean | xaccParseAmount (const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr) |
| gboolean | xaccParseAmountExtended (const char *in_str, gboolean monetary, gunichar negative_sign, gunichar decimal_point, gunichar group_separator, char *group, char *ignore_list, gnc_numeric *result, char **endstr) |
| void | gnc_ui_util_init (void) |
Retrieve the account matching the given name starting from the descandants of base_account. name is either considered to be the name of the leaf in the account tree or to be the full account path, depending on the configuration parameter general/register/show_leaf_account_names.
| base_account | The account to start the search at. |
| name | The name to search for. |
| gnc_commodity* gnc_default_currency | ( | void | ) |
Return the default currency set by the user. If the user's preference is invalid, then this routine will return the default currency for the user's locale.
Definition at line 884 of file gnc-ui-util.c.
{
return gnc_default_currency_common (user_default_currency, GCONF_GENERAL);
}
| gnc_commodity* gnc_default_report_currency | ( | void | ) |
Return the default currency for use in reports, as set by the user. If the user's preference is invalid, then this routine will return the default currency for the user's locale.
Definition at line 890 of file gnc-ui-util.c.
{
return gnc_default_currency_common (user_report_currency, GCONF_GENERAL_REPORT);
}
| gchar* gnc_get_account_name_for_register | ( | const Account * | account | ) |
Get either the full name of the account or the simple name, depending on the configuration parameter general/register/show_leaf_account_names.
| account | The account to retrieve the name for. |
Definition at line 236 of file gnc-ui-util.c.
{
gboolean show_leaf_accounts;
show_leaf_accounts = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
KEY_SHOW_LEAF_ACCOUNT_NAMES, NULL);
if (show_leaf_accounts)
return g_strdup (xaccAccountGetName (account));
else
return gnc_account_get_full_name (account);
}
| int xaccSPrintAmount | ( | char * | bufp, |
| gnc_numeric | val, | ||
| GNCPrintAmountInfo | info | ||
| ) |
| bufp | Should be at least 64 chars. |
Definition at line 1356 of file gnc-ui-util.c.
{
struct lconv *lc;
char *orig_bufp = bufp;
const char *currency_symbol;
const char *sign;
char cs_precedes;
char sep_by_space;
char sign_posn;
gboolean print_sign = TRUE;
gboolean is_shares = FALSE;
gboolean print_absolute = FALSE;
if (!bufp)
return 0;
lc = gnc_localeconv();
if (info.use_symbol)
{
/* There was a bug here: don't use gnc_locale_default_currency */
if (gnc_commodity_equiv (info.commodity,
gnc_locale_default_currency_nodefault ()))
{
currency_symbol = lc->currency_symbol;
}
else
{
if (info.commodity && !gnc_commodity_is_iso (info.commodity))
is_shares = TRUE;
currency_symbol = gnc_commodity_get_mnemonic (info.commodity);
info.use_locale = 0;
}
if (currency_symbol == NULL)
currency_symbol = "";
}
else
currency_symbol = NULL;
if (!info.use_locale)
{
cs_precedes = is_shares ? 0 : 1;
sep_by_space = 1;
}
else
{
if (gnc_numeric_negative_p (val))
{
cs_precedes = lc->n_cs_precedes;
sep_by_space = lc->n_sep_by_space;
}
else
{
cs_precedes = lc->p_cs_precedes;
sep_by_space = lc->p_sep_by_space;
}
}
if (gnc_numeric_negative_p (val))
{
sign = lc->negative_sign;
sign_posn = lc->n_sign_posn;
}
else
{
sign = lc->positive_sign;
sign_posn = lc->p_sign_posn;
}
if (gnc_numeric_zero_p (val) || (sign == NULL) || (sign[0] == 0))
print_sign = FALSE;
/* See if we print sign now */
if (print_sign && (sign_posn == 1))
bufp = g_stpcpy(bufp, sign);
/* Now see if we print currency */
if (cs_precedes)
{
/* See if we print sign now */
if (print_sign && (sign_posn == 3))
bufp = g_stpcpy(bufp, sign);
if (info.use_symbol)
{
bufp = g_stpcpy(bufp, currency_symbol);
if (sep_by_space)
bufp = g_stpcpy(bufp, " ");
}
/* See if we print sign now */
if (print_sign && (sign_posn == 4))
bufp = g_stpcpy(bufp, sign);
}
/* Now see if we print parentheses */
if (print_sign && (sign_posn == 0))
{
bufp = g_stpcpy(bufp, "(");
print_absolute = TRUE;
}
/* Now print the value */
bufp += PrintAmountInternal(bufp,
print_absolute ? gnc_numeric_abs(val) : val,
&info);
/* Now see if we print parentheses */
if (print_sign && (sign_posn == 0))
bufp = g_stpcpy(bufp, ")");
/* Now see if we print currency */
if (!cs_precedes)
{
/* See if we print sign now */
if (print_sign && (sign_posn == 3))
bufp = g_stpcpy(bufp, sign);
if (info.use_symbol)
{
if (sep_by_space)
bufp = g_stpcpy(bufp, " ");
bufp = g_stpcpy(bufp, currency_symbol);
}
/* See if we print sign now */
if (print_sign && (sign_posn == 4))
bufp = g_stpcpy(bufp, sign);
}
/* See if we print sign now */
if (print_sign && (sign_posn == 2))
bufp = g_stpcpy(bufp, sign);
/* return length of printed string */
return (bufp - orig_bufp);
}
1.7.4