29 #include <glib/gi18n.h>
54 gboolean ask_on_unknown,
55 const char * default_fullname,
56 const char * default_mnemonic)
61 char * tmp_namespace = NULL;
62 GList * commodity_list = NULL;
63 GList * namespace_list = NULL;
64 DEBUG(
"Default fullname received: %s",
65 default_fullname ? default_fullname :
"(null)");
66 DEBUG(
"Default mnemonic received: %s",
67 default_mnemonic ? default_mnemonic :
"(null)");
69 g_return_val_if_fail(cusip, NULL);
70 DEBUG(
"Looking for commodity with exchange_code: %s", cusip);
72 g_assert(commodity_table);
76 namespace_list = g_list_first(namespace_list);
77 while ( namespace_list != NULL && retval == NULL)
79 tmp_namespace = namespace_list->data;
80 DEBUG(
"Looking at namespace %s", tmp_namespace);
86 commodity_list = g_list_first(commodity_list);
87 while ( commodity_list != NULL && retval == NULL)
89 tmp_commodity = commodity_list->data;
96 retval = tmp_commodity;
99 commodity_list = g_list_next(commodity_list);
103 namespace_list = g_list_next(namespace_list);
109 g_list_free(commodity_list);
110 g_list_free(namespace_list);
112 if (retval == NULL && ask_on_unknown != 0)
114 const gchar *message =
115 _(
"Please select a commodity to match the following exchange "
116 "specific code. Please note that the exchange code of the "
117 "commodity you select will be overwritten.");
133 if (retval != NULL &&
const char * gnc_commodity_get_cusip(const gnc_commodity *cm)
gnc_commodity * gnc_import_select_commodity(const char *cusip, gboolean ask_on_unknown, const char *default_fullname, const char *default_mnemonic)
utility functions for the GnuCash UI
#define DEBUG(format, args...)
Account handling public routines.
GList * gnc_commodity_table_get_namespaces(const gnc_commodity_table *table)
void gnc_commodity_set_cusip(gnc_commodity *cm, const char *cusip)
gnc_commodity * gnc_ui_select_commodity_modal_full(gnc_commodity *orig_sel, GtkWidget *parent, dialog_commodity_mode mode, const char *user_message, const char *cusip, const char *fullname, const char *mnemonic)
const char * gnc_commodity_get_fullname(const gnc_commodity *cm)
All type declarations for the whole Gnucash engine.
CommodityList * gnc_commodity_table_get_commodities(const gnc_commodity_table *table, const char *name_space)
A Generic commodity matcher/picker.
API for Transactions and Splits (journal entries)
"select" and "new" commodity windows
const gchar * QofLogModule