mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add filter for currency symbol for GNCAmountEdit widget
When pasting an amount that includes the currency symbol the validation will silently fail which may lead to unusual behaviour.
This commit is contained in:
@@ -2784,3 +2784,28 @@ gnc_filter_text_for_currency_symbol (const gchar *incoming_text,
|
||||
g_strfreev (split);
|
||||
return ret_text;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_filter_text_for_currency_commodity (const gnc_commodity *comm,
|
||||
const gchar *incoming_text,
|
||||
const gchar **symbol)
|
||||
{
|
||||
if (!incoming_text)
|
||||
{
|
||||
*symbol = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gnc_commodity_is_currency (comm))
|
||||
{
|
||||
*symbol = NULL;
|
||||
return g_strdup (incoming_text);
|
||||
}
|
||||
|
||||
if (comm)
|
||||
*symbol = gnc_commodity_get_nice_symbol (comm);
|
||||
else
|
||||
*symbol = gnc_commodity_get_nice_symbol (gnc_default_currency ());
|
||||
|
||||
return gnc_filter_text_for_currency_symbol (incoming_text, *symbol);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user