r16975 - gnucash/branches/2.2/src/import-export/qif-import - [r16962] Bug #503166: Correct the QIF druid flow such that the duplicates page and the
Andreas Köhler
andi5 at cvs.gnucash.org
Thu Feb 28 17:09:25 EST 2008
Author: andi5
Date: 2008-02-28 17:09:25 -0500 (Thu, 28 Feb 2008)
New Revision: 16975
Trac: http://svn.gnucash.org/trac/changeset/16975
Modified:
gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c
Log:
[r16962] Bug #503166: Correct the QIF druid flow such that the duplicates page and the
commodities doc page are not shown going backwards if they were not shown
going forwards.
Committed by cedayiv.
Modified: gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c
===================================================================
--- gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c 2008-02-28 22:09:15 UTC (rev 16974)
+++ gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c 2008-02-28 22:09:25 UTC (rev 16975)
@@ -198,6 +198,13 @@
g_free(window);
}
+
+/********************************************************************\
+ * get_next_druid_page
+ *
+ * Determine which page should be shown after the current page.
+\********************************************************************/
+
static GtkWidget *
get_next_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
{
@@ -205,10 +212,11 @@
GList * next;
int where = 0;
+ /* Figure out which stage of the druid we're in. */
if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
- /* where are we? */
+ /* Where are we? */
printf("QIF import: I'm lost!\n");
return FALSE;
}
@@ -225,9 +233,10 @@
}
next = current->next;
- while(!next ||
- (!wind->show_doc_pages &&
- g_list_find(wind->doc_pages, next->data))) {
+ while (!next ||
+ (!wind->show_doc_pages && g_list_find(wind->doc_pages, next->data)) ||
+ (wind->new_stocks == SCM_BOOL_F &&
+ GNOME_DRUID_PAGE(next->data) == get_named_page(wind, "commodity_doc_page"))) {
if(next && next->next) {
next = next->next;
}
@@ -254,6 +263,13 @@
else return NULL;
}
+
+/********************************************************************\
+ * get_prev_druid_page
+ *
+ * Determine which page was shown before the current page.
+\********************************************************************/
+
static GtkWidget *
get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
{
@@ -261,10 +277,11 @@
GList * prev;
int where = 0;
+ /* Figure out which stage of the druid we're in. */
if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
- /* where are we? */
+ /* Where are we? */
printf("QIF import: I'm lost!\n");
return FALSE;
}
@@ -280,14 +297,26 @@
where = 1;
}
- prev = current->prev;
- while(!prev ||
- (!wind->show_doc_pages &&
- g_list_find(wind->doc_pages, prev->data))) {
+ /* If no duplicates were found, skip all post-conversion pages. */
+ if (where == 3 && SCM_NULLP(wind->match_transactions))
+ prev = NULL;
+ else
+ prev = current->prev;
+
+ /* Keep going back through the sets of available pages as long as:
+ * (a) there are no remaining pages in this set, or
+ * (b) the page is a doc page and we're not supposed to show them, or
+ * (c) the page is commodity related and the are no new commodities. */
+ while (!prev ||
+ (!wind->show_doc_pages && g_list_find(wind->doc_pages, prev->data)) ||
+ (wind->new_stocks == SCM_BOOL_F &&
+ GNOME_DRUID_PAGE(prev->data) == get_named_page(wind, "commodity_doc_page"))) {
if(prev && prev->prev) {
+ /* Go back another page within the same stage. */
prev = prev->prev;
}
else {
+ /* Start looking at the end of the previous stage. */
where --;
switch(where) {
case 1:
@@ -1692,6 +1721,10 @@
#undef FUNC_NAME
new_page = make_qif_druid_page(commodity);
+ g_signal_connect(new_page->page, "back",
+ G_CALLBACK(gnc_ui_qif_import_generic_back_cb),
+ wind);
+
g_signal_connect(new_page->page, "next",
G_CALLBACK(gnc_ui_qif_import_comm_check_cb),
wind);
More information about the gnucash-changes
mailing list