AUDIT: r17156 - gnucash/trunk/src/import-export/qif-import - Bug #514210: Allow multiple rows to be selected and remapped on QIF Import

Charles Day cedayiv at cvs.gnucash.org
Tue May 13 22:49:29 EDT 2008


Author: cedayiv
Date: 2008-05-13 22:49:29 -0400 (Tue, 13 May 2008)
New Revision: 17156
Trac: http://svn.gnucash.org/trac/changeset/17156

Modified:
   gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
   gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
Log:
Bug #514210: Allow multiple rows to be selected and remapped on QIF Import
account mapping pages. Also includes many whitespace adjustments.
BP


Modified: gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2008-05-13 23:23:49 UTC (rev 17155)
+++ gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2008-05-14 02:49:29 UTC (rev 17156)
@@ -1,5 +1,5 @@
 /********************************************************************\
- * dialog-account-picker.c -- window for picking a Gnucash account  * 
+ * dialog-account-picker.c -- window for picking a Gnucash account  *
  * from the QIF importer.                                           *
  * Copyright (C) 2000-2001 Bill Gribble <grib at billgribble.com>      *
  * Copyright (c) 2006 David Hampton <hampton at employees.org>         *
@@ -46,14 +46,14 @@
   GtkWidget       * dialog;
   GtkTreeView     * treeview;
   QIFImportWindow * qif_wind;
-  SCM             map_entry;  
+  SCM             map_entry;
   gchar           * selected_name;
 };
 
 static void
 acct_tree_add_accts(SCM accts,
-		    GtkTreeStore *store,
-		    GtkTreeIter *parent,
+                    GtkTreeStore *store,
+                    GtkTreeIter *parent,
                     const char *base_name,
                     const char *selected_name,
                     GtkTreeRowReference **reference)
@@ -64,7 +64,7 @@
   gboolean     leafnode;
   SCM          current;
   gboolean     checked;
-  
+
   while(!SCM_NULLP(accts)) {
     current = SCM_CAR(accts);
 
@@ -79,33 +79,33 @@
     else
       compname = "";
 
-    if(!SCM_NULLP(SCM_CADDR(current))) {
+    if (!SCM_NULLP(SCM_CADDR(current))) {
       leafnode = FALSE;
     }
     else {
       leafnode = TRUE;
     }
 
-    /* compute full name */ 
-    if(base_name && *base_name) {
+    /* compute full name */
+    if (base_name && *base_name) {
       acctname =  g_strjoin(gnc_get_account_separator_string(),
-			    base_name, compname, (char *)NULL);
+                            base_name, compname, (char *)NULL);
     }
     else {
       acctname = g_strdup(compname);
     }
 
-    checked = (SCM_CADR (current) == SCM_BOOL_T);
+    checked = (SCM_CADR(current) == SCM_BOOL_T);
 
     gtk_tree_store_append(store, &iter, parent);
     gtk_tree_store_set(store, &iter,
-		       ACCOUNT_COL_NAME, compname,
-		       ACCOUNT_COL_FULLNAME, acctname,
-		       ACCOUNT_COL_CHECK, checked,
-		       -1);
+                       ACCOUNT_COL_NAME, compname,
+                       ACCOUNT_COL_FULLNAME, acctname,
+                       ACCOUNT_COL_CHECK, checked,
+                       -1);
 
     if (reference && !*reference &&
-	selected_name && (g_utf8_collate(selected_name, acctname) == 0)) {
+        selected_name && (g_utf8_collate(selected_name, acctname) == 0)) {
       GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
       *reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
       gtk_tree_path_free(path);
@@ -113,12 +113,12 @@
 
     if(!leafnode) {
       acct_tree_add_accts(SCM_CADDR(current), store, &iter, acctname,
-			  selected_name, reference);
+                          selected_name, reference);
     }
 
     g_free(acctname);
 
-    accts = SCM_CDR(accts);      
+    accts = SCM_CDR(accts);
   }
 }
 
@@ -126,8 +126,8 @@
 build_acct_tree(QIFAccountPickerDialog * picker, QIFImportWindow * import)
 {
   SCM  get_accts = scm_c_eval_string("qif-import:get-all-accts");
-  SCM  acct_tree = scm_call_1(get_accts, 
-			      gnc_ui_qif_import_druid_get_mappings(import));
+  SCM  acct_tree = scm_call_1(get_accts,
+                              gnc_ui_qif_import_druid_get_mappings(import));
   GtkTreeStore *store;
   GtkTreePath *path;
   GtkTreeSelection* selection;
@@ -137,7 +137,7 @@
   gtk_tree_store_clear(store);
 
   acct_tree_add_accts(acct_tree, store, NULL, NULL,
-		      picker->selected_name, &reference);
+                      picker->selected_name, &reference);
 
   if (reference) {
     selection = gtk_tree_view_get_selection(picker->treeview);
@@ -160,11 +160,11 @@
   char * fullname;
   GtkWidget *dlg, *entry;
 
-  dlg = gtk_message_dialog_new (GTK_WINDOW(wind->dialog),
-				GTK_DIALOG_DESTROY_WITH_PARENT,
-				GTK_MESSAGE_QUESTION,
-				GTK_BUTTONS_OK_CANCEL,
-				"%s", _("Enter a name for the account"));
+  dlg = gtk_message_dialog_new(GTK_WINDOW(wind->dialog),
+                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                GTK_MESSAGE_QUESTION,
+                                GTK_BUTTONS_OK_CANCEL,
+                                "%s", _("Enter a name for the account"));
 
   entry = gtk_entry_new();
   gtk_entry_set_max_length(GTK_ENTRY(entry), 250);
@@ -176,7 +176,7 @@
     name = gtk_entry_get_text(GTK_ENTRY(entry));
     if(wind->selected_name && (strlen(wind->selected_name) > 0)) {
       fullname = g_strjoin(gnc_get_account_separator_string(),
-			   wind->selected_name, name, (char *)NULL);
+                           wind->selected_name, name, (char *)NULL);
     }
     else {
       fullname = g_strdup(name);
@@ -192,8 +192,8 @@
 }
 
 static void
-gnc_ui_qif_account_picker_changed_cb (GtkTreeSelection *selection,
-				      gpointer          user_data)
+gnc_ui_qif_account_picker_changed_cb(GtkTreeSelection *selection,
+                                     gpointer          user_data)
 {
   QIFAccountPickerDialog * wind = user_data;
   SCM name_setter = scm_c_eval_string("qif-map-entry:set-gnc-name!");
@@ -202,22 +202,26 @@
 
   g_free(wind->selected_name);
   if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
-    gtk_tree_model_get(model, &iter, ACCOUNT_COL_FULLNAME, &wind->selected_name, -1);
-    scm_call_2(name_setter, wind->map_entry, scm_makfrom0str(wind->selected_name));
+    gtk_tree_model_get(model, &iter,
+                       ACCOUNT_COL_FULLNAME, &wind->selected_name,
+                       -1);
+    scm_call_2(name_setter, wind->map_entry,
+               scm_makfrom0str(wind->selected_name));
   } else {
     wind->selected_name = NULL;
   }
 }
 
 static void
-gnc_ui_qif_account_picker_row_activated_cb (GtkTreeView *view, GtkTreePath *path,
-					    GtkTreeViewColumn *column,
-					    gpointer user_data)
+gnc_ui_qif_account_picker_row_activated_cb(GtkTreeView *view,
+                                           GtkTreePath *path,
+                                           GtkTreeViewColumn *column,
+                                           gpointer user_data)
 {
   QIFAccountPickerDialog *wind = user_data;
-  g_return_if_fail (wind);
+  g_return_if_fail(wind);
 
-  gtk_dialog_response (GTK_DIALOG (wind->dialog), GTK_RESPONSE_OK);
+  gtk_dialog_response(GTK_DIALOG(wind->dialog), GTK_RESPONSE_OK);
 }
 
 static int
@@ -232,21 +236,22 @@
   return FALSE;
 }
 
+
 /****************************************************************
  * qif_account_picker_dialog
- * select an account from the ones that the engine knows about, plus
- * the ones that will be created newly by the QIF import.  this is
- * sort of like fileBox... it returns a string for the account name or
- * NULL on cancel.  It's modal.
+ *
+ * Select an account from the ones that the engine knows about,
+ * plus those that will be created by the QIF import.  Returns
+ * a new Scheme map entry, or SCM_BOOL_F on cancel. Modal.
  ****************************************************************/
 
 SCM
 qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
-{  
+{
   QIFAccountPickerDialog * wind;
-  SCM save_entry   = scm_c_eval_string("qif-map-entry:clone");
+  SCM clone_entry  = scm_c_eval_string("qif-map-entry:clone");
   SCM init_pick    = scm_c_eval_string("qif-map-entry:gnc-name");
-  SCM saved_entry  = scm_call_1(save_entry, map_entry);
+  SCM new_entry    = scm_call_1(clone_entry, map_entry);
   int response;
   const gchar * scmname;
   GladeXML *xml;
@@ -254,19 +259,20 @@
 
   wind = g_new0(QIFAccountPickerDialog, 1);
 
-  xml = gnc_glade_xml_new ("qif.glade", "QIF Import Account Picker");
+  xml = gnc_glade_xml_new("qif.glade", "QIF Import Account Picker");
 
-  glade_xml_signal_connect_data
-    (xml, "gnc_ui_qif_account_picker_new_cb",
-     G_CALLBACK (gnc_ui_qif_account_picker_new_cb), wind);
+  glade_xml_signal_connect_data(xml,
+                                "gnc_ui_qif_account_picker_new_cb",
+                                G_CALLBACK(gnc_ui_qif_account_picker_new_cb),
+                                wind);
 
-  wind->dialog     = glade_xml_get_widget (xml, "QIF Import Account Picker");
-  wind->treeview   = GTK_TREE_VIEW(glade_xml_get_widget (xml, "account_tree"));
+  wind->dialog     = glade_xml_get_widget(xml, "QIF Import Account Picker");
+  wind->treeview   = GTK_TREE_VIEW(glade_xml_get_widget(xml, "account_tree"));
   wind->qif_wind   = qif_wind;
 
-  wind->map_entry  = map_entry;
-  
-  scmname = SCM_STRING_CHARS(scm_call_1(init_pick, map_entry));
+  wind->map_entry  = new_entry;
+
+  scmname = SCM_STRING_CHARS(scm_call_1(init_pick, new_entry));
   wind->selected_name = g_strdup(scmname);
 
   scm_gc_protect_object(wind->map_entry);
@@ -278,40 +284,44 @@
     GtkTreeSelection *selection;
 
     store = gtk_tree_store_new(NUM_ACCOUNT_COLS, G_TYPE_STRING, G_TYPE_STRING,
-			       G_TYPE_BOOLEAN);
+                               G_TYPE_BOOLEAN);
     gtk_tree_view_set_model(wind->treeview, GTK_TREE_MODEL(store));
     g_object_unref(store);
 
     renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
-						      "text", ACCOUNT_COL_NAME,
-						      NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("Account"),
+                                                      renderer,
+                                                      "text",
+                                                      ACCOUNT_COL_NAME,
+                                                      NULL);
     g_object_set(column, "expand", TRUE, NULL);
     gtk_tree_view_append_column(wind->treeview, column);
 
     renderer = gtk_cell_renderer_toggle_new();
     g_object_set(renderer, "activatable", FALSE, NULL);
-    column = gtk_tree_view_column_new_with_attributes(_("New?"), renderer,
-						      "active", ACCOUNT_COL_CHECK,
-						      NULL);
+    column = gtk_tree_view_column_new_with_attributes(_("New?"),
+                                                      renderer,
+                                                      "active",
+                                                      ACCOUNT_COL_CHECK,
+                                                      NULL);
     gtk_tree_view_append_column(wind->treeview, column);
 
     selection = gtk_tree_view_get_selection(wind->treeview);
     g_signal_connect(selection, "changed",
-		     G_CALLBACK(gnc_ui_qif_account_picker_changed_cb), wind);
+                     G_CALLBACK(gnc_ui_qif_account_picker_changed_cb), wind);
     g_signal_connect(wind->treeview, "row-activated",
-		     G_CALLBACK(gnc_ui_qif_account_picker_row_activated_cb),
-		     wind);
+                     G_CALLBACK(gnc_ui_qif_account_picker_row_activated_cb),
+                     wind);
   }
 
   g_signal_connect_after(wind->dialog, "map",
-			 G_CALLBACK(gnc_ui_qif_account_picker_map_cb),
-			 wind);
-  
-  button = glade_xml_get_widget (xml, "newbutton");
+                         G_CALLBACK(gnc_ui_qif_account_picker_map_cb),
+                         wind);
+
+  button = glade_xml_get_widget(xml, "newbutton");
   gtk_button_set_use_stock(GTK_BUTTON(button), TRUE);
 
-  /* this is to get the checkmarks set up right.. it will get called 
+  /* this is to get the checkmarks set up right.. it will get called
    * again after the window is mapped. */
   build_acct_tree(wind, wind->qif_wind);
 
@@ -324,10 +334,8 @@
   g_free(wind->selected_name);
   g_free(wind);
 
-  if (response == GTK_RESPONSE_OK) {
-    return map_entry;
-  }
-  else {
-    return saved_entry;
-  }
+  if (response == GTK_RESPONSE_OK)
+    return new_entry;
+
+  return SCM_BOOL_F;
 }

Modified: gnucash/trunk/src/import-export/qif-import/druid-qif-import.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/druid-qif-import.c	2008-05-13 23:23:49 UTC (rev 17155)
+++ gnucash/trunk/src/import-export/qif-import/druid-qif-import.c	2008-05-14 02:49:29 UTC (rev 17156)
@@ -97,7 +97,7 @@
   GtkWidget * currency_picker;
   GtkWidget * new_transaction_view;
   GtkWidget * old_transaction_view;
-  
+
   GList     * pre_comm_pages;
   GList     * commodity_pages;
   GList     * post_comm_pages;
@@ -108,7 +108,7 @@
   SCM       imported_files;
   SCM       selected_file;
 
-  SCM       acct_map_info; 
+  SCM       acct_map_info;
   SCM       acct_display_info;
 
   SCM       cat_map_info;
@@ -136,7 +136,7 @@
   GtkWidget     *new_mnemonic_entry;
   gnc_commodity *commodity;
   SCM            hash_key;
-};  
+};
 
 typedef struct _qifdruidpage QIFDruidPage;
 static QIFDruidPage * make_qif_druid_page(SCM security_hash_key,
@@ -148,8 +148,8 @@
 static void update_memo_page(QIFImportWindow * win);
 
 static void update_account_picker_page(QIFImportWindow * wind,
-				       SCM make_display, GtkWidget *view,
-				       SCM map_info, SCM * display_info);
+                                       SCM make_display, GtkWidget *view,
+                                       SCM map_info, SCM * display_info);
 
 static void gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
                                                    gpointer arg1,
@@ -213,7 +213,7 @@
 \********************************************************************/
 
 void
-gnc_ui_qif_import_druid_destroy (QIFImportWindow * window)
+gnc_ui_qif_import_druid_destroy(QIFImportWindow * window)
 {
   if (!window)
     return;
@@ -253,13 +253,13 @@
  * do a better job of notifying someone.)
 \********************************************************************/
 
-static GtkWidget * 
+static GtkWidget *
 get_next_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
 {
   GList     * current = NULL;
   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) {
@@ -279,7 +279,7 @@
   else {
     where = 1;
   }
-  
+
   next = current->next;
   while (!next ||
          (!wind->show_doc_pages && g_list_find(wind->doc_pages, next->data)) ||
@@ -303,12 +303,14 @@
         if (where > 3)
           return NULL;
         break;
-      }              
+      }
     }
   }
 
-  if(next) return (GtkWidget *)next->data;
-  else return NULL;
+  if (next)
+    return (GtkWidget *)next->data;
+
+  return NULL;
 }
 
 
@@ -320,13 +322,13 @@
  * to do a better job of notifying someone.)
  ********************************************************************/
 
-static GtkWidget * 
+static GtkWidget *
 get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
 {
   GList     * current = NULL;
   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) {
@@ -346,7 +348,7 @@
   else {
     where = 1;
   }
-  
+
   /* If no duplicates were found, skip all post-conversion pages. */
   if (where == 3 && SCM_NULLP(wind->match_transactions))
     prev = NULL;
@@ -390,14 +392,14 @@
         if (where < 1)
           return NULL;
         break;
-      }              
+      }
     }
   }
 
   if(prev)
     return (GtkWidget *)prev->data;
-  else 
-    return NULL;
+
+  return NULL;
 }
 
 
@@ -408,16 +410,16 @@
  ********************************************************************/
 
 static gboolean
-gnc_ui_qif_import_generic_next_cb(GnomeDruidPage * page, gpointer arg1, 
+gnc_ui_qif_import_generic_next_cb(GnomeDruidPage * page, gpointer arg1,
                                   gpointer user_data)
 {
   QIFImportWindow * wind = user_data;
   GtkWidget * next_page = get_next_druid_page(wind, page);
-  
+
   if(next_page) {
     gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          GNOME_DRUID_PAGE(next_page));
-    
+
     return TRUE;
   }
   else {
@@ -433,12 +435,12 @@
  ********************************************************************/
 
 static gboolean
-gnc_ui_qif_import_generic_back_cb(GnomeDruidPage * page, gpointer arg1, 
+gnc_ui_qif_import_generic_back_cb(GnomeDruidPage * page, gpointer arg1,
                                   gpointer user_data)
 {
   QIFImportWindow * wind = user_data;
   GtkWidget * back_page = get_prev_druid_page(wind, page);
-  
+
   if(back_page) {
     gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          GNOME_DRUID_PAGE(back_page));
@@ -454,7 +456,7 @@
  * gnc_ui_qif_import_select_file_cb
  *
  * invoked when the "select file" button is clicked
- * this is just to pick a file name and reset-to-defaults all the 
+ * this is just to pick a file name and reset-to-defaults all the
  * fields describing how to parse the file.
  ********************************************************************/
 
@@ -470,13 +472,13 @@
   /* Default to whatever's already present */
   default_dir = gnc_get_default_directory(GCONF_SECTION);
 
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, "*.qif");
-  gtk_file_filter_add_pattern (filter, "*.[Qq][Ii][Ff]");
-  new_file_name = gnc_file_dialog (_("Select QIF File"),
-				   g_list_prepend (NULL, filter),
-				   default_dir,
-				   GNC_FILE_DIALOG_IMPORT);
+  filter = gtk_file_filter_new();
+  gtk_file_filter_set_name(filter, "*.qif");
+  gtk_file_filter_add_pattern(filter, "*.[Qq][Ii][Ff]");
+  new_file_name = gnc_file_dialog(_("Select QIF File"),
+                                  g_list_prepend (NULL, filter),
+                                  default_dir,
+                                  GNC_FILE_DIALOG_IMPORT);
 
   /* Insure valid data, and something that can be freed. */
   if (new_file_name == NULL) {
@@ -501,37 +503,37 @@
 
 /********************************************************************
  * gnc_ui_qif_import_load_file_back_cb
- * 
+ *
  * Invoked when the "back" button is clicked on the load file page.
  ********************************************************************/
 
 static gboolean
-gnc_ui_qif_import_load_file_back_cb(GnomeDruidPage * page, gpointer arg1, 
-				    gpointer user_data)
+gnc_ui_qif_import_load_file_back_cb(GnomeDruidPage * page, gpointer arg1,
+                                    gpointer user_data)
 {
   QIFImportWindow * wind = user_data;
 
   if (SCM_LISTP(wind->imported_files) &&
       (scm_ilength(wind->imported_files) > 0)) {
-    gnome_druid_set_page(GNOME_DRUID(wind->druid), 
-			 get_named_page(wind, "loaded_files_page"));
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "loaded_files_page"));
     return TRUE;
   }
 
-  gnome_druid_set_page(GNOME_DRUID(wind->druid), 
-		       get_named_page(wind, "start_page"));
+  gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                       get_named_page(wind, "start_page"));
   return TRUE;
 }
 
 
 /********************************************************************
  * gnc_ui_qif_import_load_file_next_cb
- * 
+ *
  * Invoked when the "next" button is clicked on the load file page.
  ********************************************************************/
 
 static gboolean
-gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page, 
+gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
                                     gpointer arg1,
                                     gpointer user_data)
 {
@@ -556,7 +558,7 @@
   SCM window;
   int ask_date_format = FALSE;
 
-  /* get the file name */ 
+  /* get the file name */
   path_to_load = gtk_entry_get_text(GTK_ENTRY(wind->filename_entry));
   window = SWIG_NewPointerObj(wind->window, SWIG_TypeQuery("_p_GtkWidget"), 0);
 
@@ -568,16 +570,16 @@
   }
   else if (g_access(path_to_load, R_OK) < 0) {
     /* stay here if bad file */
-    gnc_error_dialog(wind->window, 
-		     _("File not found or read permission denied. "
-		       "Please select another file."));
+    gnc_error_dialog(wind->window,
+                     _("File not found or read permission denied. "
+                       "Please select another file."));
     return TRUE;
   }
   else {
     /* convert filename to scm */
     scm_filename   = scm_makfrom0str(path_to_load);
     imported_files = wind->imported_files;
-    
+
     if(scm_call_2(qif_file_loaded, scm_filename, wind->imported_files)
        == SCM_BOOL_T) {
       gnc_error_dialog(wind->window,
@@ -585,53 +587,53 @@
                                   "Please select another file."));
       return TRUE;
     }
-    
+
     /* turn on the busy cursor */
     gnc_set_busy_cursor(NULL, TRUE);
-    
+
     /* create the <qif-file> object */
-    scm_qiffile          = scm_call_0(make_qif_file);    
-    imported_files       = scm_cons(scm_qiffile, imported_files);    
+    scm_qiffile          = scm_call_0(make_qif_file);
+    imported_files       = scm_cons(scm_qiffile, imported_files);
 
-    scm_gc_unprotect_object(wind->selected_file);      
-    wind->selected_file  = scm_qiffile;    
-    scm_gc_protect_object(wind->selected_file);      
-    
+    scm_gc_unprotect_object(wind->selected_file);
+    wind->selected_file  = scm_qiffile;
+    scm_gc_protect_object(wind->selected_file);
+
     /* load the file */
     load_return = scm_call_4(qif_file_load, SCM_CAR(imported_files),
-			     scm_filename, wind->ticker_map, window);
-    
+                             scm_filename, wind->ticker_map, window);
+
     /* turn back the cursor */
     gnc_unset_busy_cursor(NULL);
 
-    /* a list returned is (#f error-message) for an error, 
-     * (#t error-message) for a warning, or just #f for an 
+    /* a list returned is (#f error-message) for an error,
+     * (#t error-message) for a warning, or just #f for an
      * exception. */
     if(SCM_LISTP(load_return) &&
        (SCM_CAR(load_return) == SCM_BOOL_T)) {
       const gchar *warn_str = SCM_STRING_CHARS(SCM_CADR(load_return));
       gnc_warning_dialog(GTK_WIDGET(wind->window),
-			 _("QIF file load warning: %s"),
-			 warn_str ? warn_str : "(null)");
+                         _("QIF file load warning: %s"),
+                         warn_str ? warn_str : "(null)");
     }
 
     /* check success of the file load */
     if(load_return == SCM_BOOL_F) {
-      gnc_error_dialog(wind->window, 
-		       _( "An error occurred while loading the QIF file."));
+      gnc_error_dialog(wind->window,
+                       _( "An error occurred while loading the QIF file."));
       return TRUE;
     }
     else if ((load_return != SCM_BOOL_T) &&
-             (!SCM_LISTP(load_return) || 
+             (!SCM_LISTP(load_return) ||
               (SCM_CAR(load_return) != SCM_BOOL_T))) {
       const gchar *warn_str = SCM_STRING_CHARS(SCM_CADR(load_return));
       gnc_error_dialog(wind->window,
-		       _("QIF file load failed: %s"),
-		       warn_str ? warn_str : "(null)");
+                       _("QIF file load failed: %s"),
+                       warn_str ? warn_str : "(null)");
 
-      imported_files = 
+      imported_files =
         scm_call_2(unload_qif_file, scm_qiffile, imported_files);
-            
+
       scm_gc_unprotect_object(wind->imported_files);
       wind->imported_files = imported_files;
       scm_gc_protect_object(wind->imported_files);
@@ -644,43 +646,43 @@
 
       /* call the field parser */
       parse_return = scm_call_1(qif_file_parse, SCM_CAR(imported_files));
-      
+
       /* parser returns:
-       *   success:	#t
-       *   failure:	(#f . ((type . errror) ...))
-       *   warning:	(#t . ((type . error) ...))
+       *   success: #t
+       *   failure: (#f . ((type . errror) ...))
+       *   warning: (#t . ((type . error) ...))
        *
        * warning means that (potentially) the date format is
        * ambiguous.  So search the results for the "date" type and if
        * it's found, set up the format selector page.
        */
-      if(SCM_LISTP(parse_return) && 
+      if(SCM_LISTP(parse_return) &&
          (SCM_CAR(parse_return) == SCM_BOOL_T)) {
-	gint n_items;
+        gint n_items;
 
-	/* clear the combo box */
-	gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), -1);
-	n_items = gtk_tree_model_iter_n_children(
-	  gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo)), NULL);
-	while (n_items-- > 0)
-	  gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0);
+        /* clear the combo box */
+        gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), -1);
+        n_items = gtk_tree_model_iter_n_children(
+          gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo)), NULL);
+        while (n_items-- > 0)
+          gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0);
 
-	if ((date_formats = scm_call_2(parse_results,
-				       SCM_CDR(parse_return),
-				       scm_str2symbol("date"))) != SCM_BOOL_F) {
-	  while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats)) {
-	    gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
-				      SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
-	    date_formats = SCM_CDR(date_formats);
-	  }
-	gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), 0);
-        
-	  ask_date_format = TRUE;
+        if ((date_formats = scm_call_2(parse_results,
+                                       SCM_CDR(parse_return),
+                                       scm_str2symbol("date"))) != SCM_BOOL_F) {
+          while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats)) {
+            gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
+                                      SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
+            date_formats = SCM_CDR(date_formats);
+          }
+        gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), 0);
 
-	} else {
-	  /* FIXME: we've got a "warning" but it's not the date! */
-	  ;
-	}
+          ask_date_format = TRUE;
+
+        } else {
+          /* FIXME: we've got a "warning" but it's not the date! */
+          ;
+        }
       }
 
       /* turn back the cursor */
@@ -689,8 +691,8 @@
       /* Can this ever happen??? */
       if(parse_return == SCM_BOOL_F) {
         gnc_error_dialog(wind->window,
-			 _("An error occurred while parsing the QIF file."));
-        imported_files = 
+                         _("An error occurred while parsing the QIF file."));
+        imported_files =
           scm_call_2(unload_qif_file, scm_qiffile, imported_files);
         return TRUE;
       }
@@ -699,20 +701,20 @@
           (SCM_CAR(parse_return) != SCM_BOOL_T))) {
         const gchar *warn_str = SCM_STRING_CHARS(SCM_CDADR(parse_return));
         gnc_error_dialog(wind->window,
-			 _("QIF file parse failed: %s"),
-			 warn_str ? warn_str : "(null)");
+                         _("QIF file parse failed: %s"),
+                         warn_str ? warn_str : "(null)");
 
-        imported_files = 
+        imported_files =
           scm_call_2(unload_qif_file, scm_qiffile, imported_files);
-        
+
         return TRUE;
-      } 
+      }
     }
-    
+
     scm_gc_unprotect_object(wind->imported_files);
     wind->imported_files = imported_files;
     scm_gc_protect_object(wind->imported_files);
-    
+
     if(ask_date_format) {
       /* we need to get a date format, so go to the next page */
       return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
@@ -720,26 +722,26 @@
     else if(scm_call_1(check_from_acct, SCM_CAR(imported_files)) != SCM_BOOL_T) {
       /* skip to the "ask account name" page */
       default_acctname =
-	SCM_STRING_CHARS(scm_call_1(default_acct, SCM_CAR(imported_files)));
+        SCM_STRING_CHARS(scm_call_1(default_acct, SCM_CAR(imported_files)));
       gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname);
-      
+
       gnome_druid_set_page(GNOME_DRUID(wind->druid),
                            get_named_page(wind, "account_name_page"));
       return TRUE;
     }
     else {
       /* skip ahead to the "loaded files" page */
-      gnome_druid_set_page(GNOME_DRUID(wind->druid), 
+      gnome_druid_set_page(GNOME_DRUID(wind->druid),
                            get_named_page(wind, "loaded_files_page"));
-      return TRUE;      
+      return TRUE;
     }
   }
-  
+
   return FALSE;
 }
 
 static gboolean
-gnc_ui_qif_import_date_format_next_cb(GnomeDruidPage * page, 
+gnc_ui_qif_import_date_format_next_cb(GnomeDruidPage * page,
                                       gpointer arg1,
                                       gpointer user_data)
 {
@@ -749,28 +751,28 @@
   SCM  check_from_acct = scm_c_eval_string("qif-file:check-from-acct");
   SCM  format_sym;
   gchar *text;
-  
+
   text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->date_format_combo));
   format_sym = scm_str2symbol(text);
   g_free(text);
   scm_call_2(reparse_dates, wind->selected_file, format_sym);
-  
+
   if(scm_call_1(check_from_acct, wind->selected_file) != SCM_BOOL_T) {
     SCM default_acct    = scm_c_eval_string("qif-file:path-to-accountname");
     const gchar * default_acctname;
 
     default_acctname = SCM_STRING_CHARS(scm_call_1(default_acct,
-						wind->selected_file));
+                                                    wind->selected_file));
     gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname);
 
     return FALSE;
   }
   else {
     /* skip ahead to the "loaded files" page */
-    gnome_druid_set_page(GNOME_DRUID(wind->druid), 
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          get_named_page(wind, "loaded_files_page"));
-    
-    return TRUE;      
+
+    return TRUE;
   }
 }
 
@@ -781,8 +783,8 @@
  ****************************************************************/
 
 static void
-gnc_ui_qif_import_select_loaded_file_cb (GtkTreeSelection *selection,
-					 gpointer          user_data)   
+gnc_ui_qif_import_select_loaded_file_cb(GtkTreeSelection *selection,
+                                        gpointer          user_data)
 {
   QIFImportWindow * wind = user_data;
   GtkTreeModel *model;
@@ -793,16 +795,16 @@
   button = gnc_glade_lookup_widget(wind->window, "unload_file_button");
   if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
     gtk_tree_model_get(model, &iter, FILENAME_COL_INDEX, &row, -1);
-    if(SCM_LISTP(wind->imported_files) && 
+    if(SCM_LISTP(wind->imported_files) &&
        (scm_ilength(wind->imported_files) > row)) {
       scm_gc_unprotect_object(wind->selected_file);
       wind->selected_file = scm_list_ref(wind->imported_files,
-					 scm_int2num(row));   
+                                         scm_int2num(row));
       scm_gc_protect_object(wind->selected_file);
       g_object_set(button, "sensitive", TRUE, (gchar*)NULL);
       gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
                                         TRUE, TRUE, TRUE, TRUE);
-    } 
+    }
   } else {
     scm_gc_unprotect_object(wind->selected_file);
     wind->selected_file = SCM_BOOL_F;
@@ -816,7 +818,7 @@
 
 /********************************************************************
  * gnc_ui_qif_import_loaded_files_prepare_cb
- * 
+ *
  * Get the loaded files page ready for viewing
  ********************************************************************/
 
@@ -844,11 +846,11 @@
                                   gpointer user_data)
 {
   QIFImportWindow * wind = user_data;
-  
+
   gnome_druid_set_page(GNOME_DRUID(wind->druid),
                        get_named_page(wind, "load_file_page"));
   gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
-                                    TRUE, TRUE, TRUE, TRUE); 
+                                    TRUE, TRUE, TRUE, TRUE);
 }
 
 
@@ -866,11 +868,11 @@
 
   SCM unload_qif_file = scm_c_eval_string("qif-dialog:unload-qif-file");
   SCM imported_files;
-  
+
   if(wind->selected_file != SCM_BOOL_F) {
-    imported_files = 
+    imported_files =
       scm_call_2(unload_qif_file, wind->selected_file, wind->imported_files);
-  
+
     scm_gc_unprotect_object(wind->imported_files);
     wind->imported_files = imported_files;
     scm_gc_protect_object(wind->imported_files);
@@ -878,7 +880,7 @@
     scm_gc_unprotect_object(wind->selected_file);
     wind->selected_file = SCM_BOOL_F;
     scm_gc_protect_object(wind->selected_file);
-     
+
     update_file_page(wind);
   }
 }
@@ -886,13 +888,13 @@
 
 /********************************************************************
  * update_file_page
- * update the list of loaded files 
+ * update the list of loaded files
  ********************************************************************/
 
 static void
 update_file_page(QIFImportWindow * wind)
 {
-  
+
   SCM       loaded_file_list = wind->imported_files;
   SCM       scm_qiffile = SCM_BOOL_F;
   SCM       qif_file_path;
@@ -909,16 +911,16 @@
   store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
   gtk_list_store_clear(store);
   qif_file_path = scm_c_eval_string("qif-file:path");
-  
-  while(!SCM_NULLP(loaded_file_list)) {  
+
+  while(!SCM_NULLP(loaded_file_list)) {
     scm_qiffile = SCM_CAR(loaded_file_list);
     row_text    = SCM_STRING_CHARS(scm_call_1(qif_file_path, scm_qiffile));
 
     gtk_list_store_append(store, &iter);
     gtk_list_store_set(store, &iter,
-		       FILENAME_COL_INDEX, row++,
-		       FILENAME_COL_NAME, row_text,
-		       -1);
+                       FILENAME_COL_INDEX, row++,
+                       FILENAME_COL_NAME, row_text,
+                       -1);
     if(scm_qiffile == wind->selected_file) {
       path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
       reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
@@ -942,7 +944,7 @@
 
 /********************************************************************
  * gnc_ui_qif_import_default_acct_next_cb
- * 
+ *
  * Invoked when the "next" button is clicked on the default acct page.
  ********************************************************************/
 
@@ -970,9 +972,9 @@
 
 /********************************************************************
  * gnc_ui_qif_import_default_acct_back_cb
- * 
+ *
  * Invoked when the "back" button is clicked on the default acct page.
- * this unloads the current file.  
+ * this unloads the current file.
  ********************************************************************/
 
 static gboolean
@@ -989,21 +991,21 @@
   scm_gc_unprotect_object(wind->imported_files);
   wind->imported_files = files_list;
   scm_gc_protect_object(wind->imported_files);
-  
+
   scm_gc_unprotect_object(wind->selected_file);
   wind->selected_file = SCM_BOOL_F;
   scm_gc_protect_object(wind->selected_file);
-  
+
   gnome_druid_set_page(GNOME_DRUID(wind->druid),
                        get_named_page(wind, "load_file_page"));
   gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
-                                    TRUE, TRUE, TRUE, TRUE); 
+                                    TRUE, TRUE, TRUE, TRUE);
   return TRUE;
 }
 
 
 /****************************************************************
- * update_account_picker_page 
+ * update_account_picker_page
  * Generic function to update an account_picker page.  This
  * generalizes the code shared whenever any QIF -> GNC mapper is
  * updating it's LIST STORE.  It asks the Scheme side to guess some account
@@ -1013,7 +1015,7 @@
 
 static void
 update_account_picker_page(QIFImportWindow * wind, SCM make_display,
-			   GtkWidget *view, SCM map_info, SCM * display_info)
+                           GtkWidget *view, SCM map_info, SCM * display_info)
 {
 
   SCM  get_qif_name = scm_c_eval_string("qif-map-entry:qif-name");
@@ -1033,14 +1035,14 @@
 
   /* now get the list of strings to display in the gtk_list_store widget */
   accts_left = scm_call_3(make_display,
-			  wind->imported_files,
-			  map_info, 
-			  wind->gnc_acct_info);
+                          wind->imported_files,
+                          map_info,
+                          wind->gnc_acct_info);
 
   scm_gc_unprotect_object(*display_info);
-  *display_info = accts_left;  
+  *display_info = accts_left;
   scm_gc_protect_object(*display_info);
-  
+
   /* clear the list */
   gtk_list_store_clear(store);
 
@@ -1051,11 +1053,11 @@
 
     gtk_list_store_append(store, &iter);
     gtk_list_store_set(store, &iter,
-		       ACCOUNT_COL_INDEX,    row++,
-		       ACCOUNT_COL_QIF_NAME, qif_name,
-		       ACCOUNT_COL_GNC_NAME, gnc_name,
-		       ACCOUNT_COL_NEW,      checked,
-		       -1);
+                       ACCOUNT_COL_INDEX,    row++,
+                       ACCOUNT_COL_QIF_NAME, qif_name,
+                       ACCOUNT_COL_GNC_NAME, gnc_name,
+                       ACCOUNT_COL_NEW,      checked,
+                       -1);
     accts_left = SCM_CDR(accts_left);
   }
 
@@ -1063,7 +1065,7 @@
   prev_row = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(store), PREV_ROW));
   if (prev_row != -1) {
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
-    path = gtk_tree_path_new_from_indices (prev_row, -1);
+    path = gtk_tree_path_new_from_indices(prev_row, -1);
     gtk_tree_selection_select_path(selection, path);
     gtk_tree_path_free(path);
   }
@@ -1071,7 +1073,7 @@
 
 
 /****************************************************************
- * update_accounts_page 
+ * update_accounts_page
  * update the QIF account -> GNC Account picker
  ****************************************************************/
 
@@ -1081,12 +1083,13 @@
 
   SCM  make_account_display = scm_c_eval_string("qif-dialog:make-account-display");
 
-  update_account_picker_page (wind, make_account_display, wind->acct_view,
-			      wind->acct_map_info, &(wind->acct_display_info));
+  update_account_picker_page(wind, make_account_display, wind->acct_view,
+                             wind->acct_map_info, &(wind->acct_display_info));
 }
 
 /****************************************************************
- * update_categories_page 
+ * update_categories_page
+ *
  * update the QIF category -> GNC Account picker
  ****************************************************************/
 
@@ -1095,12 +1098,13 @@
 {
   SCM  make_category_display = scm_c_eval_string("qif-dialog:make-category-display");
 
-  update_account_picker_page (wind, make_category_display, wind->cat_view,
-			      wind->cat_map_info, &(wind->cat_display_info));
+  update_account_picker_page(wind, make_category_display, wind->cat_view,
+                             wind->cat_map_info, &(wind->cat_display_info));
 }
 
 /****************************************************************
- * update_memo_page 
+ * update_memo_page
+ *
  * update the QIF memo -> GNC Account picker
  ****************************************************************/
 
@@ -1109,8 +1113,8 @@
 {
   SCM  make_memo_display = scm_c_eval_string("qif-dialog:make-memo-display");
 
-  update_account_picker_page (wind, make_memo_display, wind->memo_view,
-			      wind->memo_map_info, &(wind->memo_display_info));
+  update_account_picker_page(wind, make_memo_display, wind->memo_view,
+                             wind->memo_map_info, &(wind->memo_display_info));
 }
 
 
@@ -1119,9 +1123,9 @@
 
 static void
 create_account_picker_view(GtkWidget *widget,
-			   const gchar *col_name,
-			   GCallback callback,
-			   gpointer user_data)
+                           const gchar *col_name,
+                           GCallback callback,
+                           gpointer user_data)
 {
   GtkTreeView *view = GTK_TREE_VIEW(widget);
   GtkListStore *store;
@@ -1129,70 +1133,128 @@
   GtkTreeViewColumn *column;
 
   store = gtk_list_store_new(NUM_ACCOUNT_COLS, G_TYPE_INT, G_TYPE_STRING,
-			     G_TYPE_STRING, G_TYPE_BOOLEAN);
+                             G_TYPE_STRING, G_TYPE_BOOLEAN);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
   g_object_unref(store);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(col_name, renderer,
-						    "text", ACCOUNT_COL_QIF_NAME,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(col_name,
+                                                    renderer,
+                                                    "text",
+                                                    ACCOUNT_COL_QIF_NAME,
+                                                    NULL);
   g_object_set(column, "expand", TRUE, NULL);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("GnuCash account name"), renderer,
-						    "text", ACCOUNT_COL_GNC_NAME,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("GnuCash account name"),
+                                                    renderer,
+                                                    "text",
+                                                    ACCOUNT_COL_GNC_NAME,
+                                                    NULL);
   g_object_set(column, "expand", TRUE, NULL);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_toggle_new();
   g_object_set(renderer, "activatable", FALSE, NULL);
-  column = gtk_tree_view_column_new_with_attributes(_("New?"), renderer,
-						    "active", ACCOUNT_COL_NEW,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("New?"),
+                                                    renderer,
+                                                    "active",
+                                                    ACCOUNT_COL_NEW,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   g_object_set_data(G_OBJECT(store), PREV_ROW, GINT_TO_POINTER(-1));
   g_signal_connect(view, "row-activated", G_CALLBACK(callback), user_data);
+
+  /* Allow multiple rows to be selected. */
+  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view),
+                              GTK_SELECTION_MULTIPLE);
 }
 
+
 /********************************************************************
  * select_line
- * generic function to process the selection when a user tries to edit
- * an account mapping in one of the "map QIF * to GNC" pages.  This
- * calls out to the account picker, and then then updates the
- * appropriate data structures.  Finally, it will call the update_page
- * function.
+ *
+ * This is a helper function for tree controls used by some druid
+ * pages for mapping QIF values to GnuCash accounts. It processes
+ * the selected rows when a user tries to edit the account mappings.
+ * The account picker is displayed, and the chosen GnuCash account
+ * becomes the new mapping for each row.  Finally, the update_page
+ * function is called.
  ********************************************************************/
+
 static void
-select_line (QIFImportWindow *wind, GtkTreeSelection *selection,
-	     SCM display_info, SCM map_info,
-	     void (*update_page)(QIFImportWindow *))
+select_line(QIFImportWindow *wind, GtkTreeSelection *selection,
+            SCM display_info, SCM map_info,
+            void (*update_page)(QIFImportWindow *))
 {
-  SCM   get_name = scm_c_eval_string("qif-map-entry:qif-name");
-  SCM   selected_acct;
+  SCM           get_qif_name = scm_c_eval_string("qif-map-entry:qif-name");
+  SCM           get_gnc_name = scm_c_eval_string("qif-map-entry:gnc-name");
+  SCM           set_gnc_name = scm_c_eval_string("qif-map-entry:set-gnc-name!");
+  SCM           map_entry;
+  SCM           gnc_name;
+  GList        *pathlist;
+  GList        *current;
   GtkTreeModel *model;
-  GtkTreeIter iter;
-  gint row;
+  GtkTreeIter   iter;
+  gint          row;
 
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+  /* Get a list of selected rows. */
+  pathlist = gtk_tree_selection_get_selected_rows(selection, &model);
+  if (!pathlist)
     return;
+
+
+  /*
+   * Update the first selected row.
+   */
+
+  /* Get the row number of the first selected row. */
+  if (!gtk_tree_model_get_iter(model, &iter, (GtkTreePath *) pathlist->data))
+    return;
   gtk_tree_model_get(model, &iter, ACCOUNT_COL_INDEX, &row, -1);
+
+  /* Save the row number. */
   g_object_set_data(G_OBJECT(model), PREV_ROW, GINT_TO_POINTER(row));
   if (row == -1)
     return;
 
-  /* find the <qif-map-entry> corresponding to the selected row */
-  selected_acct = scm_list_ref(display_info, scm_int2num(row));
-  
-  /* call the account picker to update it */
-  selected_acct = qif_account_picker_dialog(wind, selected_acct);
+  /* Find the <qif-map-entry> corresponding to the selected row. */
+  map_entry = scm_list_ref(display_info, scm_int2num(row));
 
-  scm_hash_set_x(map_info, scm_call_1(get_name, selected_acct), selected_acct);
+  /* Call the account picker to update it. */
+  map_entry = qif_account_picker_dialog(wind, map_entry);
+  if (map_entry == SCM_BOOL_F)
+    return;
+  gnc_name = scm_call_1(get_gnc_name, map_entry);
 
-  /* update display */
+  /* Update the mapping hash table. */
+  scm_hash_set_x(map_info, scm_call_1(get_qif_name, map_entry), map_entry);
+
+
+  /*
+   * Map all other selected rows to the same GnuCash account.
+   */
+  for (current = pathlist->next; current; current = current->next)
+  {
+      /* Get the row number. */
+      gtk_tree_model_get_iter(model, &iter, (GtkTreePath *) current->data);
+      gtk_tree_model_get(model, &iter, ACCOUNT_COL_INDEX, &row, -1);
+
+      /* Update the <qif-map-entry> for the selected row. */
+      map_entry = scm_list_ref(display_info, scm_int2num(row));
+      scm_call_2(set_gnc_name, map_entry, gnc_name);
+
+      /* Update the mapping hash table. */
+      scm_hash_set_x(map_info, scm_call_1(get_qif_name, map_entry), map_entry);
+  }
+
+  /* Free the path list. */
+  g_list_foreach(pathlist, (GFunc) gtk_tree_path_free, NULL);
+  g_list_free(pathlist);
+
+  /* Update the display. */
   update_page(wind);
 }
 
@@ -1204,17 +1266,17 @@
 
 static void
 gnc_ui_qif_import_account_line_select_cb(GtkTreeView *view, GtkTreePath *path,
-					 GtkTreeViewColumn *column,
-					 gpointer user_data)
+                                         GtkTreeViewColumn *column,
+                                         gpointer user_data)
 {
   QIFImportWindow *wind = user_data;
   GtkTreeSelection *selection;
 
-  g_return_if_fail (view && wind);
-  selection = gtk_tree_view_get_selection (view);
+  g_return_if_fail(view && wind);
+  selection = gtk_tree_view_get_selection(view);
 
-  select_line (wind, selection, wind->acct_display_info, wind->acct_map_info,
-	       update_accounts_page);
+  select_line(wind, selection, wind->acct_display_info, wind->acct_map_info,
+              update_accounts_page);
 }
 
 /********************************************************************
@@ -1225,17 +1287,17 @@
 
 static void
 gnc_ui_qif_import_category_line_select_cb(GtkTreeView *view, GtkTreePath *path,
-					 GtkTreeViewColumn *column,
-					 gpointer user_data)
+                                         GtkTreeViewColumn *column,
+                                         gpointer user_data)
 {
   QIFImportWindow *wind = user_data;
   GtkTreeSelection *selection;
 
-  g_return_if_fail (view && wind);
-  selection = gtk_tree_view_get_selection (view);
+  g_return_if_fail(view && wind);
+  selection = gtk_tree_view_get_selection(view);
 
-  select_line (wind, selection, wind->cat_display_info, wind->cat_map_info,
-	       update_categories_page);
+  select_line(wind, selection, wind->cat_display_info, wind->cat_map_info,
+              update_categories_page);
 }
 
 /********************************************************************
@@ -1246,17 +1308,17 @@
 
 static void
 gnc_ui_qif_import_memo_line_select_cb(GtkTreeView *view, GtkTreePath *path,
-					 GtkTreeViewColumn *column,
-					 gpointer user_data)
+                                         GtkTreeViewColumn *column,
+                                         gpointer user_data)
 {
   QIFImportWindow *wind = user_data;
   GtkTreeSelection *selection;
 
-  g_return_if_fail (view && wind);
-  selection = gtk_tree_view_get_selection (view);
+  g_return_if_fail(view && wind);
+  selection = gtk_tree_view_get_selection(view);
 
-  select_line (wind, selection, wind->memo_display_info, wind->memo_map_info,
-	       update_memo_page);
+  select_line(wind, selection, wind->memo_display_info, wind->memo_map_info,
+              update_memo_page);
 }
 
 
@@ -1306,19 +1368,19 @@
   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);
-  
+                          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"));
@@ -1455,7 +1517,7 @@
   }
 
   selection = gtk_tree_view_get_selection(view);
-  path = gtk_tree_path_new_from_indices (0, -1);
+  path = gtk_tree_path_new_from_indices(0, -1);
   gtk_tree_selection_select_path(selection, path);
   gtk_tree_path_free(path);
 }
@@ -1511,7 +1573,7 @@
     gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->currency_picker));
 
   /* Let the user know we're busy. */
-  gnc_suspend_gui_refresh ();
+  gnc_suspend_gui_refresh();
   gnc_set_busy_cursor(NULL, TRUE);
 
   /* Update the commodities. */
@@ -1624,7 +1686,7 @@
 
   /* Get a list of any new QIF securities since the previous call. */
   updates = scm_call_4(update_securities,
-                       wind->security_hash, 
+                       wind->security_hash,
                        wind->ticker_map,
                        wind->acct_map_info,
                        wind->security_prefs);
@@ -1661,12 +1723,12 @@
 {
   QIFImportWindow * wind = user_data;
   SCM any_new = scm_c_eval_string("qif-import:any-new-accts?");
-  
+
   /* if any accounts are new, ask about the currency; else,
      just skip that page */
   if ((scm_call_1(any_new, wind->acct_map_info) == SCM_BOOL_T) ||
       (scm_call_1(any_new, wind->cat_map_info) == SCM_BOOL_T))
-    /* go to currency page */ 
+    /* go to currency page */
     return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
   else
   {
@@ -1698,11 +1760,11 @@
  * jump to category match page.
  ****************************************************************/
 static gboolean
-gnc_ui_qif_import_currency_back_cb(GnomeDruidPage * page, gpointer arg1, 
+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))
@@ -1727,7 +1789,7 @@
   QIFImportWindow * wind = user_data;
 
   gnc_set_busy_cursor(NULL, TRUE);
-  
+
   if (gnc_ui_qif_import_new_securities(wind))
   {
     /* There are new commodities, so show a commodity page next. */
@@ -1765,7 +1827,7 @@
   /* Update the namespaces available to select. */
   if (!ns || !ns[0])
     gnc_ui_update_namespace_picker(
-      qpage->new_type_combo, 
+      qpage->new_type_combo,
       gnc_commodity_get_namespace(qpage->commodity),
       DIAG_COMM_ALL);
   else
@@ -1774,7 +1836,7 @@
   g_free(ns);
 }
 
-  
+
 static gboolean
 gnc_ui_qif_import_comm_next_cb(GnomeDruidPage * page,
                                gpointer arg1,
@@ -1786,21 +1848,21 @@
   QofBook                 *book;
   gnc_commodity_table     *table;
   gnc_commodity_namespace *newns;
-  
+
   gchar       *namespace = gnc_ui_namespace_picker_ns(qpage->new_type_combo);
   const gchar *name      = gtk_entry_get_text(GTK_ENTRY(qpage->new_name_entry));
   const gchar *mnemonic  = gtk_entry_get_text(GTK_ENTRY(qpage->new_mnemonic_entry));
 
   if(!namespace || (namespace[0] == 0)) {
     gnc_warning_dialog(wind->window,
-		       _("You must enter a Type for the commodity."));
+                       _("You must enter a Type for the commodity."));
     if (namespace)
       g_free(namespace);
     return TRUE;
   }
   else if(!name || (name[0] == 0)) {
     gnc_warning_dialog(wind->window,
-		       _("You must enter a name for the commodity."));
+                       _("You must enter a name for the commodity."));
     g_free(namespace);
     return TRUE;
   }
@@ -1817,12 +1879,12 @@
 
   book = gnc_get_current_book();
   table = gnc_commodity_table_get_table(book);
-  if (gnc_commodity_namespace_is_iso (namespace) &&
-      !gnc_commodity_table_lookup (table, namespace, mnemonic))
+  if (gnc_commodity_namespace_is_iso(namespace) &&
+      !gnc_commodity_table_lookup(table, namespace, mnemonic))
   {
     gnc_warning_dialog(wind->window,
-		       _("You must enter an existing national "
-			 "currency or enter a different type."));
+                       _("You must enter an existing national "
+                         "currency or enter a different type."));
 
     g_free(namespace);
     return TRUE;
@@ -1859,7 +1921,7 @@
 
 /********************************************************************
  * gnc_ui_qif_import_commodity_prepare_cb
- * build a mapping of QIF security name to gnc_commodity 
+ * build a mapping of QIF security name to gnc_commodity
  ********************************************************************/
 
 static void
@@ -1875,9 +1937,9 @@
 
   GList          * current;
   gnc_commodity  * commodity;
-  GnomeDruidPage * back_page = get_named_page(wind, "commodity_doc_page");  
+  GnomeDruidPage * back_page = get_named_page(wind, "commodity_doc_page");
   QIFDruidPage   * new_page;
-  
+
   /* This shouldn't happen, but do the right thing if it does. */
   if (wind->new_securities == SCM_BOOL_F || SCM_NULLP(wind->new_securities))
   {
@@ -1926,11 +1988,11 @@
                          G_CALLBACK(gnc_ui_qif_import_comm_next_cb),
                          wind);
 
-        wind->commodity_pages = g_list_append(wind->commodity_pages, 
+        wind->commodity_pages = g_list_append(wind->commodity_pages,
                                               new_page->page);
 
         gnome_druid_insert_page(GNOME_DRUID(wind->druid),
-                                back_page, 
+                                back_page,
                                 GNOME_DRUID_PAGE(new_page->page));
         back_page = GNOME_DRUID_PAGE(new_page->page);
         gtk_widget_show_all(new_page->page);
@@ -1942,13 +2004,13 @@
     gnc_unset_busy_cursor(NULL);
   }
 
-  gnc_druid_set_colors (GNOME_DRUID (wind->druid));
+  gnc_druid_set_colors(GNOME_DRUID(wind->druid));
 }
 
 static QIFDruidPage *
 make_qif_druid_page(SCM security_hash_key, gnc_commodity *comm)
 {
-  
+
   QIFDruidPage *retval = g_new0(QIFDruidPage, 1);
   GtkWidget    *top_vbox;
   GtkWidget    *info_label;
@@ -1976,10 +2038,10 @@
   g_free(title);
 
   /* Set the page colors. */
-  gnome_druid_page_standard_set_background(page, & std_bg_color);  
+  gnome_druid_page_standard_set_background(page, & std_bg_color);
   gnome_druid_page_standard_set_logo_background(page, & std_logo_bg_color);
-  gnome_druid_page_standard_set_title_foreground (page, & std_title_color);
-  
+  gnome_druid_page_standard_set_title_foreground(page, & std_title_color);
+
   /*
    * Add all the widgets to the page.
    */
@@ -1988,7 +2050,7 @@
 
   info_label = gtk_label_new(_("Pick the commodity's exchange or listing "
                                "(NASDAQ, NYSE, etc)."));
-  gtk_label_set_justify (GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
   gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
 
   temp = gtk_hbox_new(FALSE, 0);
@@ -2007,7 +2069,7 @@
   info_label = gtk_label_new(_("Enter the full name of the commodity, "
                                "such as \"Red Hat Stock\""));
 
-  gtk_label_set_justify (GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
   gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
 
   temp = gtk_hbox_new(FALSE, 0);
@@ -2028,9 +2090,9 @@
   info_label = gtk_label_new(_("Enter the ticker symbol (such as \"RHAT\") or "
                                "other unique abbreviation for the name."));
 
-  gtk_label_set_justify (GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
   gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
- 
+
   temp = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(top_vbox), temp, FALSE, FALSE, 0);
 
@@ -2048,7 +2110,7 @@
 
   next_label = gtk_label_new(_("Click \"Forward\" to accept the information "
                                "and move on."));
-  gtk_label_set_justify (GTK_LABEL(next_label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_justify(GTK_LABEL(next_label), GTK_JUSTIFY_LEFT);
   gtk_box_pack_end(GTK_BOX(top_vbox), next_label, TRUE, TRUE, 0);
 
 
@@ -2078,7 +2140,7 @@
     possible_matches = SCM_CDR(scm_list_ref(wind->match_transactions,
                                   scm_int2num(wind->selected_transaction)));
     scm_call_2(scm_c_eval_string("qif-import:refresh-match-selection"),
-	       possible_matches, scm_int2num(selection));
+               possible_matches, scm_int2num(selection));
 
     while(!SCM_NULLP(possible_matches)) {
       current_xtn = SCM_CAR(possible_matches);
@@ -2087,13 +2149,13 @@
                                     SWIG_TypeQuery("_p_Transaction"), 1, 0);
       #undef FUNC_NAME
       selected    = SCM_CDR(current_xtn);
-      
+
       if(xaccTransCountSplits(gnc_xtn) > 2) {
-        amount_str = _("(split)"); 
+        amount_str = _("(split)");
       }
       else {
-	gnc_split = xaccTransGetSplit(gnc_xtn, 0);  
-        amount_str = 
+        gnc_split = xaccTransGetSplit(gnc_xtn, 0);
+        amount_str =
           xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
                           gnc_account_print_info
                           (xaccSplitGetAccount(gnc_split), TRUE));
@@ -2101,13 +2163,13 @@
 
       gtk_list_store_append(store, &iter);
       gtk_list_store_set
-	(store, &iter,
-	 QIF_TRANS_COL_INDEX, rownum++,
-	 QIF_TRANS_COL_DATE, gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
-	 QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
-	 QIF_TRANS_COL_AMOUNT, amount_str,
-	 QIF_TRANS_COL_CHECKED, selected != SCM_BOOL_F,
-	 -1);
+        (store, &iter,
+         QIF_TRANS_COL_INDEX, rownum++,
+         QIF_TRANS_COL_DATE, gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
+         QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
+         QIF_TRANS_COL_AMOUNT, amount_str,
+         QIF_TRANS_COL_CHECKED, selected != SCM_BOOL_F,
+         -1);
 
       possible_matches = SCM_CDR(possible_matches);
     }
@@ -2115,16 +2177,16 @@
 }
 
 static void
-gnc_ui_qif_import_duplicate_new_select_cb (GtkTreeSelection *selection,
-					   QIFImportWindow  *wind)
+gnc_ui_qif_import_duplicate_new_select_cb(GtkTreeSelection *selection,
+                                          QIFImportWindow  *wind)
 {
   GtkTreeModel *model;
   GtkTreeIter iter;
 
   if (gtk_tree_selection_get_selected(selection, &model, &iter))
     gtk_tree_model_get(model, &iter,
-		       QIF_TRANS_COL_INDEX, &wind->selected_transaction,
-		       -1);
+                       QIF_TRANS_COL_INDEX, &wind->selected_transaction,
+                       -1);
   refresh_old_transactions(wind, -1);
 }
 
@@ -2136,8 +2198,8 @@
 }
 
 static void
-gnc_ui_qif_import_duplicate_old_select_cb (GtkTreeSelection *selection,
-					   QIFImportWindow  *wind)
+gnc_ui_qif_import_duplicate_old_select_cb(GtkTreeSelection *selection,
+                                          QIFImportWindow  *wind)
 {
   GtkTreeModel *model;
   GtkTreeIter iter;
@@ -2161,15 +2223,15 @@
   /* Get the row the user clicked on and update the scheme
    * code/rebuild the list store.  */
   gtk_tree_model_get(model, &iter,
-		     QIF_TRANS_COL_INDEX, &row,
-		     -1);
+                     QIF_TRANS_COL_INDEX, &row,
+                     -1);
   refresh_old_transactions(wind, row);
 }
 
 
 /********************************************************************
  * gnc_ui_qif_import_check_acct_tree
- * 
+ *
  * Designed for use with gnc_main_window_foreach_page(), this
  * function determines whether an account tab is open in the main
  * window. The parameter user_data must point to a gboolean.
@@ -2187,19 +2249,19 @@
 
 /********************************************************************
  * gnc_ui_qif_import_finish_cb
- * 
+ *
  * Invoked when the "Apply" button is clicked on the final page.
  ********************************************************************/
 
 static void
-gnc_ui_qif_import_finish_cb(GnomeDruidPage * gpage, 
-                            gpointer arg1, 
+gnc_ui_qif_import_finish_cb(GnomeDruidPage * gpage,
+                            gpointer arg1,
                             gpointer user_data)
 {
   SCM   save_map_prefs = scm_c_eval_string("qif-import:save-map-prefs");
   SCM   cat_and_merge = scm_c_eval_string("gnc:account-tree-catenate-and-merge");
   SCM   prune_xtns = scm_c_eval_string("gnc:prune-matching-transactions");
-  
+
   QIFImportWindow * wind = user_data;
   GncPluginPage *page;
   gboolean acct_tree_found = FALSE;
@@ -2213,17 +2275,17 @@
   /* Merge the imported account tree with the existing one. */
   if (wind->imported_account_tree != SCM_BOOL_F)
     scm_call_2(cat_and_merge,
-	       scm_c_eval_string("(gnc-get-current-root-account)"),
-	       wind->imported_account_tree);
+               scm_c_eval_string("(gnc-get-current-root-account)"),
+               wind->imported_account_tree);
 
   gnc_resume_gui_refresh();
 
   /* Save the user's mapping preferences. */
   scm_apply(save_map_prefs,
-	    SCM_LIST5(wind->acct_map_info, wind->cat_map_info,
-		      wind->memo_map_info, wind->security_hash,
+            SCM_LIST5(wind->acct_map_info, wind->cat_map_info,
+                      wind->memo_map_info, wind->security_hash,
                       wind->security_prefs),
-	    SCM_EOL);
+            SCM_EOL);
 
   /* Open an account tab in the main window if one doesn't exist already. */
   gnc_main_window_foreach_page(gnc_ui_qif_import_check_acct_tree,
@@ -2234,7 +2296,7 @@
     gnc_main_window_open_page(NULL, page);
   }
 
-  gnc_ui_qif_import_druid_destroy(wind);  
+  gnc_ui_qif_import_druid_destroy(wind);
 }
 
 
@@ -2284,7 +2346,7 @@
 SCM
 gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w)
 {
-  return SCM_LIST3(w->acct_map_info, 
+  return SCM_LIST3(w->acct_map_info,
                    w->cat_map_info,
                    w->memo_map_info);
 }
@@ -2293,37 +2355,38 @@
 /* ======================================================== */
 
 static gboolean
-show_handler (const char *class, gint component_id,
-	      gpointer user_data, gpointer iter_data)
+show_handler(const char *class, gint component_id,
+             gpointer user_data, gpointer iter_data)
 {
   QIFImportWindow *qif_win = user_data;
 
   if (!qif_win)
     return(FALSE);
-  gtk_window_present (GTK_WINDOW(qif_win->window));
+  gtk_window_present(GTK_WINDOW(qif_win->window));
   return(TRUE);
 }
 
 void
-gnc_file_qif_import (void) 
+gnc_file_qif_import(void)
 {
-  if (gnc_forall_gui_components (DRUID_QIF_IMPORT_CM_CLASS,
-				 show_handler, NULL))
-      return;
+  if (gnc_forall_gui_components(DRUID_QIF_IMPORT_CM_CLASS,
+                                show_handler, NULL))
+    return;
 
   /* pop up the QIF File Import dialog box */
   gnc_ui_qif_import_druid_make();
 }
 
+
 /********************************************************************
- * gnc_ui_qif_import_druid_make() 
+ * gnc_ui_qif_import_druid_make()
  * build the druid.
  ********************************************************************/
 
 QIFImportWindow *
 gnc_ui_qif_import_druid_make(void)
 {
-  
+
   QIFImportWindow * retval;
   GladeXML        * xml;
   GError * err = NULL;
@@ -2340,7 +2403,7 @@
 
   char * pre_page_names[NUM_PRE_PAGES] = {
     "start_page", "load_file_page", "date_format_page", "account_name_page",
-    "loaded_files_page", "account_doc_page", "account_match_page", 
+    "loaded_files_page", "account_doc_page", "account_match_page",
     "category_doc_page", "category_match_page", "memo_doc_page",
     "memo_match_page", "currency_page", "commodity_doc_page"
   };
@@ -2350,99 +2413,99 @@
   };
 
   char * doc_page_names[NUM_DOC_PAGES] = {
-    "start_page", "account_doc_page", "category_doc_page", 
-    "commodity_doc_page", "memo_doc_page", "match_doc_page"    
+    "start_page", "account_doc_page", "category_doc_page",
+    "commodity_doc_page", "memo_doc_page", "match_doc_page"
   };
 
   retval = g_new0(QIFImportWindow, 1);
 
-  xml = gnc_glade_xml_new ("qif.glade", "QIF Import Druid");
+  xml = gnc_glade_xml_new("qif.glade", "QIF Import Druid");
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_cancel_cb",
-     G_CALLBACK (gnc_ui_qif_import_cancel_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_cancel_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_generic_next_cb",
-     G_CALLBACK (gnc_ui_qif_import_generic_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_generic_next_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_generic_back_cb",
-     G_CALLBACK (gnc_ui_qif_import_generic_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_generic_back_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_select_file_cb",
-     G_CALLBACK (gnc_ui_qif_import_select_file_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_select_file_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_file_back_cb",
-     G_CALLBACK (gnc_ui_qif_import_load_file_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_file_back_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_file_next_cb",
-     G_CALLBACK (gnc_ui_qif_import_load_file_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_file_next_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_date_format_next_cb",
-     G_CALLBACK (gnc_ui_qif_import_date_format_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_date_format_next_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_loaded_files_prepare_cb",
-     G_CALLBACK (gnc_ui_qif_import_loaded_files_prepare_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_loaded_files_prepare_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_another_cb",
-     G_CALLBACK (gnc_ui_qif_import_load_another_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_another_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_unload_file_cb",
-     G_CALLBACK (gnc_ui_qif_import_unload_file_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_unload_file_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_default_acct_next_cb",
-     G_CALLBACK (gnc_ui_qif_import_default_acct_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_default_acct_next_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_default_acct_back_cb",
-     G_CALLBACK (gnc_ui_qif_import_default_acct_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_default_acct_back_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_accounts_prepare_cb",
-     G_CALLBACK (gnc_ui_qif_import_accounts_prepare_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_accounts_prepare_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_categories_prepare_cb",
-     G_CALLBACK (gnc_ui_qif_import_categories_prepare_cb), retval);
-  
+     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);
-  
+     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);
+     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);
-  
+     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);
-  
+     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);
+     G_CALLBACK(gnc_ui_qif_import_currency_next_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_commodity_prepare_cb",
-     G_CALLBACK (gnc_ui_qif_import_commodity_prepare_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_commodity_prepare_cb), retval);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_finish_cb",
-     G_CALLBACK (gnc_ui_qif_import_finish_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_finish_cb), retval);
 
-  retval->window = glade_xml_get_widget (xml, "QIF Import Druid");
+  retval->window = glade_xml_get_widget(xml, "QIF Import Druid");
 
   retval->imported_files    =  SCM_EOL;
   retval->selected_file     =  SCM_BOOL_F;
@@ -2460,28 +2523,28 @@
   retval->imported_account_tree   = SCM_BOOL_F;
   retval->match_transactions = SCM_BOOL_F;
   retval->selected_transaction = 0;
-  
-  retval->druid          = glade_xml_get_widget (xml, "qif_import_druid");
-  retval->filename_entry = glade_xml_get_widget (xml, "qif_filename_entry");
-  retval->acct_entry     = glade_xml_get_widget (xml, "qif_account_entry");
-  retval->date_format_combo = glade_xml_get_widget (xml, "date_format_combobox");
+
+  retval->druid          = glade_xml_get_widget(xml, "qif_import_druid");
+  retval->filename_entry = glade_xml_get_widget(xml, "qif_filename_entry");
+  retval->acct_entry     = glade_xml_get_widget(xml, "qif_account_entry");
+  retval->date_format_combo = glade_xml_get_widget(xml, "date_format_combobox");
   retval->selected_file_view = glade_xml_get_widget(xml, "selected_file_view");
-  retval->currency_picker = glade_xml_get_widget (xml, "currency_comboboxentry");
-  retval->acct_view      = glade_xml_get_widget (xml, "account_page_view");
-  retval->cat_view       = glade_xml_get_widget (xml, "category_page_view");
-  retval->memo_view      = glade_xml_get_widget (xml, "memo_page_view");
-  retval->new_transaction_view = 
-    glade_xml_get_widget (xml, "new_transaction_view");
-  retval->old_transaction_view = 
-    glade_xml_get_widget (xml, "old_transaction_view");
-  
+  retval->currency_picker = glade_xml_get_widget(xml, "currency_comboboxentry");
+  retval->acct_view      = glade_xml_get_widget(xml, "account_page_view");
+  retval->cat_view       = glade_xml_get_widget(xml, "category_page_view");
+  retval->memo_view      = glade_xml_get_widget(xml, "memo_page_view");
+  retval->new_transaction_view =
+    glade_xml_get_widget(xml, "new_transaction_view");
+  retval->old_transaction_view =
+    glade_xml_get_widget(xml, "old_transaction_view");
+
   retval->pre_comm_pages   = NULL;
   retval->post_comm_pages  = NULL;
   retval->doc_pages        = NULL;
   retval->commodity_pages = NULL;
 
   /* Get the user's preference for showing documentation pages. */
-  retval->show_doc_pages = 
+  retval->show_doc_pages =
     gnc_gconf_get_bool(GCONF_SECTION, GCONF_NAME_SHOW_DOC, &err);
   if (err != NULL) {
     g_warning("QIF import: gnc_gconf_get_bool error: %s\n", err->message);
@@ -2495,21 +2558,21 @@
   }
 
   for(i=0; i < NUM_PRE_PAGES; i++) {
-    retval->pre_comm_pages = 
-      g_list_append(retval->pre_comm_pages, 
-                    glade_xml_get_widget (xml, pre_page_names[i]));
+    retval->pre_comm_pages =
+      g_list_append(retval->pre_comm_pages,
+                    glade_xml_get_widget(xml, pre_page_names[i]));
   }
   for(i=0; i < NUM_POST_PAGES; i++) {
-    retval->post_comm_pages = 
-      g_list_append(retval->post_comm_pages, 
-                    glade_xml_get_widget (xml, post_page_names[i]));
+    retval->post_comm_pages =
+      g_list_append(retval->post_comm_pages,
+                    glade_xml_get_widget(xml, post_page_names[i]));
   }
   for(i=0; i < NUM_DOC_PAGES; i++) {
-    retval->doc_pages = 
-      g_list_append(retval->doc_pages, 
-                    glade_xml_get_widget (xml, doc_page_names[i]));
+    retval->doc_pages =
+      g_list_append(retval->doc_pages,
+                    glade_xml_get_widget(xml, doc_page_names[i]));
   }
-  
+
   /* Set up the selected file view */
   view = GTK_TREE_VIEW(retval->selected_file_view);
   store = gtk_list_store_new(NUM_FILENAME_COLS, G_TYPE_INT, G_TYPE_STRING);
@@ -2517,94 +2580,110 @@
   g_object_unref(store);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Account"), renderer,
-						    "text", FILENAME_COL_NAME,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Account"),
+                                                    renderer,
+                                                    "text",
+                                                    FILENAME_COL_NAME,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
-		   G_CALLBACK(gnc_ui_qif_import_select_loaded_file_cb),
-		   retval);
-  
+                   G_CALLBACK(gnc_ui_qif_import_select_loaded_file_cb),
+                   retval);
+
   create_account_picker_view(retval->acct_view, _("QIF account name"),
-			     G_CALLBACK(gnc_ui_qif_import_account_line_select_cb),
-			     retval);
+                             G_CALLBACK(gnc_ui_qif_import_account_line_select_cb),
+                             retval);
   create_account_picker_view(retval->cat_view,  _("QIF category name"),
-			     G_CALLBACK(gnc_ui_qif_import_category_line_select_cb),
-			     retval);
+                             G_CALLBACK(gnc_ui_qif_import_category_line_select_cb),
+                             retval);
   create_account_picker_view(retval->memo_view, _("QIF payee/memo"),
-			     G_CALLBACK(gnc_ui_qif_import_memo_line_select_cb),
-			     retval);
+                             G_CALLBACK(gnc_ui_qif_import_memo_line_select_cb),
+                             retval);
 
   /* Set up the new transaction view */
   view = GTK_TREE_VIEW(retval->new_transaction_view);
   store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
-			     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+                             G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
   g_object_unref(store);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer,
-						    "text", QIF_TRANS_COL_DATE,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Date"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_DATE,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
-						    "text", QIF_TRANS_COL_DESCRIPTION,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Description"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_DESCRIPTION,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
   gtk_tree_view_column_set_expand(column, TRUE);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Amount"), renderer,
-						    "text", QIF_TRANS_COL_AMOUNT,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Amount"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_AMOUNT,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
-		   G_CALLBACK(gnc_ui_qif_import_duplicate_new_select_cb),
-		   retval);
+                   G_CALLBACK(gnc_ui_qif_import_duplicate_new_select_cb),
+                   retval);
 
 
   /* Set up the old transaction view */
   view = GTK_TREE_VIEW(retval->old_transaction_view);
   store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
-			     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+                             G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
   g_object_unref(store);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer,
-						    "text", QIF_TRANS_COL_DATE,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Date"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_DATE,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
-						    "text", QIF_TRANS_COL_DESCRIPTION,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Description"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_DESCRIPTION,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
   gtk_tree_view_column_set_expand(column, TRUE);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Amount"), renderer,
-						    "text", QIF_TRANS_COL_AMOUNT,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Amount"),
+                                                    renderer,
+                                                    "text",
+                                                    QIF_TRANS_COL_AMOUNT,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_toggle_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Dup?"), renderer,
-						    "active", QIF_TRANS_COL_CHECKED,
-						    NULL);
+  column = gtk_tree_view_column_new_with_attributes(_("Dup?"),
+                                                    renderer,
+                                                    "active",
+                                                    QIF_TRANS_COL_CHECKED,
+                                                    NULL);
   gtk_tree_view_append_column(view, column);
 
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
-		   G_CALLBACK(gnc_ui_qif_import_duplicate_old_select_cb),
-		   retval);
+                   G_CALLBACK(gnc_ui_qif_import_duplicate_old_select_cb),
+                   retval);
 
 
   /* load the saved-state of the mappings from Quicken accounts and
@@ -2621,7 +2700,7 @@
 
   create_ticker_map = scm_c_eval_string("make-ticker-map");
   retval->ticker_map = scm_call_0(create_ticker_map);
-  
+
   scm_gc_protect_object(retval->imported_files);
   scm_gc_protect_object(retval->selected_file);
   scm_gc_protect_object(retval->gnc_acct_info);
@@ -2637,25 +2716,25 @@
   scm_gc_protect_object(retval->ticker_map);
   scm_gc_protect_object(retval->imported_account_tree);
   scm_gc_protect_object(retval->match_transactions);
-  
+
   /* set a default currency for new accounts */
   gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->currency_picker));
   gnc_ui_update_commodity_picker(retval->currency_picker,
-                                 GNC_COMMODITY_NS_CURRENCY, 
+                                 GNC_COMMODITY_NS_CURRENCY,
                                  gnc_commodity_get_printname
                                  (gnc_default_currency()));
-  
+
   if(!retval->show_doc_pages) {
     gnome_druid_set_page(GNOME_DRUID(retval->druid),
                          get_named_page(retval, "load_file_page"));
   }
 
-  gnc_druid_set_colors (GNOME_DRUID (retval->druid));
+  gnc_druid_set_colors(GNOME_DRUID(retval->druid));
 
   gnc_register_gui_component(DRUID_QIF_IMPORT_CM_CLASS, NULL, NULL, retval);
 
   gtk_widget_show_all(retval->window);
-  gtk_window_present (GTK_WINDOW(retval->window));
+  gtk_window_present(GTK_WINDOW(retval->window));
 
   return retval;
 }



More information about the gnucash-changes mailing list