r15281 - gnucash/branches/2.0 - Load and store a commodity's KVP-frame (IFF it's non-empty).
Derek Atkins
warlord at cvs.gnucash.org
Sat Dec 30 14:45:03 EST 2006
Author: warlord
Date: 2006-12-30 14:45:02 -0500 (Sat, 30 Dec 2006)
New Revision: 15281
Trac: http://svn.gnucash.org/trac/changeset/15281
Modified:
gnucash/branches/2.0/
gnucash/branches/2.0/ChangeLog
gnucash/branches/2.0/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.
Approved by chris and others on -devel
Merge from r15205
Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13798
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13799
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog 2006-12-30 19:44:44 UTC (rev 15280)
+++ gnucash/branches/2.0/ChangeLog 2006-12-30 19:45:02 UTC (rev 15281)
@@ -1,3 +1,8 @@
+2006-12-30 Derek Atkins <derek at ihtfp.com>
+
+ * Load and store a commodity's KVP-frame (IFF it's non-empty).
+ This would let us store something like an Asset Class.
+
2006-12-30 Christian Stimming <stimming at tuhh.de>
* Check for potentially failed utf8 conversion of locale strings.
Modified: gnucash/branches/2.0/src/backend/file/gnc-commodity-xml-v2.c
===================================================================
--- gnucash/branches/2.0/src/backend/file/gnc-commodity-xml-v2.c 2006-12-30 19:44:44 UTC (rev 15280)
+++ gnucash/branches/2.0/src/backend/file/gnc-commodity-xml-v2.c 2006-12-30 19:45:02 UTC (rev 15281)
@@ -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);
@@ -114,6 +118,10 @@
if (string)
xmlAddChild(ret, text_to_dom_tree(cmdty_quote_tz, string));
}
+
+ if (kvpnode)
+ xmlAddChild(ret, kvpnode);
+
return ret;
}
@@ -165,6 +173,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