r23429 - gnucash/trunk/src/backend/xml - Update the progress bar while loading the price DB from an XML file.
Mike Alexander
mta at code.gnucash.org
Fri Nov 22 16:07:52 EST 2013
Author: mta
Date: 2013-11-22 16:07:51 -0500 (Fri, 22 Nov 2013)
New Revision: 23429
Trac: http://svn.gnucash.org/trac/changeset/23429
Modified:
gnucash/trunk/src/backend/xml/gnc-pricedb-xml-v2.c
gnucash/trunk/src/backend/xml/io-gncxml-v2.c
Log:
Update the progress bar while loading the price DB from an XML file.
Modified: gnucash/trunk/src/backend/xml/gnc-pricedb-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-pricedb-xml-v2.c 2013-11-22 19:57:31 UTC (rev 23428)
+++ gnucash/trunk/src/backend/xml/gnc-pricedb-xml-v2.c 2013-11-22 21:07:51 UTC (rev 23429)
@@ -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 @@
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 @@
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
Modified: gnucash/trunk/src/backend/xml/io-gncxml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/io-gncxml-v2.c 2013-11-22 19:57:31 UTC (rev 23428)
+++ gnucash/trunk/src/backend/xml/io-gncxml-v2.c 2013-11-22 21:07:51 UTC (rev 23429)
@@ -424,6 +424,10 @@
{
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 @@
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 @@
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 @@
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, "</" GNC_V2_STRING ">\n\n") < 0)
More information about the gnucash-changes
mailing list