diff --git a/src/backend/xml/gnc-schedxaction-xml-v2.c b/src/backend/xml/gnc-schedxaction-xml-v2.c index b6045560fa..940d853559 100644 --- a/src/backend/xml/gnc-schedxaction-xml-v2.c +++ b/src/backend/xml/gnc-schedxaction-xml-v2.c @@ -819,7 +819,7 @@ tt_act_handler( xmlNodePtr node, gpointer data ) table = gnc_commodity_table_get_table( txd->book ); com = gnc_commodity_table_lookup( table, - "template", "template" ); + GNC_COMMODITY_NS_TEMPLATE, "template" ); #else /* FIXME: This should first look in the table of the book, maybe? The right thing happens [WRT file @@ -829,7 +829,7 @@ tt_act_handler( xmlNodePtr node, gpointer data ) applies for SchedXaction.c:xaccSchedXactionInit... */ com = gnc_commodity_new( txd->book, - "template", "template", + "template", GNC_COMMODITY_NS_TEMPLATE, "template", "template", 1 ); #endif diff --git a/src/engine/SchedXaction.c b/src/engine/SchedXaction.c index 23ffb1f178..af1091928c 100644 --- a/src/engine/SchedXaction.c +++ b/src/engine/SchedXaction.c @@ -388,7 +388,7 @@ xaccSchedXactionInit(SchedXaction *sx, QofBook *book) xaccAccountSetCommodity (sx->template_acct, gnc_commodity_table_lookup( gnc_commodity_table_get_table(book), - "template", "template") ); + GNC_COMMODITY_NS_TEMPLATE, "template") ); xaccAccountSetType( sx->template_acct, ACCT_TYPE_BANK ); xaccAccountCommitEdit( sx->template_acct ); ra = gnc_book_get_template_root( book ); diff --git a/src/engine/gnc-commodity.c b/src/engine/gnc-commodity.c index 54ea771f54..a48cb793b7 100644 --- a/src/engine/gnc-commodity.c +++ b/src/engine/gnc-commodity.c @@ -848,7 +848,7 @@ gnc_commodity_new(QofBook *book, const char * fullname, if ( name_space != NULL ) { /* Prevent setting anything except template in namespace template. */ - if (g_strcmp0 (name_space, "template") == 0 && + if (g_strcmp0 (name_space, GNC_COMMODITY_NS_TEMPLATE) == 0 && g_strcmp0 (mnemonic, "template") != 0) { PWARN("Converting commodity %s from namespace template to " @@ -1939,7 +1939,7 @@ gnc_commodity_table_insert(gnc_commodity_table * table, } /* Prevent setting anything except template in namespace template. */ - if (g_strcmp0 (ns_name, "template") == 0 && + if (g_strcmp0 (ns_name, GNC_COMMODITY_NS_TEMPLATE) == 0 && g_strcmp0 (priv->mnemonic, "template") != 0) { PWARN("Converting commodity %s from namespace template to " @@ -2119,7 +2119,7 @@ commodity_table_get_all_noncurrency_commodities(const gnc_commodity_table* table { gnc_commodity_namespace *ns = NULL; if (g_strcmp0((char*)(node->data), GNC_COMMODITY_NS_CURRENCY) == 0 - || g_strcmp0((char*)(node->data), "template") == 0) + || g_strcmp0((char*)(node->data), GNC_COMMODITY_NS_TEMPLATE) == 0) continue; ns = gnc_commodity_table_find_namespace(table, (char*)(node->data)); if (!ns) @@ -2441,8 +2441,8 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book) gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_NASDAQ, book); gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_EUREX, book); gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_MUTUAL, book); - gnc_commodity_table_add_namespace(table, "template", book); - c = gnc_commodity_new(book, "template", "template", "template", "template", 1); + gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_TEMPLATE, book); + c = gnc_commodity_new(book, "template", GNC_COMMODITY_NS_TEMPLATE, "template", "template", 1); gnc_commodity_table_insert(table, c); #include "iso-4217-currencies.c" diff --git a/src/engine/gnc-commodity.h b/src/engine/gnc-commodity.h index f353e7f6e3..161996e50a 100644 --- a/src/engine/gnc-commodity.h +++ b/src/engine/gnc-commodity.h @@ -96,6 +96,7 @@ GType gnc_commodity_namespace_get_type(void); * window. */ #define GNC_COMMODITY_NS_LEGACY "GNC_LEGACY_CURRENCIES" +#define GNC_COMMODITY_NS_TEMPLATE "template" /* The ISO define is deprecated in favor of CURRENCY */ #define GNC_COMMODITY_NS_ISO "ISO4217" #define GNC_COMMODITY_NS_CURRENCY "CURRENCY" diff --git a/src/gnome-utils/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c index 843a155170..0278166457 100644 --- a/src/gnome-utils/dialog-commodity.c +++ b/src/gnome-utils/dialog-commodity.c @@ -636,7 +636,7 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe, /* Skip template, legacy and currency namespaces. The latter was added as first entry earlier */ if ((g_utf8_collate(node->data, GNC_COMMODITY_NS_LEGACY) == 0) || - (g_utf8_collate(node->data, "template" ) == 0) || + (g_utf8_collate(node->data, GNC_COMMODITY_NS_TEMPLATE ) == 0) || (g_utf8_collate(node->data, GNC_COMMODITY_NS_CURRENCY ) == 0)) continue; @@ -1280,11 +1280,11 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w) /* Don't allow user to create commodities in namespace * "template". That's reserved for scheduled transaction use. */ - if (g_utf8_collate(name_space, "template") == 0) + if (g_utf8_collate(name_space, GNC_COMMODITY_NS_TEMPLATE) == 0) { gnc_warning_dialog (w->dialog, _("%s is a reserved commodity type." - " Please use something else."), "template"); + " Please use something else."), GNC_COMMODITY_NS_TEMPLATE); return FALSE; } diff --git a/src/gnome-utils/gnc-tree-model-split-reg.c b/src/gnome-utils/gnc-tree-model-split-reg.c index e895a36401..a7f8ae8a2e 100644 --- a/src/gnome-utils/gnc-tree-model-split-reg.c +++ b/src/gnome-utils/gnc-tree-model-split-reg.c @@ -3292,7 +3292,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity, { gnc_commodity *split_com; split_com = xaccAccountGetCommodity (acc); - if (g_strcmp0 (gnc_commodity_get_namespace (split_com), "template") != 0) + if (g_strcmp0 (gnc_commodity_get_namespace (split_com), GNC_COMMODITY_NS_TEMPLATE) != 0) { DEBUG("Insert trans %p for gl (%s)", trans, name); gtm_sr_insert_trans (model, trans, TRUE); diff --git a/src/gnome/dialog-commodities.c b/src/gnome/dialog-commodities.c index 1a0e385a4a..2495cda295 100644 --- a/src/gnome/dialog-commodities.c +++ b/src/gnome/dialog-commodities.c @@ -283,7 +283,7 @@ gnc_commodities_dialog_filter_ns_func (gnc_commodity_namespace *name_space, /* Never show the template list */ name = gnc_commodity_namespace_get_name (name_space); - if (g_strcmp0 (name, "template") == 0) + if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0) return FALSE; /* Check whether or not to show commodities */ diff --git a/src/gnome/dialog-price-edit-db.c b/src/gnome/dialog-price-edit-db.c index c79504b10c..7187e7f25b 100644 --- a/src/gnome/dialog-price-edit-db.c +++ b/src/gnome/dialog-price-edit-db.c @@ -356,7 +356,7 @@ gnc_price_dialog_filter_ns_func (gnc_commodity_namespace *name_space, /* Never show the template list */ name = gnc_commodity_namespace_get_name (name_space); - if (g_strcmp0 (name, "template") == 0) + if (g_strcmp0 (name, GNC_COMMODITY_NS_TEMPLATE) == 0) return FALSE; /* See if this namespace has commodities */