r16086 - gnucash/branches/2.0 - Use simpler behavior for setting the "1 xxx = 2 yyy" exchange rate sample

Derek Atkins warlord at cvs.gnucash.org
Mon May 14 10:38:37 EDT 2007


Author: warlord
Date: 2007-05-14 10:38:36 -0400 (Mon, 14 May 2007)
New Revision: 16086
Trac: http://svn.gnucash.org/trac/changeset/16086

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/ChangeLog
   gnucash/branches/2.0/src/gnome-utils/dialog-transfer.c
Log:
Use simpler behavior for setting the "1 xxx = 2 yyy" exchange rate sample
strings in the lower right corner of the transfer dialog.  Don't try and
duplicate the logic that sets the number in the exchange rate field, just pull
the the existing number straight out of the widget.  Fixes #408703.

Merge from r15992



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14724
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14725
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282

Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog	2007-05-14 14:38:23 UTC (rev 16085)
+++ gnucash/branches/2.0/ChangeLog	2007-05-14 14:38:36 UTC (rev 16086)
@@ -11,7 +11,13 @@
 
 	* Changing the transaction number can affect the split sort order and
 	  thus the running account balances.  Fixes #386074.
- 
+
+	* Use simpler behavior for setting the "1 xxx = 2 yyy" exchange
+	  rate sample strings in the lower right corner of the transfer
+	  dialog.  Don't try and duplicate the logic that sets the number
+	  in the exchange rate field, just pull the the existing number
+	  straight out of the widget.  Fixes #408703.
+
 2007-04-21  David Hampton  <hampton at employees.org>
 
 	* Disable the close callback while updating reports.  Fixes #416986.

Modified: gnucash/branches/2.0/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/dialog-transfer.c	2007-05-14 14:38:23 UTC (rev 16085)
+++ gnucash/branches/2.0/src/gnome-utils/dialog-transfer.c	2007-05-14 14:38:36 UTC (rev 16086)
@@ -874,7 +874,7 @@
 {
   const gchar *to_mnemonic, *from_mnemonic;
   gchar *string;
-  gnc_numeric price;
+  gnc_numeric rate;
 
   from_mnemonic = gnc_commodity_get_mnemonic(xferData->from_commodity);
   to_mnemonic = gnc_commodity_get_mnemonic(xferData->to_commodity);
@@ -887,10 +887,8 @@
   if (!from_mnemonic || !to_mnemonic)
     return;
 
-  // price = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
-  price = gnc_xfer_dialog_compute_price(xferData);
-
-  if (gnc_numeric_check(price) || gnc_numeric_zero_p(price)) {
+  rate = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->price_edit));
+  if (gnc_numeric_zero_p(rate)) {
     string = g_strdup_printf("1 %s = x %s", from_mnemonic, to_mnemonic);
     gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
     g_free(string);
@@ -900,14 +898,14 @@
     g_free(string);
   } else {
     string = g_strdup_printf("1 %s = %f %s", from_mnemonic,
-			     gnc_numeric_to_double(price), to_mnemonic);
+			     gnc_numeric_to_double(rate), to_mnemonic);
     gtk_label_set_text(GTK_LABEL(xferData->conv_forward), string);
     g_free(string);
 
-    price = gnc_numeric_div(gnc_numeric_create (1, 1), price,
-			    GNC_DENOM_AUTO, GNC_DENOM_REDUCE);
+    rate = gnc_numeric_div(gnc_numeric_create (1, 1), rate,
+                           GNC_DENOM_AUTO, GNC_DENOM_REDUCE);
     string = g_strdup_printf("1 %s = %f %s", to_mnemonic,
-			     gnc_numeric_to_double(price), from_mnemonic);
+			     gnc_numeric_to_double(rate), from_mnemonic);
     gtk_label_set_text(GTK_LABEL(xferData->conv_reverse), string);
     g_free(string);
   }



More information about the gnucash-changes mailing list