AUDIT: r17555 - gnucash/trunk/src/app-utils - Fix printing of fractions when parentheses are shown for negative values.
Charles Day
cedayiv at cvs.gnucash.org
Thu Sep 18 16:49:02 EDT 2008
Author: cedayiv
Date: 2008-09-18 16:49:01 -0400 (Thu, 18 Sep 2008)
New Revision: 17555
Trac: http://svn.gnucash.org/trac/changeset/17555
Modified:
gnucash/trunk/src/app-utils/gnc-ui-util.c
Log:
Fix printing of fractions when parentheses are shown for negative values.
BP
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2008-09-18 08:33:27 UTC (rev 17554)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2008-09-18 20:49:01 UTC (rev 17555)
@@ -1253,7 +1253,9 @@
/* Utility function for printing non-negative amounts */
static int
-PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
+PrintAmountInternal(char *buf, gnc_numeric val,
+ const GNCPrintAmountInfo *info,
+ gboolean print_absolute)
{
struct lconv *lc = gnc_localeconv();
int num_whole_digits;
@@ -1401,7 +1403,7 @@
if (whole.num == 0)
*buf = '\0';
- else if (value_is_negative)
+ else if (value_is_negative && !print_absolute)
strcat(buf, " - ");
else
strcat(buf, " + ");
@@ -1483,6 +1485,7 @@
gboolean print_sign = TRUE;
gboolean is_shares = FALSE;
+ gboolean print_absolute = FALSE;
if (!bufp)
return 0;
@@ -1570,10 +1573,13 @@
/* 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, val, &info, print_absolute);
/* Now see if we print parentheses */
if (print_sign && (sign_posn == 0))
More information about the gnucash-changes
mailing list