29 #include <glib/gi18n.h> 49 static QofLogModule log_module = GNC_MOD_IMPORT;
54 gboolean ask_on_unknown,
55 const char * default_fullname,
56 const char * default_mnemonic)
58 const gnc_commodity_table * commodity_table = gnc_get_current_commodities ();
59 gnc_commodity * retval = NULL;
60 DEBUG(
"Default fullname received: %s", default_fullname);
61 DEBUG(
"Default mnemonic received: %s", default_mnemonic);
63 g_return_val_if_fail(cusip, NULL);
64 DEBUG(
"Looking for commodity with exchange_code: %s", cusip);
66 g_assert(commodity_table);
69 for (GList *n = namespace_list; !retval && n; n = g_list_next (n))
71 auto ns =
static_cast<const char*
>(n->data);
72 DEBUG(
"Looking at namespace %s", ns);
74 for (GList *m = comm_list; !retval && m; m = g_list_next (m))
76 auto com =
static_cast<gnc_commodity*
>(m->data);
84 g_list_free (comm_list);
87 g_list_free(namespace_list);
89 if (retval == NULL && ask_on_unknown != 0)
91 const gchar *message =
92 _(
"Please select a commodity to match the following exchange " 93 "specific code. Please note that the exchange code of the " 94 "commodity you select will be overwritten.");
110 if (retval != NULL &&
const char * gnc_commodity_get_cusip(const gnc_commodity *cm)
Retrieve the 'exchange code' for the specified commodity.
gnc_commodity * gnc_import_select_commodity(const char *cusip, gboolean ask_on_unknown, const char *default_fullname, const char *default_mnemonic)
Must be called with a string containing a unique identifier for the commodity.
utility functions for the GnuCash UI
#define DEBUG(format, args...)
Print a debugging message.
Dialog box should allow selection of anything.
Account handling public routines.
GList * gnc_commodity_table_get_namespaces(const gnc_commodity_table *table)
Return a list of all namespaces in the commodity table.
void gnc_commodity_set_cusip(gnc_commodity *cm, const char *cusip)
Set the 'exchange code' for the specified commodity.
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)
Ask the user to select a commodity from the existing set of commodities.
const char * gnc_commodity_get_fullname(const gnc_commodity *cm)
Retrieve the full name for the specified commodity.
All type declarations for the whole Gnucash engine.
CommodityList * gnc_commodity_table_get_commodities(const gnc_commodity_table *table, const char *name_space)
Return a list of all commodities in the commodity table that are in the given namespace.
A Generic commodity matcher/picker.
API for Transactions and Splits (journal entries)
"select" and "new" commodity windows