[Gnucash-changes] Migrate a couple of functions from one file to
the other.
David Hampton
hampton at cvs.gnucash.org
Sat Oct 8 17:36:23 EDT 2005
Log Message:
-----------
Migrate a couple of functions from one file to the other.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash/src/app-utils:
global-options.c
global-options.h
gnc-ui-util.c
gnc-ui-util.h
Revision Data
-------------
Index: global-options.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/global-options.c,v
retrieving revision 1.6.4.6
retrieving revision 1.6.4.7
diff -Lsrc/app-utils/global-options.c -Lsrc/app-utils/global-options.c -u -r1.6.4.6 -r1.6.4.7
--- src/app-utils/global-options.c
+++ src/app-utils/global-options.c
@@ -35,9 +35,6 @@
static GNCOptionDB *global_options = NULL;
-#define KEY_CURRENCY_CHOICE "currency_choice"
-#define KEY_CURRENCY_OTHER "currency_other"
-
/********************************************************************\
* gnc_options_init *
* initialize the options structures from the guile side *
@@ -380,62 +377,6 @@
/********************************************************************\
- * gnc_default_currency *
- * Return the default currency set by the user. *
- * *
- * Args: section - section name of option *
- * name - name of option *
- * default_value - default value to return if problem *
- * Return: currency object or NULL *
-\********************************************************************/
-gnc_commodity *
-gnc_default_currency (void)
-{
- gnc_commodity *currency;
- gchar *choice, *mnemonic;
-
- choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_CURRENCY_CHOICE, NULL);
- if (choice && strcmp(choice, "other") == 0) {
- mnemonic = gnc_gconf_get_string(GCONF_GENERAL, KEY_CURRENCY_OTHER, NULL);
- currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
- GNC_COMMODITY_NS_ISO, mnemonic);
- DEBUG("mnemonic %s, result %p", mnemonic, currency);
- g_free(mnemonic);
- g_free(choice);
-
- if (currency)
- return currency;
- }
-
- return gnc_locale_default_currency ();
-}
-
-gnc_commodity *
-gnc_default_report_currency (void)
-{
- gnc_commodity *currency;
- gchar *choice, *mnemonic;
-
- choice = gnc_gconf_get_string(GCONF_GENERAL_REPORT,
- KEY_CURRENCY_CHOICE, NULL);
- if (choice && strcmp(choice, "other") == 0) {
- mnemonic = gnc_gconf_get_string(GCONF_GENERAL_REPORT,
- KEY_CURRENCY_OTHER, NULL);
- currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
- GNC_COMMODITY_NS_ISO, mnemonic);
- DEBUG("mnemonic %s, result %p", mnemonic, currency);
- g_free(mnemonic);
- g_free(choice);
-
- if (currency)
- return currency;
- }
-
- return gnc_locale_default_currency ();
-}
-
-
-/********************************************************************\
* gnc_set_option_default *
* set the option to its default value *
* *
Index: gnc-ui-util.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/gnc-ui-util.h,v
retrieving revision 1.22.2.11
retrieving revision 1.22.2.12
diff -Lsrc/app-utils/gnc-ui-util.h -Lsrc/app-utils/gnc-ui-util.h -u -r1.22.2.11 -r1.22.2.12
--- src/app-utils/gnc-ui-util.h
+++ src/app-utils/gnc-ui-util.h
@@ -47,7 +47,10 @@
typedef QofSession * (*QofSessionCB) (void);
-/* User Settings ****************************************************/
+/** Returns the account separation character chosen by the user.
+ *
+ * @return The character to use.
+ */
char gnc_get_account_separator (void);
gboolean gnc_reverse_balance(Account *account);
@@ -216,6 +219,25 @@
/* Returns the default ISO currency string of the current locale. */
const char * gnc_locale_default_iso_currency_code (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.
+ *
+ * @return A pointer to a currency.
+ */
+gnc_commodity * gnc_default_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.
+ *
+ * @return A pointer to a currency.
+ */
+gnc_commodity * gnc_default_report_currency (void);
+
+
/* Returns the number of decimal place to print in the current locale */
int gnc_locale_decimal_places (void);
Index: gnc-ui-util.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/gnc-ui-util.c,v
retrieving revision 1.39.2.11
retrieving revision 1.39.2.12
diff -Lsrc/app-utils/gnc-ui-util.c -Lsrc/app-utils/gnc-ui-util.c -u -r1.39.2.11 -r1.39.2.12
--- src/app-utils/gnc-ui-util.c
+++ src/app-utils/gnc-ui-util.c
@@ -51,6 +51,9 @@
#include "guile-mappings.h"
+#define KEY_CURRENCY_CHOICE "currency_choice"
+#define KEY_CURRENCY_OTHER "currency_other"
+
static QofLogModule log_module = GNC_MOD_GUI;
static gboolean auto_decimal_enabled = FALSE;
@@ -808,6 +811,53 @@
}
+gnc_commodity *
+gnc_default_currency (void)
+{
+ gnc_commodity *currency;
+ gchar *choice, *mnemonic;
+
+ choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_CURRENCY_CHOICE, NULL);
+ if (choice && strcmp(choice, "other") == 0) {
+ mnemonic = gnc_gconf_get_string(GCONF_GENERAL, KEY_CURRENCY_OTHER, NULL);
+ currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
+ GNC_COMMODITY_NS_ISO, mnemonic);
+ DEBUG("mnemonic %s, result %p", mnemonic, currency);
+ g_free(mnemonic);
+ g_free(choice);
+
+ if (currency)
+ return currency;
+ }
+
+ return gnc_locale_default_currency ();
+}
+
+gnc_commodity *
+gnc_default_report_currency (void)
+{
+ gnc_commodity *currency;
+ gchar *choice, *mnemonic;
+
+ choice = gnc_gconf_get_string(GCONF_GENERAL_REPORT,
+ KEY_CURRENCY_CHOICE, NULL);
+ if (choice && strcmp(choice, "other") == 0) {
+ mnemonic = gnc_gconf_get_string(GCONF_GENERAL_REPORT,
+ KEY_CURRENCY_OTHER, NULL);
+ currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
+ GNC_COMMODITY_NS_ISO, mnemonic);
+ DEBUG("mnemonic %s, result %p", mnemonic, currency);
+ g_free(mnemonic);
+ g_free(choice);
+
+ if (currency)
+ return currency;
+ }
+
+ return gnc_locale_default_currency ();
+}
+
+
/* Return the number of decimal places for this locale. */
int
gnc_locale_decimal_places (void)
Index: global-options.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/global-options.h,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -Lsrc/app-utils/global-options.h -Lsrc/app-utils/global-options.h -u -r1.6.4.1 -r1.6.4.2
--- src/app-utils/global-options.h
+++ src/app-utils/global-options.h
@@ -78,9 +78,6 @@
const char *name,
gnc_commodity *default_value);
-gnc_commodity * gnc_default_currency (void);
-gnc_commodity * gnc_default_report_currency (void);
-
void gnc_set_option_default(const char *section, const char *name);
gboolean gnc_set_option(const char *section, const char *name, SCM value);
More information about the gnucash-changes
mailing list