diff --git a/src/backend/xml/gnc-pricedb-xml-v2.c b/src/backend/xml/gnc-pricedb-xml-v2.c index 16cbdda2d1..fad3ff43bd 100644 --- a/src/backend/xml/gnc-pricedb-xml-v2.c +++ b/src/backend/xml/gnc-pricedb-xml-v2.c @@ -32,6 +32,7 @@ #include "sixtp-dom-parsers.h" #include "sixtp-dom-generators.h" #include "io-gncxml-gen.h" +#include "io-gncxml-v2.h" #include "gnc-pricedb.h" #include "gnc-pricedb-p.h" @@ -282,6 +283,8 @@ pricedb_after_child_handler(gpointer data_for_children, const gchar *child_tag, sixtp_child_result *child_result) { + gxpf_data *gdata = global_data; + sixtp_gdv2 *gd = gdata->parsedata; GNCPriceDB *db = (GNCPriceDB *) * result; g_return_val_if_fail(db, FALSE); @@ -296,9 +299,8 @@ pricedb_after_child_handler(gpointer data_for_children, g_return_val_if_fail(p, FALSE); gnc_pricedb_add_price(db, p); - /* can't do this because the v1 parser doesn't use this data - structure as global data */ - /* ((sixtp_gdv2*)global_data)->counter.prices_loaded++; */ + gd->counter.prices_loaded++; + run_callback(gd, "prices"); return TRUE; } else diff --git a/src/backend/xml/io-gncxml-v2.c b/src/backend/xml/io-gncxml-v2.c index b47e5eb1cf..705bcf6f9a 100644 --- a/src/backend/xml/io-gncxml-v2.c +++ b/src/backend/xml/io-gncxml-v2.c @@ -424,6 +424,10 @@ gnc_counter_end_handler(gpointer data_for_children, { sixdata->counter.budgets_total = val; } + else if (g_strcmp0(type, "price") == 0) + { + sixdata->counter.prices_total = val; + } else { struct file_backend be_data; @@ -488,10 +492,12 @@ file_rw_feedback (sixtp_gdv2 *gd, const char *type) counter = &gd->counter; loaded = counter->transactions_loaded + counter->accounts_loaded + counter->books_loaded + counter->commodities_loaded + - counter->schedXactions_loaded + counter->budgets_loaded; + counter->schedXactions_loaded + counter->budgets_loaded + + counter->prices_loaded; total = counter->transactions_total + counter->accounts_total + counter->books_total + counter->commodities_total + - counter->schedXactions_total + counter->budgets_total; + counter->schedXactions_total + counter->budgets_total + + counter->prices_total; if (total == 0) total = 1; @@ -1035,6 +1041,7 @@ write_book(FILE *out, QofBook *book, sixtp_gdv2 *gd) g_list_length(gnc_book_get_schedxactions(book)->sx_list), "budget", qof_collection_count( qof_book_get_collection(book, GNC_ID_BUDGET)), + "price", gnc_pricedb_get_num_prices(gnc_pricedb_get_db(book)), NULL)) return FALSE; @@ -1318,6 +1325,7 @@ gnc_book_write_to_xml_filehandle_v2(QofBook *book, FILE *out) g_list_length(gnc_book_get_schedxactions(book)->sx_list); gd->counter.budgets_total = qof_collection_count( qof_book_get_collection(book, GNC_ID_BUDGET)); + gd->counter.prices_total = gnc_pricedb_get_num_prices(gnc_pricedb_get_db(book)); if (!write_book(out, book, gd) || fprintf(out, "\n\n") < 0)