mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Rob Browning's patch to sort the commodities in the XML output.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3122 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2000-11-05 Rob Browning <rlb@cs.utexas.edu>
|
||||
|
||||
* src/engine/io-gncxml-w.c: sort commodities by namespace and id
|
||||
before writing so we get stable output.
|
||||
|
||||
2000-10-30 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnc-exp-parser.c: modify to use gnc_numerics instead of
|
||||
|
||||
@@ -271,7 +271,23 @@ xml_add_commodity_restorer(xmlNodePtr p, gnc_commodity *c) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gint
|
||||
compare_namespaces(gconstpointer a, gconstpointer b) {
|
||||
const gchar *sa = (const gchar *) a;
|
||||
const gchar *sb = (const gchar *) b;
|
||||
return(safe_strcmp(sa, sb));
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_commodity_ids(gconstpointer a, gconstpointer b) {
|
||||
const gnc_commodity *ca = (const gnc_commodity *) a;
|
||||
const gnc_commodity *cb = (const gnc_commodity *) b;
|
||||
return(safe_strcmp(gnc_commodity_get_mnemonic(ca),
|
||||
gnc_commodity_get_mnemonic(cb)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
xml_add_commodity_restorers(xmlNodePtr p) {
|
||||
gnc_commodity_table *commodities;
|
||||
@@ -283,7 +299,9 @@ xml_add_commodity_restorers(xmlNodePtr p) {
|
||||
commodities = gnc_engine_commodities();
|
||||
if(!commodities) return(FALSE);
|
||||
|
||||
namespaces = gnc_commodity_table_get_namespaces(commodities);
|
||||
namespaces = g_list_sort(gnc_commodity_table_get_namespaces(commodities),
|
||||
compare_namespaces);
|
||||
|
||||
|
||||
for(lp = namespaces; lp; lp = lp->next) {
|
||||
gchar *space;
|
||||
@@ -298,6 +316,8 @@ xml_add_commodity_restorers(xmlNodePtr p) {
|
||||
GList *comms = gnc_commodity_table_get_commodities(commodities, space);
|
||||
GList *lp2;
|
||||
|
||||
comms = g_list_sort(comms, compare_commodity_ids);
|
||||
|
||||
for(lp2 = comms; lp2; lp2 = lp2->next) {
|
||||
gnc_commodity *com = (gnc_commodity *) lp2->data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user