GnuCash
5.0
|
Files | |
file | gnc-ui-util.h |
utility functions for the GnuCash UI | |
Data Structures | |
struct | GNCPrintAmountInfo |
Typedefs | |
typedef QofSession *(* | QofSessionCB) (void) |
Enumerations | |
enum | GNCEquityType { EQUITY_OPENING_BALANCE, EQUITY_RETAINED_EARNINGS, NUM_EQUITY_TYPES } |
Functions | |
gchar * | gnc_normalize_account_separator (const gchar *separator) |
gboolean | gnc_reverse_balance (const Account *account) |
void | gnc_set_use_equity_type_opening_balance_account (QofBook *book) |
gboolean | gnc_using_equity_type_opening_balance_account (QofBook *book) |
gchar * | gnc_get_default_directory (const gchar *section) |
void | gnc_set_default_directory (const gchar *section, const gchar *directory) |
QofBook * | gnc_get_current_book (void) |
gboolean | gnc_is_new_book (void) |
void | gnc_set_current_book_tax_name_type (gboolean name_changed, const gchar *tax_name, gboolean type_changed, const gchar *tax_type) |
const gchar * | gnc_get_current_book_tax_name (void) |
const gchar * | gnc_get_current_book_tax_type (void) |
void | gnc_book_option_num_field_source_change_cb (gboolean num_action) |
Calls gnc_book_option_num_field_source_change to initiate registered callbacks when num_field_source book option changes so that registers/reports can update themselves; sets feature flag. | |
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) |
Get either the full name of the account or the simple name, depending on the configuration parameter general/register/show_leaf_account_names. More... | |
Account * | gnc_account_lookup_for_register (const Account *base_account, const gchar *name) |
Retrieve the account matching the given name starting from the descendants of base_account. More... | |
gchar * | gnc_get_account_name_for_split_register (const Account *account, gboolean show_leaf_accounts) |
Get either the full name of the account or the simple name, depending on the show_leaf_accounts. More... | |
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) |
const char * | gnc_get_doclink_valid_flags (void) |
Get a string containing documentation link valid flags. More... | |
const char * | gnc_get_doclink_flag_order (void) |
Get a string containing document link flag order. More... | |
const char * | gnc_get_doclink_str (char link_flag) |
Get a string representing the document link type. More... | |
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, time64 date, QofBook *book) |
gnc_commodity * | gnc_locale_default_currency_nodefault (void) |
Returns the default currency of the current locale, or NULL if no sensible currency could be identified from the locale. More... | |
gnc_commodity * | gnc_locale_default_currency (void) |
Returns the default currency of the current locale. More... | |
gnc_commodity * | gnc_default_currency (void) |
Return the default currency set by the user. More... | |
gnc_commodity * | gnc_account_or_default_currency (const Account *account, gboolean *currency_from_account_found) |
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency. More... | |
gnc_commodity * | gnc_default_report_currency (void) |
Return the default currency for use in reports, as set by the user. More... | |
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_price_print_info (const gnc_commodity *curr, gboolean use_symbol) |
GNCPrintAmountInfo | gnc_share_print_info_places (int decplaces) |
GNCPrintAmountInfo | gnc_default_share_print_info (void) |
GNCPrintAmountInfo | gnc_default_price_print_info (const gnc_commodity *curr) |
GNCPrintAmountInfo | gnc_integral_print_info (void) |
const char * | xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
int | xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
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) |
Parses in_str to obtain a numeric result. More... | |
gboolean | xaccParseAmountExtended (const char *in_str, gboolean monetary, gunichar negative_sign, gunichar decimal_point, gunichar group_separator, const char *ignore_list, gnc_numeric *result, char **endstr) |
Converts a string to a gnc_numeric. More... | |
gboolean | xaccParseAmountImport (const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr, gboolean skip) |
Similar to xaccParseAmount, but with two differences. More... | |
gboolean | xaccParseAmountExtImport (const char *in_str, gboolean monetary, gunichar negative_sign, gunichar decimal_point, gunichar group_separator, const char *ignore_list, gnc_numeric *result, char **endstr) |
Similar to xaccParseAmountExtended, but will not automatically set a decimal point, regardless of what the user has set for this option. More... | |
const char * | gnc_print_amount_with_bidi_ltr_isolate (gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
gchar * | gnc_wrap_text_with_bidi_ltr_isolate (const char *text) |
This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'. More... | |
void | gnc_ui_util_init (void) |
void | gnc_ui_util_remove_registered_prefs (void) |
gchar * | gnc_filter_text_for_control_chars (const gchar *incoming_text) |
Returns the incoming text removed of control characters. More... | |
void | gnc_filter_text_set_cursor_position (const gchar *incoming_text, const gchar *symbol, gint *cursor_position) |
Updates cursor_position after removal of currency symbols. More... | |
gchar * | gnc_filter_text_for_currency_symbol (const gchar *incoming_text, const gchar *symbol) |
Returns the incoming text removed of a currency symbol. More... | |
gchar * | gnc_filter_text_for_currency_commodity (const gnc_commodity *comm, const gchar *incoming_text, const gchar **symbol) |
Returns the incoming text removed of currency symbol. More... | |
Retrieve the account matching the given name starting from the descendants 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_account_or_default_currency | ( | const Account * | account, |
gboolean * | currency_from_account_found | ||
) |
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
The gnc_commodity is taken either from the current account, or from the next parent account that has a gnc_commodity that is a currency, or from gnc_default_currency().
If the given account or any of its parent account have a commodity that is a currency, it is returned and the gboolean currency_from_account_found is set to TRUE (if non-NULL). If neither this account nor any of its parent accounts have such a commodity, gnc_default_currency() is returned and the gboolean currency_from_account_found is set to FALSE (if non-NULL). This can be used to show an appropriate warning message.
If account is NULL, gnc_default_currency() is returned and currency_from_account_found is set to FALSE.
account | The account where the currency should be looked up. May be NULL. |
currency_from_account_found | A gboolean pointer that takes the output argument of whether the returned currency was found in the account. May be NULL. |
Definition at line 810 of file gnc-ui-util.c.
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 805 of file gnc-ui-util.c.
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 838 of file gnc-ui-util.c.
gchar* gnc_filter_text_for_control_chars | ( | const gchar * | incoming_text | ) |
Returns the incoming text removed of control characters.
incoming_text | The text to filter |
Definition at line 2212 of file gnc-ui-util.c.
gchar* gnc_filter_text_for_currency_commodity | ( | const gnc_commodity * | comm, |
const gchar * | incoming_text, | ||
const gchar ** | symbol | ||
) |
Returns the incoming text removed of currency symbol.
comm | commodity of entry if known |
incoming_text | The text to filter |
symbol | return the symbol used |
Definition at line 2320 of file gnc-ui-util.c.
gchar* gnc_filter_text_for_currency_symbol | ( | const gchar * | incoming_text, |
const gchar * | symbol | ||
) |
Returns the incoming text removed of a currency symbol.
incoming_text | The text to filter |
symbol | to remove |
cursor_position | the position of cursor in the incoming text |
Definition at line 2296 of file gnc-ui-util.c.
void gnc_filter_text_set_cursor_position | ( | const gchar * | incoming_text, |
const gchar * | symbol, | ||
gint * | cursor_position | ||
) |
Updates cursor_position after removal of currency symbols.
incoming_text | The text to filter |
symbol | to remove |
cursor_position | the position of cursor in the incoming text |
Definition at line 2264 of file gnc-ui-util.c.
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 446 of file gnc-ui-util.c.
gchar* gnc_get_account_name_for_split_register | ( | const Account * | account, |
gboolean | show_leaf_accounts | ||
) |
Get either the full name of the account or the simple name, depending on the show_leaf_accounts.
account | The account to retrieve the name for. |
show_leaf_accounts | Whether the full name will be returned. |
Definition at line 437 of file gnc-ui-util.c.
const char* gnc_get_doclink_flag_order | ( | void | ) |
Get a string containing document link flag order.
Definition at line 548 of file gnc-ui-util.c.
const char* gnc_get_doclink_str | ( | char | link_flag | ) |
Get a string representing the document link type.
link_flag | The flag to convert into a string |
Definition at line 524 of file gnc-ui-util.c.
const char* gnc_get_doclink_valid_flags | ( | void | ) |
Get a string containing documentation link valid flags.
Definition at line 541 of file gnc-ui-util.c.
gnc_commodity* gnc_locale_default_currency | ( | void | ) |
Returns the default currency of the current locale.
WATCH OUT: If no currency could be identified from the locale, this one returns "USD", but this will have nothing to do with the actual locale.
Definition at line 759 of file gnc-ui-util.c.
gnc_commodity* gnc_locale_default_currency_nodefault | ( | void | ) |
Returns the default currency of the current locale, or NULL if no sensible currency could be identified from the locale.
Definition at line 744 of file gnc-ui-util.c.
const char* gnc_print_amount_with_bidi_ltr_isolate | ( | gnc_numeric | val, |
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the returned char* may point to random garbage.
This is the same as xaccPrintAmount but wraps the output with BiDi left to right isolate if a symbol is displayed.
Definition at line 1481 of file gnc-ui-util.c.
gchar* gnc_wrap_text_with_bidi_ltr_isolate | ( | const char * | text | ) |
This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'.
To keep the format of the text, this function wraps the text with a BiDi isolate charatcter and a BiDi closing character.
This helps with monetary values in RTL languages that display the currency symbol.
gboolean xaccParseAmount | ( | const char * | in_str, |
gboolean | monetary, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Parses in_str to obtain a numeric result.
The routine will parse as much of in_str as it can to obtain a single number. The number is parsed using the current locale information and the 'monetary' flag. The routine will return TRUE if it successfully parsed a number and FALSE otherwise. If TRUE is returned and result is non-NULL, the value of the parsed number is stored in *result. If FALSE is returned, *result is unchanged. If TRUE is returned and endstr is non-NULL, the location of the first character in in_str not used by the parser will be returned in *endstr. If FALSE is returned and endstr is non-NULL, *endstr will point to in_str.
Definition at line 2060 of file gnc-ui-util.c.
gboolean xaccParseAmountExtended | ( | const char * | in_str, |
gboolean | monetary, | ||
gunichar | negative_sign, | ||
gunichar | decimal_point, | ||
gunichar | group_separator, | ||
const char * | ignore_list, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Converts a string to a gnc_numeric.
The caller must provide all the locale-specific information.
ignore_list is a list of characters that are completely ignored while processing the input string. If ignore_list is NULL, nothing is ignored.
Definition at line 2078 of file gnc-ui-util.c.
gboolean xaccParseAmountExtImport | ( | const char * | in_str, |
gboolean | monetary, | ||
gunichar | negative_sign, | ||
gunichar | decimal_point, | ||
gunichar | group_separator, | ||
const char * | ignore_list, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Similar to xaccParseAmountExtended, but will not automatically set a decimal point, regardless of what the user has set for this option.
Primarily meant for cases where numbers are coming into gnucash that are not typed in by the user (like via csv import).
Definition at line 2090 of file gnc-ui-util.c.
gboolean xaccParseAmountImport | ( | const char * | in_str, |
gboolean | monetary, | ||
gnc_numeric * | result, | ||
char ** | endstr, | ||
gboolean | skip | ||
) |
Similar to xaccParseAmount, but with two differences.
Definition at line 2068 of file gnc-ui-util.c.
const char* xaccPrintAmount | ( | gnc_numeric | val, |
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the returned char* may point to random garbage.
Definition at line 1468 of file gnc-ui-util.c.
int xaccSPrintAmount | ( | char * | bufp, |
gnc_numeric | val, | ||
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the contents of the buffer will be unchanged. It is up to the calling function to ensure that buf is large enough for the results.
bufp | Should be at least 64 chars. |
Definition at line 1337 of file gnc-ui-util.c.