AUDIT: r15205 - gnucash/trunk - Load and store a commodity's KVP-frame (IFF it's non-empty).

Derek Atkins warlord at cvs.gnucash.org
Mon Dec 11 21:51:37 EST 2006


Author: warlord
Date: 2006-12-11 21:51:37 -0500 (Mon, 11 Dec 2006)
New Revision: 15205
Trac: http://svn.gnucash.org/trac/changeset/15205

Modified:
   gnucash/trunk/
   gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
Log:
Load and store a commodity's KVP-frame (IFF it's non-empty).
This would let us store something like an Asset Class.
BP



Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13679
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13699
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366

Modified: gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-12-11 22:28:36 UTC (rev 15204)
+++ gnucash/trunk/src/backend/file/gnc-commodity-xml-v2.c	2006-12-12 02:51:37 UTC (rev 15205)
@@ -58,6 +58,7 @@
 #define cmdty_get_quotes     "cmdty:get_quotes"
 #define cmdty_quote_source   "cmdty:quote_source"
 #define cmdty_quote_tz       "cmdty:quote_tz"
+#define cmdty_slots          "cmdty:slots"
 
 xmlNodePtr
 gnc_commodity_dom_tree_create(const gnc_commodity *com)
@@ -66,8 +67,11 @@
     const char *string;
     xmlNodePtr ret;
     gboolean currency = gnc_commodity_is_iso(com);
+    xmlNodePtr kvpnode =
+      kvp_frame_to_dom_tree(cmdty_slots,
+			    qof_instance_get_slots(QOF_INSTANCE(com)));
 
-    if (currency && !gnc_commodity_get_quote_flag(com))
+    if (currency && !gnc_commodity_get_quote_flag(com) && !kvpnode)
       return NULL;
 
     ret = xmlNewNode(NULL, BAD_CAST gnc_commodity_string);
@@ -108,6 +112,10 @@
       if (string)
 	xmlAddChild(ret, text_to_dom_tree(cmdty_quote_tz, string));
     }
+
+    if (kvpnode)
+      xmlAddChild(ret, kvpnode);
+
     return ret;
 }
 
@@ -159,6 +167,12 @@
 	gnc_commodity_set_quote_source(com, source);
         xmlFree (string);
     }
+    else if(safe_strcmp((char*)node->name, cmdty_slots) == 0)
+    {
+      /* We ignore the results here */
+      dom_tree_to_kvp_frame_given(node,
+				  qof_instance_get_slots(QOF_INSTANCE(com)));
+    }
     else 
     {
         struct com_char_handler *mark;



More information about the gnucash-changes mailing list