From a7e8bd549929793ffab56ce6af10aa1e61793518 Mon Sep 17 00:00:00 2001 From: Charles Day Date: Thu, 18 Sep 2008 02:26:51 +0000 Subject: [PATCH] GNCAmountEdit: Put the text through the expression parser once instead of twice. This caused a problem in locales that print negative numbers in parentheses. For example, if you entered "-4/3", after the first parse the displayed text would change to "(1 + 1/3)", meaning negative one and one-third. Parsing that text a second time changes the text to "1 + 1/3" since, to the expression parser, parentheses indicate grouping rather than sign. The reason the GNCAmountEdit was putting the text through the parser twice was that it was setting gae->need_to_parse FALSE, but then immediately calling gtk_entry_set_text(), which issues a "changed" signal. The callback for that signal was setting gae->need_to_parse back to TRUE. So I simply changed the order of the statements. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17553 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/gnc-amount-edit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gnome-utils/gnc-amount-edit.c b/src/gnome-utils/gnc-amount-edit.c index cfffce9803..e611ceea1a 100644 --- a/src/gnome-utils/gnc-amount-edit.c +++ b/src/gnome-utils/gnc-amount-edit.c @@ -321,12 +321,12 @@ gnc_amount_edit_set_amount (GNCAmountEdit *gae, gnc_numeric amount) g_return_if_fail(GNC_IS_AMOUNT_EDIT(gae)); g_return_if_fail(!gnc_numeric_check (amount)); + /* Update the display. */ + amount_string = xaccPrintAmount (amount, gae->print_info); + gtk_entry_set_text (GTK_ENTRY(gae), amount_string); + gae->amount = amount; gae->need_to_parse = FALSE; - - amount_string = xaccPrintAmount (amount, gae->print_info); - - gtk_entry_set_text (GTK_ENTRY(gae), amount_string); } /**