mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Update the progress bar while loading the price DB from an XML file.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23429 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3617271ead
commit
71a50a8bb4
@ -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
|
||||
|
@ -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, "</" GNC_V2_STRING ">\n\n") < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user