gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Tue Jul 2 06:06:36 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/f82058e0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/690e359b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/98cf760c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/377b73d1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/caeea74b (commit)
	from  https://github.com/Gnucash/gnucash/commit/a7bdd082 (commit)



commit f82058e026bebeb0c9380231b884d2c3140ca11a
Merge: a7bdd0829 690e359be
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Jul 2 10:57:23 2019 +0100

    Merge David Cousens's 'Bug797275' branch into maint


commit 690e359be093a7207f646879d8e80a6392f263b3
Author: David Cousens <davidcousens at bigpond.com>
Date:   Sat Jun 29 14:12:03 2019 +1000

    Fix view_selection_function declaration
    
    For some strange reason the view_selection_function declaration went missing?? reinserted it

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 3ad4af318..3ec947266 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -130,6 +130,11 @@ static void refresh_model_row (
                     GtkTreeModel *model,
                     GtkTreeIter *iter,
                     GNCImportTransInfo *info);
+static gboolean view_selection_function (GtkTreeSelection *selection,
+                         GtkTreeModel *model,
+                         GtkTreePath *path,
+                         gboolean path_currently_selected,
+                         gpointer data);
 /* end local prototypes */
 
 void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
@@ -347,10 +352,10 @@ gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
-    
+
     ENTER("");
     model = gtk_tree_view_get_model (gui->view);
-    
+
     if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
         return;
     gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
@@ -376,10 +381,10 @@ gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
-    
+
     ENTER("");
     model = gtk_tree_view_get_model (gui->view);
-    
+
     if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
         return;
     gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
@@ -778,20 +783,20 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
                                           DOWNLOADED_COL_DATE_INT64,
                                           GTK_SORT_ASCENDING);
     selection = gtk_tree_view_get_selection (info->view);
-    
-    /* set a selection function which will block selection of rows which are not 
+
+    /* set a selection function which will block selection of rows which are not
       flagged to be imported into Gnucash */
     gtk_tree_selection_set_select_function
                                (selection,
                                 view_selection_function,
                                 info,
                                 NULL);
-    /* clear the flag which indicates that A(dd) has been toggled so that the 
-      view_selection_function can block selection of a row when the 
-      view_selection_function is called immediately after A(dd) is toggled 
+    /* clear the flag which indicates that A(dd) has been toggled so that the
+      view_selection_function can block selection of a row when the
+      view_selection_function is called immediately after A(dd) is toggled
       on that row */
     info->add_toggled = FALSE;
-                                
+
     g_signal_connect (info->view, "row-activated",
                       G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
     g_signal_connect (selection, "changed",
@@ -814,7 +819,7 @@ view_selection_function (GtkTreeSelection *selection,
     GNCImportTransInfo *trans_info;
     GNCImportAction action;
     GNCImportMainMatcher *info = data;
-  
+
     ENTER("view_selection_function");
     if (gtk_tree_model_get_iter(model, &iter, path))
     {
@@ -852,22 +857,22 @@ view_selection_function (GtkTreeSelection *selection,
                 DEBUG("Import action = LAST_ACTION row not selected");
                 LEAVE("FALSE");
                 return FALSE;
-            case GNCImport_INVALID_ACTION: 
-                DEBUG("Import action = LAST_ACTION row not selected"); 
+            case GNCImport_INVALID_ACTION:
+                DEBUG("Import action = LAST_ACTION row not selected");
                 LEAVE("FALSE");
-                return FALSE;    
+                return FALSE;
             default:
                 DEBUG("Import action = UNDEFINED -cannot select");
                 LEAVE("FALSE");
                 return FALSE;
-        }    
+        }
     }
     else
     {
         DEBUG("path to selected row undefined");
         LEAVE("FALSE");
         return FALSE;
-    } 
+    }
 }
 
 static void

commit 98cf760c6eb1362dbb7b41b2689c76cbf1aa3a5c
Merge: caeea74b5 377b73d1a
Author: David Cousens <davidcousens at bigpond.com>
Date:   Sat Jun 29 13:53:08 2019 +1000

    Merge branch 'matcher-help' into Bug797275


commit 377b73d1aa9f9c263c5887a0c869d2a371bfd142
Author: David Cousens <davidcousens at bigpond.com>
Date:   Sat Jun 29 13:42:36 2019 +1000

    Add multiselection info to help dialogue

diff --git a/gnucash/gtkbuilder/dialog-import.glade b/gnucash/gtkbuilder/dialog-import.glade
index 828bb28bf..d1cd6396b 100644
--- a/gnucash/gtkbuilder/dialog-import.glade
+++ b/gnucash/gtkbuilder/dialog-import.glade
@@ -740,6 +740,9 @@
       <action-widget response="-5">ok_button1</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkTextBuffer" id="textbuffer1">
+    <property name="text" translatable="yes">Multiple transaction rows may be selected and a transfer account assigned to all selected rows. Use Ctrl Left Click or Shift-Click to select multiple rows and then Right Click to select a transfer account. Only rows with "A" checked can be added to a selection.</property>
+  </object>
   <object class="GtkTextBuffer" id="textbuffer2">
     <property name="text" translatable="yes">This transaction probably requires your intervention or it will be imported unbalanced.</property>
   </object>
@@ -1095,6 +1098,35 @@
                 <property name="top_attach">3</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow 36">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">never</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTextView" id="textview6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="pixels_above_lines">5</property>
+                    <property name="pixels_below_lines">5</property>
+                    <property name="editable">False</property>
+                    <property name="wrap_mode">word</property>
+                    <property name="left_margin">5</property>
+                    <property name="right_margin">5</property>
+                    <property name="cursor_visible">False</property>
+                    <property name="buffer">textbuffer1</property>
+                    <property name="accepts_tab">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">11</property>
+                <property name="width">2</property>
+              </packing>
+            </child>
             <child>
               <placeholder/>
             </child>
@@ -1257,9 +1289,9 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-11">matcher__help</action-widget>
       <action-widget response="-6">matcher_cancel</action-widget>
       <action-widget response="-5">matcher_ok</action-widget>
+      <action-widget response="-11">matcher__help</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index be39bcf0f..7df89d090 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -99,26 +99,32 @@ void on_matcher_help_close_clicked (GtkButton *button, gpointer user_data);
 
 /* Local prototypes */
 static void gnc_gen_trans_assign_transfer_account (
-                                                GtkTreeView *treeview,
-                                                gboolean *first,
-                                                gboolean is_selection,
-                                                GtkTreePath *path,
-                                                Account **new_acc,
-                                                GNCImportMainMatcher *info);
+                    GtkTreeView *treeview,
+                    gboolean *first,
+                    gboolean is_selection,
+                    GtkTreePath *path,
+                    Account **new_acc,
+                    GNCImportMainMatcher *info);
 static void gnc_gen_trans_assign_transfer_account_to_selection_cb (
-                                          GtkMenuItem *menuitem,
-                                          GNCImportMainMatcher *info);
-static void gnc_gen_trans_view_popup_menu (GtkTreeView *treeview,
-                                          GdkEvent *event,
-                                          GNCImportMainMatcher *info);
-static gboolean gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview,
-                                                  GdkEvent *event,
-                                                  GNCImportMainMatcher *info);
-static gboolean gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview,
-                                              GdkEvent *event,
-                                              GNCImportMainMatcher *info);
-static void refresh_model_row (GNCImportMainMatcher *gui, GtkTreeModel *model,
-                               GtkTreeIter *iter, GNCImportTransInfo *info);
+                    GtkMenuItem *menuitem,
+                    GNCImportMainMatcher *info);
+static void gnc_gen_trans_view_popup_menu (
+                    GtkTreeView *treeview,
+                    GdkEvent *event,
+                    GNCImportMainMatcher *info);
+static gboolean gnc_gen_trans_onButtonPressed_cb (
+                    GtkTreeView *treeview,
+                    GdkEvent *event,
+                    GNCImportMainMatcher *info);
+static gboolean gnc_gen_trans_onPopupMenu_cb (
+                    GtkTreeView *treeview,
+                    GdkEvent *event,
+                    GNCImportMainMatcher *info);
+static void refresh_model_row (
+                    GNCImportMainMatcher *gui,
+                    GtkTreeModel *model,
+                    GtkTreeIter *iter,
+                    GNCImportTransInfo *info);
 /* end local prototypes */
 
 void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
@@ -233,6 +239,7 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer3");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer4");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
+    gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer1");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
 
     if (info->dark_theme == TRUE)
@@ -277,14 +284,15 @@ run_account_picker_dialog (GNCImportMainMatcher *info,
     g_assert (trans_info);
     old_acc = gnc_import_TransInfo_get_destacc (trans_info);
 
-    new_acc = gnc_import_select_account (info->main_widget,
-                                         NULL,
-                                         TRUE,
-                                         _("Destination account for the auto-balance split."),
-                                         xaccTransGetCurrency (gnc_import_TransInfo_get_trans (trans_info)),
-                                         ACCT_TYPE_NONE,
-                                         old_acc,
-                                         &ok_pressed);
+    new_acc = gnc_import_select_account (
+            info->main_widget,
+             NULL,
+             TRUE,
+             _("Destination account for the auto-balance split."),
+             xaccTransGetCurrency (gnc_import_TransInfo_get_trans (trans_info)),
+             ACCT_TYPE_NONE,
+             old_acc,
+             &ok_pressed);
     if (ok_pressed)
         gnc_import_TransInfo_set_destacc (trans_info, new_acc, TRUE);
 }
@@ -445,8 +453,9 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
 }
 
 static void
-gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
-                                                       GNCImportMainMatcher *info)
+gnc_gen_trans_assign_transfer_account_to_selection_cb (
+            GtkMenuItem *menuitem,
+            GNCImportMainMatcher *info)
 {
     GtkTreeView *treeview;
     GtkTreeSelection *selection;
@@ -475,13 +484,15 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
         {
             gchar *path_str = gtk_tree_path_to_string (l->data);
             DEBUG("passing first = %s", first ? "true" : "false");
-            DEBUG("passing is_selection = %s", is_selection ? "true" : "false");
+            DEBUG("passing is_selection = %s",
+                        is_selection ? "true" : "false");
             DEBUG("passing path = %s", path_str);
             g_free (path_str);
             DEBUG("passing account value = %s",
                         gnc_account_get_full_name (assigned_account));
             gnc_gen_trans_assign_transfer_account (treeview,
-                           &first, is_selection, l->data, &assigned_account, info);
+                        &first, is_selection, l->data,
+                        &assigned_account, info);
             DEBUG("returned value of account = %s",
                         gnc_account_get_full_name (assigned_account));
             DEBUG("returned value of first = %s", first ? "true" : "false");
@@ -556,7 +567,8 @@ gnc_gen_trans_view_popup_menu (GtkTreeView *treeview,
 
     ENTER ("");
     menu = gtk_menu_new();
-    menuitem = gtk_menu_item_new_with_label (_("Assign a transfer account."));
+    menuitem = gtk_menu_item_new_with_label (
+            _("Assign a transfer account to the selection."));
     g_signal_connect (menuitem, "activate",
                       G_CALLBACK(
                       gnc_gen_trans_assign_transfer_account_to_selection_cb),
@@ -598,7 +610,7 @@ gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview,
             selection = gtk_tree_view_get_selection (treeview);
             if (gtk_tree_selection_count_selected_rows (selection) > 0)
             {
-              gnc_gen_trans_view_popup_menu (treeview, event, info);
+                gnc_gen_trans_view_popup_menu (treeview, event, info);
             }
             LEAVE("return TRUE");
             return TRUE;
@@ -619,13 +631,12 @@ gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview,
     selection = gtk_tree_view_get_selection (treeview);
     if (gtk_tree_selection_count_selected_rows (selection) > 0)
     {
-      gnc_gen_trans_view_popup_menu (treeview, NULL, info);
+        gnc_gen_trans_view_popup_menu (treeview, NULL, info);
     }
     LEAVE ("");
     return TRUE;
 }
 
-
 static GtkTreeViewColumn *
 add_text_column(GtkTreeView *view, const gchar *title, int col_num)
 {

commit caeea74b5003788a79fd684e50244dac44f11e93
Author: David Cousens <davidcousens at bigpond.com>
Date:   Sat Jun 29 07:43:10 2019 +1000

    Add view_selection_function
    
    view_selection_function added to only allow adding a row to the selection if GNCImport_Add is set for the transaction.
    Explicit selection clearing
    
    try explicitly clearing the row in the add, update and clear toggle callbacks - before refresh row and add debugging info which showed that the selection is called after exiting the above callbacks and as the view_selection_function has no knowledge that the add checkbox has just been toggled it allows the row to be selected. Requires a flag to be set in the add_toggle_cb which prevents selection in the view_selection_function and is cleared there.
    Fix row being selected after A(dd)toggled
    
    When the A is toggled on from U+R or R the row is automatically selected and if the row is toggled back to U+R or R selected, it cannot be unselected. Add a global add-toggled flag set in the gnc_gen_trans_add-toggled_cb and used in the treeview  multiple selection function to prevent a row being selected immediately after the A has been toggled.
    Fix to Multiple selection to ensure the match dialog comes up on double click on a  reconciled or update row and implement a view_selection_function so that only rows flagged for addition can be added to a selection
    
    
    Fixes requested by Bob-IT
    
    removed global add_toggled variable and added it to _main_matcher_info structure. modified gnc_gen_trans_add_toggled_cb and view_selection_function to use the _main_matcher_info member.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index be39bcf0f..d6c52169d 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -54,6 +54,7 @@
 
 #define GNC_PREFS_GROUP "dialogs.import.generic.transaction-list"
 
+
 struct _main_matcher_info
 {
     GtkWidget *main_widget;
@@ -65,6 +66,7 @@ struct _main_matcher_info
     gpointer user_data;
     GNCImportPendingMatches *pending_matches;
     GtkTreeViewColumn *account_column;
+    gboolean add_toggled;   // flag to indicate that add has been toggled to stop selection
 };
 
 enum downloaded_cols
@@ -90,7 +92,10 @@ enum downloaded_cols
 #define CSS_INT_PROB_REQUIRED_CLASS "intervention-probably-required"
 #define CSS_INT_NOT_REQUIRED_CLASS  "intervention-not-required"
 
-static QofLogModule log_module = GNC_MOD_IMPORT;
+/* Define log domain for extended debugging of matcher */
+#define G_MOD_IMPORT_MATCHER "gnc.import.main-matcher"
+/*static QofLogModule log_module = GNC_MOD_IMPORT;*/
+static QofLogModule log_module = G_MOD_IMPORT_MATCHER;
 
 void on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info);
 void on_matcher_cancel_clicked (GtkButton *button, gpointer user_data);
@@ -117,6 +122,11 @@ static gboolean gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview,
 static gboolean gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview,
                                               GdkEvent *event,
                                               GNCImportMainMatcher *info);
+static gboolean view_selection_function (GtkTreeSelection *selection,
+                         GtkTreeModel *model,
+                         GtkTreePath *path,
+                         gboolean path_currently_selected,
+                         gpointer data);
 static void refresh_model_row (GNCImportMainMatcher *gui, GtkTreeModel *model,
                                GtkTreeIter *iter, GNCImportTransInfo *info);
 /* end local prototypes */
@@ -306,6 +316,7 @@ gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
 
+    ENTER("");
     model = gtk_tree_view_get_model (gui->view);
     if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
         return;
@@ -319,8 +330,10 @@ gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
     else
     {
         gnc_import_TransInfo_set_action (trans_info, GNCImport_ADD);
+        gui->add_toggled =TRUE;  //flag A(dd) has just been toggled to view_selection_function
     }
     refresh_model_row (gui, model, &iter, trans_info);
+    LEAVE("");
 }
 
 static void
@@ -331,8 +344,10 @@ gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
-
+    
+    ENTER("");
     model = gtk_tree_view_get_model (gui->view);
+    
     if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
         return;
     gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
@@ -347,6 +362,7 @@ gnc_gen_trans_clear_toggled_cb (GtkCellRendererToggle *cell_renderer,
         gnc_import_TransInfo_set_action (trans_info, GNCImport_CLEAR);
     }
     refresh_model_row (gui, model, &iter, trans_info);
+    LEAVE("");
 }
 
 static void
@@ -357,8 +373,10 @@ gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
     GtkTreeModel *model;
     GtkTreeIter iter;
     GNCImportTransInfo *trans_info;
-
+    
+    ENTER("");
     model = gtk_tree_view_get_model (gui->view);
+    
     if (!gtk_tree_model_get_iter_from_string (model, &iter, path))
         return;
     gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
@@ -373,6 +391,7 @@ gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
         gnc_import_TransInfo_set_action (trans_info, GNCImport_UPDATE);
     }
     refresh_model_row (gui, model, &iter, trans_info);
+    LEAVE("");
 }
 
 static void
@@ -457,7 +476,7 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
     GList *selected_rows, *l;
     gboolean first, is_selection;
 
-    ENTER("");
+    ENTER("assign_transfer_account_to_selection_cb");
     treeview = GTK_TREE_VIEW(info->view);
     model = gtk_tree_view_get_model (treeview);
     selection = gtk_tree_view_get_selection (treeview);
@@ -481,7 +500,7 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
             DEBUG("passing account value = %s",
                         gnc_account_get_full_name (assigned_account));
             gnc_gen_trans_assign_transfer_account (treeview,
-                           &first, is_selection, l->data, &assigned_account, info);
+                &first, is_selection, l->data, &assigned_account, info);
             DEBUG("returned value of account = %s",
                         gnc_account_get_full_name (assigned_account));
             DEBUG("returned value of first = %s", first ? "true" : "false");
@@ -614,14 +633,16 @@ gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview,
                               GNCImportMainMatcher *info)
 {
     GtkTreeSelection *selection;
-    ENTER("");
+    ENTER("onPopupMenu_cb");
     /* respond to Shift-F10 popup menu hotkey */
     selection = gtk_tree_view_get_selection (treeview);
     if (gtk_tree_selection_count_selected_rows (selection) > 0)
     {
       gnc_gen_trans_view_popup_menu (treeview, NULL, info);
+      LEAVE ("TRUE");
+      return TRUE;
     }
-    LEAVE ("");
+    LEAVE ("FALSE");
     return TRUE;
 }
 
@@ -750,8 +771,21 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
     gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(store),
                                           DOWNLOADED_COL_DATE_INT64,
                                           GTK_SORT_ASCENDING);
-
     selection = gtk_tree_view_get_selection (info->view);
+    
+    /* set a selection function which will block selection of rows which are not 
+      flagged to be imported into Gnucash */
+    gtk_tree_selection_set_select_function
+                               (selection,
+                                view_selection_function,
+                                info,
+                                NULL);
+    /* clear the flag which indicates that A(dd) has been toggled so that the 
+      view_selection_function can block selection of a row when the 
+      view_selection_function is called immediately after A(dd) is toggled 
+      on that row */
+    info->add_toggled = FALSE;
+                                
     g_signal_connect (info->view, "row-activated",
                       G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
     g_signal_connect (selection, "changed",
@@ -763,6 +797,73 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
                       G_CALLBACK(gnc_gen_trans_onPopupMenu_cb), info);
 }
 
+static gboolean
+view_selection_function (GtkTreeSelection *selection,
+                         GtkTreeModel *model,
+                         GtkTreePath *path,
+                         gboolean path_currently_selected,
+                         gpointer data)
+{
+    GtkTreeIter iter;
+    GNCImportTransInfo *trans_info;
+    GNCImportAction action;
+    GNCImportMainMatcher *info = data;
+  
+    ENTER("view_selection_function");
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
+        switch (gnc_import_TransInfo_get_action (trans_info))
+        {
+            case GNCImport_ADD:
+                DEBUG("Import action = ADD row selected");
+                if (info->add_toggled)
+                {
+                  DEBUG("Add just toggled- do not select the row.");
+                  info->add_toggled = FALSE;
+                  LEAVE("FALSE");
+                  return FALSE;
+                }
+                else
+                {
+                  DEBUG("Add has not been toggled - select the row");
+                  LEAVE("TRUE");
+                  return TRUE;
+                }
+            case GNCImport_UPDATE:
+                DEBUG("Import action = UPDATE row not selected");
+                LEAVE("FALSE");
+                return FALSE;
+            case GNCImport_CLEAR:
+                DEBUG("Import action = CLEAR row not selected");
+                LEAVE("FALSE");
+                return FALSE;
+            case GNCImport_SKIP:
+                DEBUG("Import action = SKIP row not selected");
+                LEAVE("FALSE");
+                return FALSE;
+            case GNCImport_LAST_ACTION:
+                DEBUG("Import action = LAST_ACTION row not selected");
+                LEAVE("FALSE");
+                return FALSE;
+            case GNCImport_INVALID_ACTION: 
+                DEBUG("Import action = LAST_ACTION row not selected"); 
+                LEAVE("FALSE");
+                return FALSE;    
+            default:
+                DEBUG("Import action = UNDEFINED -cannot select");
+                LEAVE("FALSE");
+                return FALSE;
+        }    
+    }
+    else
+    {
+        DEBUG("path to selected row undefined");
+        LEAVE("FALSE");
+        return FALSE;
+    } 
+}
+
 static void
 show_account_column_toggled_cb (GtkToggleButton *togglebutton,
                                 GNCImportMainMatcher *info)



Summary of changes:
 gnucash/gtkbuilder/dialog-import.glade      |  34 ++++-
 gnucash/import-export/import-main-matcher.c | 190 ++++++++++++++++++++++------
 2 files changed, 184 insertions(+), 40 deletions(-)



More information about the gnucash-changes mailing list