r23419 - gnucash/trunk/src/engine - Don't write the default currency symbol to the output file.

Mike Alexander mta at code.gnucash.org
Wed Nov 20 23:57:31 EST 2013


Author: mta
Date: 2013-11-20 23:57:30 -0500 (Wed, 20 Nov 2013)
New Revision: 23419
Trac: http://svn.gnucash.org/trac/changeset/23419

Modified:
   gnucash/trunk/src/engine/gnc-commodity.c
   gnucash/trunk/src/engine/iso-currencies-to-c.in
Log:
Don't write the default currency symbol to the output file.
Patch by Frédéric Perrin.

Modified: gnucash/trunk/src/engine/gnc-commodity.c
===================================================================
--- gnucash/trunk/src/engine/gnc-commodity.c	2013-11-20 13:20:31 UTC (rev 23418)
+++ gnucash/trunk/src/engine/gnc-commodity.c	2013-11-21 04:57:30 UTC (rev 23419)
@@ -82,6 +82,9 @@
     /* the number of accounts using this commodity - this field is not
      * persisted */
     int       usage_count;
+
+    /* the default display_symbol, set in iso-4217-currencies at start-up */
+    const char * default_symbol;
 } CommodityPrivate;
 
 #define GET_PRIVATE(o) \
@@ -93,6 +96,7 @@
 };
 
 static void commodity_free(gnc_commodity * cm);
+static void gnc_commodity_set_default_symbol(gnc_commodity *, const char *);
 
 struct gnc_commodity_namespace_s
 {
@@ -1136,7 +1140,10 @@
 {
     const char *str;
     if (!cm) return NULL;
-    return kvp_frame_get_string(cm->inst.kvp_data, "user_symbol");
+    str = kvp_frame_get_string(cm->inst.kvp_data, "user_symbol");
+    if (str && *str)
+	return str;
+    return GET_PRIVATE(cm)->default_symbol;
 }
 
 /********************************************************************
@@ -1393,6 +1400,18 @@
 }
 
 /********************************************************************
+ * gnc_commodity_set_default_symbol
+ * Not made visible in gnc-commodity.h, it is only called from
+ * iso-4217-currencies.c at startup.
+ ********************************************************************/
+void
+gnc_commodity_set_default_symbol(gnc_commodity * cm,
+				 const char * default_symbol)
+{
+    GET_PRIVATE(cm)->default_symbol = default_symbol;
+}
+
+/********************************************************************
  * gnc_commodity_increment_usage_count
  ********************************************************************/
 

Modified: gnucash/trunk/src/engine/iso-currencies-to-c.in
===================================================================
--- gnucash/trunk/src/engine/iso-currencies-to-c.in	2013-11-20 13:20:31 UTC (rev 23418)
+++ gnucash/trunk/src/engine/iso-currencies-to-c.in	2013-11-21 04:57:30 UTC (rev 23419)
@@ -54,7 +54,7 @@
         PWARN(\"failed to insert %s into commodity table\", fullname);
       }
     }
-    gnc_commodity_set_user_symbol(c, ~S);
+    gnc_commodity_set_default_symbol(c, ~S);
   }\n"
 	     fullname
 	     namespace



More information about the gnucash-changes mailing list