mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-28 19:53:58 -06:00
2003-12-18 Herbert Thoma <herbie@hthoma.de>
* src/gnome/dialog-price-editor.c: when the commodity is changed, then set the currency to the currency of the last price entered for this commodity git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9731 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
9be021b247
commit
16aa966f48
@ -250,9 +250,40 @@ price_cancel_clicked (GtkWidget *widget, gpointer data)
|
||||
static void
|
||||
commodity_changed_cb (GNCGeneralSelect *gsl, gpointer data)
|
||||
{
|
||||
GNCBook *book;
|
||||
GNCPriceDB *pdb;
|
||||
gnc_commodity *commodity = NULL;
|
||||
gnc_commodity *currency = NULL;
|
||||
GList *price_list;
|
||||
PriceEditDialog *pedit_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pedit_dialog, TRUE);
|
||||
|
||||
commodity = gnc_general_select_get_selected
|
||||
(GNC_GENERAL_SELECT (pedit_dialog->commodity_edit));
|
||||
|
||||
if(commodity)
|
||||
{
|
||||
book = gnc_price_get_book (pedit_dialog->price);
|
||||
pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
price_list = gnc_pricedb_lookup_latest_any_currency (pdb, commodity);
|
||||
if(price_list)
|
||||
{
|
||||
currency = gnc_price_get_currency((GNCPrice *)price_list->data);
|
||||
|
||||
if (currency)
|
||||
gnc_currency_edit_set_currency
|
||||
(GNC_CURRENCY_EDIT (pedit_dialog->currency_edit), currency);
|
||||
|
||||
gnc_price_list_destroy(price_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_currency_edit_set_currency
|
||||
(GNC_CURRENCY_EDIT (pedit_dialog->currency_edit), gnc_default_currency());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user