r17578 - gnucash/branches/2.2/src/app-utils - [r17555, r17576] Fix printing of fractions when parentheses are shown for negative values

Andreas Köhler andi5 at cvs.gnucash.org
Sat Sep 20 21:14:49 EDT 2008


Author: andi5
Date: 2008-09-20 21:14:49 -0400 (Sat, 20 Sep 2008)
New Revision: 17578
Trac: http://svn.gnucash.org/trac/changeset/17578

Modified:
   gnucash/branches/2.2/src/app-utils/gnc-ui-util.c
Log:
[r17555,r17576] Fix printing of fractions when parentheses are shown for negative values

Committed by cedayiv.

Modified: gnucash/branches/2.2/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/branches/2.2/src/app-utils/gnc-ui-util.c	2008-09-21 01:14:35 UTC (rev 17577)
+++ gnucash/branches/2.2/src/app-utils/gnc-ui-util.c	2008-09-21 01:14:49 UTC (rev 17578)
@@ -1483,6 +1483,7 @@
 
    gboolean print_sign = TRUE;
    gboolean is_shares = FALSE;
+   gboolean print_absolute = FALSE;
 
    if (!bufp)
      return 0;
@@ -1570,10 +1571,15 @@
 
    /* Now see if we print parentheses */
    if (print_sign && (sign_posn == 0))
+   {
      bufp = g_stpcpy(bufp, "(");
+     print_absolute = TRUE;
+   }
 
    /* Now print the value */
-   bufp += PrintAmountInternal(bufp, val, &info);
+   bufp += PrintAmountInternal(bufp,
+                               print_absolute? gnc_numeric_abs(val) : val,
+                               &info);
 
    /* Now see if we print parentheses */
    if (print_sign && (sign_posn == 0))



More information about the gnucash-changes mailing list