Finish cleaning up old uses of NS_ISO. Use the C is_currency function

for both C and Scheme calls.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13777 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-04-14 03:49:14 +00:00
parent 9c24273f83
commit 5f3491f7d3
9 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,14 @@
2006-04-13 David Hampton <hampton@employees.org>
* src/gnome-utils/window-main-summarybar.c:
* src/gnome/dialog-commodities.c:
* src/engine/engine.scm:
* src/engine/commodity-table.scm:
* src/engine/gnc-commodity.c:
* src/app-utils/options.scm: Finish cleaning up old uses of
NS_ISO. Use the C is_currency function for both C and Scheme
calls.
* src/import-export/qif-import/druid-qif-import.c:
* src/import-export/binary-import/druid-commodity.c:
* src/import-export/ofx/gnc-ofx-import.c:

View File

@ -362,7 +362,7 @@
(define (commodity->scm commodity)
(if (string? commodity)
(list 'commodity-scm
GNC_COMMODITY_NS_ISO
GNC_COMMODITY_NS_CURRENCY
commodity)
(list 'commodity-scm
(gnc:commodity-get-namespace commodity)

View File

@ -6,7 +6,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define GNC_COMMODITY_NS_ISO "ISO4217")
(define GNC_COMMODITY_NS_CURRENCY "CURRENCY")
;; If you change the C side, change this too.
(define GNC_COMMODITY_NS_AMEX "AMEX")
@ -14,9 +14,3 @@
(define GNC_COMMODITY_NS_NASDAQ "NASDAQ")
(define GNC_COMMODITY_NS_EUREX "EUREX")
(define GNC_COMMODITY_NS_MUTUAL "FUND")
;; Returns true if the commodity comm represents a currency, false if
;; it represents a stock or mutual-fund.
(define (gnc:commodity-is-currency? comm)
(equal? GNC_COMMODITY_NS_ISO
(gnc:commodity-get-namespace comm)))

View File

@ -36,13 +36,12 @@
(export gnc:gnc-monetary-amount)
(export gnc:monetary-neg)
(export GNC_COMMODITY_NS_ISO)
(export GNC_COMMODITY_NS_CURRENCY)
(export GNC_COMMODITY_NS_NASDAQ)
(export GNC_COMMODITY_NS_NYSE)
(export GNC_COMMODITY_NS_AMEX)
(export GNC_COMMODITY_NS_EUREX)
(export GNC_COMMODITY_NS_MUTUAL)
(export gnc:commodity-is-currency?)
(export gnc:url->loaded-session)
(export gnc:group-map-all-accounts)

View File

@ -1080,7 +1080,7 @@ count_coms(gpointer key, gpointer value, gpointer user_data)
GHashTable *tbl = ((gnc_commodity_namespace*)value)->cm_table;
guint *count = (guint*)user_data;
if(safe_strcmp((char*)key, GNC_COMMODITY_NS_ISO) == 0)
if(safe_strcmp((char*)key, GNC_COMMODITY_NS_CURRENCY) == 0)
{
/* don't count default commodities */
return;

View File

@ -2102,6 +2102,14 @@ of having a parent transaction with which one is working...")
'((<gnc:commodity*> comm))
"Get the number of smallest transactional units per unit of the currency")
(gw:wrap-function
ws
'gnc:commodity-is-currency?
'<gw:bool>
"gnc_commodity_is_currency"
'((<gnc:commodity*> comm))
"return true if the commodity is an ISO4217 currency")
(gw:wrap-function
ws
'gnc:commodity-equiv?

View File

@ -165,8 +165,7 @@ gnc_ui_accounts_recurse (AccountGroup *group, GList **currency_list,
else
euro_commodity = NULL;
if(safe_strcmp(gnc_commodity_get_namespace(account_currency),
GNC_COMMODITY_NS_ISO) != 0) {
if(!gnc_commodity_is_currency(account_currency)) {
non_currency = TRUE;
non_curr_accum = gnc_ui_get_currency_accumulator(currency_list,
options.default_currency,

View File

@ -81,7 +81,7 @@ edit_clicked (CommoditiesDialog *cd)
gnc_commodity *commodity;
commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
if (commodity == NULL || gnc_commodity_is_currency (commodity))
if (commodity == NULL)
return;
if (gnc_ui_edit_commodity_modal (commodity, cd->dialog))

View File

@ -184,7 +184,7 @@
(default-currency
(gnc:commodity-table-find-full
(gnc:book-get-commodity-table (gnc:get-current-book))
GNC_COMMODITY_NS_COMMODITY default-currency-name))
GNC_COMMODITY_NS_CURRENCY default-currency-name))
(sorted-accounts-list '())
(markable-xtns '())
(sorted-qif-files-list