r16974 - gnucash/branches/2.2/src/import-export/qif-import - [r16956] Bug #512173: Skip the "match payees/memos" step of the QIF druid if no mappings

Andreas Köhler andi5 at cvs.gnucash.org
Thu Feb 28 17:09:15 EST 2008


Author: andi5
Date: 2008-02-28 17:09:15 -0500 (Thu, 28 Feb 2008)
New Revision: 16974
Trac: http://svn.gnucash.org/trac/changeset/16974

Modified:
   gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c
   gnucash/branches/2.2/src/import-export/qif-import/qif.glade
Log:
[r16956] Bug #512173: Skip the "match payees/memos" step of the QIF druid if no mappings
are needed.

Patch from Ian Lewis.


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:05 UTC (rev 16973)
+++ gnucash/branches/2.2/src/import-export/qif-import/druid-qif-import.c	2008-02-28 22:09:15 UTC (rev 16974)
@@ -1205,6 +1205,41 @@
   gnc_unset_busy_cursor(NULL);
 }
 
+/****************************************************************
+ * gnc_ui_qif_import_categories_next_cb
+ * Check to see if there are any payees and memos to show. If not
+ * jump to currency page.
+ ****************************************************************/
+static gboolean
+gnc_ui_qif_import_categories_next_cb(GnomeDruidPage * page,
+                                     gpointer arg1,
+                                     gpointer user_data)
+{
+  QIFImportWindow * wind = user_data;
+  SCM  make_memo_display = scm_c_eval_string("qif-dialog:make-memo-display");
+  SCM  accts_left;
+  
+  gnc_set_busy_cursor(NULL, TRUE);
+  /*
+   * Hack. Call make-memo-display to see if there are any memos to display.
+   * This will get called again when we actually do make the memo display.
+   */
+  accts_left = scm_call_3(make_memo_display,
+			  wind->imported_files,
+			  wind->memo_map_info,
+			  wind->gnc_acct_info);
+  
+  gnc_unset_busy_cursor(NULL);
+  
+  if (SCM_NULLP(accts_left)) {
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "currency_page"));
+    return TRUE;
+  } else {
+      return gnc_ui_qif_import_generic_next_cb(page, arg1, user_data);
+  }
+}
+
 /********************************************************************
  * gnc_ui_qif_import_memo_prepare_cb
  ********************************************************************/
@@ -1447,7 +1482,29 @@
   }
 }
 
+/****************************************************************
+ * gnc_ui_qif_import_currency_back_cb
+ * Check to see if there are any payees and memos to show. If not
+ * jump to category match page.
+ ****************************************************************/
+static gboolean
+gnc_ui_qif_import_currency_back_cb(GnomeDruidPage * page, gpointer arg1, 
+                                  gpointer user_data)
+{
+  QIFImportWindow * wind = user_data;
   
+  if (!wind->memo_display_info ||
+      (wind->memo_display_info == SCM_BOOL_F) ||
+       SCM_NULLP(wind->memo_display_info))
+  {
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "category_match_page"));
+    return TRUE;
+  } else {
+      return gnc_ui_qif_import_generic_back_cb(page, arg1, user_data);
+  }
+}
+
 /********************************************************************
  * gnc_ui_qif_import_currency_next_cb
  ********************************************************************/
@@ -2053,16 +2110,24 @@
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_categories_prepare_cb",
      G_CALLBACK (gnc_ui_qif_import_categories_prepare_cb), retval);
-
+  
   glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_categories_next_cb",
+     G_CALLBACK (gnc_ui_qif_import_categories_next_cb), retval);
+  
+  glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_memo_prepare_cb",
      G_CALLBACK (gnc_ui_qif_import_memo_prepare_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_memo_next_cb",
      G_CALLBACK (gnc_ui_qif_import_memo_next_cb), retval);
-
+  
   glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_currency_back_cb",
+     G_CALLBACK (gnc_ui_qif_import_currency_back_cb), retval);
+  
+  glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_currency_next_cb",
      G_CALLBACK (gnc_ui_qif_import_currency_next_cb), retval);
 

Modified: gnucash/branches/2.2/src/import-export/qif-import/qif.glade
===================================================================
--- gnucash/branches/2.2/src/import-export/qif-import/qif.glade	2008-02-28 22:09:05 UTC (rev 16973)
+++ gnucash/branches/2.2/src/import-export/qif-import/qif.glade	2008-02-28 22:09:15 UTC (rev 16974)
@@ -43,7 +43,7 @@
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
 	      <property name="response_id">1</property>
-	      <signal name="clicked" handler="gnc_ui_qif_account_picker_new_cb" last_modification_time="Sat, 25 Oct 2003 19:44:39 GMT"/>
+	      <signal name="clicked" handler="gnc_ui_qif_account_picker_new_cb"/>
 	    </widget>
 	  </child>
 
@@ -799,7 +799,7 @@
 	  <property name="title" translatable="yes">Match QIF categories with GnuCash accounts</property>
 	  <property name="title_foreground">#f5f5f5f5f5f5</property>
 	  <signal name="prepare" handler="gnc_ui_qif_import_categories_prepare_cb"/>
-	  <signal name="next" handler="gnc_ui_qif_import_generic_next_cb"/>
+	  <signal name="next" handler="gnc_ui_qif_import_categories_next_cb"/>
 	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
 
 	  <child internal-child="vbox">
@@ -968,7 +968,7 @@
 	  <property name="title" translatable="yes">Enter the QIF file currency</property>
 	  <property name="title_foreground">#f5f5f5f5f5f5</property>
 	  <signal name="next" handler="gnc_ui_qif_import_currency_next_cb"/>
-	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
+	  <signal name="back" handler="gnc_ui_qif_import_currency_back_cb"/>
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox16">



More information about the gnucash-changes mailing list