AUDIT: r15992 - gnucash/trunk/src/gnome-utils - Use simpler behavior for setting the "1 xxx = 2 yyy" exchange rate sample

David Hampton hampton at cvs.gnucash.org
Sun Apr 22 18:02:17 EDT 2007


Author: hampton
Date: 2007-04-22 18:02:16 -0400 (Sun, 22 Apr 2007)
New Revision: 15992
Trac: http://svn.gnucash.org/trac/changeset/15992

Modified:
   gnucash/trunk/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.
BP


Modified: gnucash/trunk/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-transfer.c	2007-04-22 21:20:06 UTC (rev 15991)
+++ gnucash/trunk/src/gnome-utils/dialog-transfer.c	2007-04-22 22:02:16 UTC (rev 15992)
@@ -768,7 +768,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);
@@ -781,10 +781,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);
@@ -794,14 +792,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