gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Mon Mar 16 08:34:08 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/2c956225 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3bccb96e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/38bafcce (commit)
	from  https://github.com/Gnucash/gnucash/commit/d825d74c (commit)



commit 2c95622511193a020e002ff55df61f0e55ec7739
Merge: 3bccb96ea 38bafcce0
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 16 12:30:03 2020 +0000

    Merge Peter Zimmer's 'pkzw_bug797636' into maint


commit 3bccb96ea438c2384755b88aa6318e8b0259b47a
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 16 12:28:20 2020 +0000

    Change the default focus to search entry for 'Find Account'

diff --git a/gnucash/gtkbuilder/dialog-find-account.glade b/gnucash/gtkbuilder/dialog-find-account.glade
index 065dede70..99d231888 100644
--- a/gnucash/gtkbuilder/dialog-find-account.glade
+++ b/gnucash/gtkbuilder/dialog-find-account.glade
@@ -185,6 +185,8 @@
           <object class="GtkLabel" id="filter-label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="margin_top">3</property>
+            <property name="margin_bottom">3</property>
             <property name="label" translatable="yes">Case insensitive searching is available on 'Account Full Name'.</property>
             <property name="justify">center</property>
           </object>
@@ -213,6 +215,9 @@
               <object class="GtkEntry" id="filter-text-entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="invisible_char">●</property>
                 <property name="primary_icon_activatable">False</property>
                 <property name="secondary_icon_activatable">False</property>
@@ -259,6 +264,8 @@
           <object class="GtkLabel" id="label8">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="margin_top">3</property>
+            <property name="margin_bottom">3</property>
             <property name="label" translatable="yes">Select a row and then press 'jump to' to jump to account in the Account Tree,
 if account should not be shown, this will be temporarily overridden.</property>
             <property name="justify">center</property>

commit 38bafcce063bf9904b74e2b9e060cfe1e4ddafda
Author: Dr. Peter Zimmerer <pkzw at web.de>
Date:   Mon Mar 2 16:54:03 2020 +0100

    Bug 797636 - Incorrect Online account matches cannot be deleted
    
    A push button with text "Delete selected matches" is added to the
    "Match Online accounts with GnuCash accounts" page of the "Online
    Banking Setup" tool.
    Additionally, the underlying tree view is set to multiple selection
    mode from single selection mode.
    Pushing the button will remove the matched GnuCash account from
    all selected AqBanking (Online) accounts.

diff --git a/gnucash/import-export/aqb/assistant-ab-initial.c b/gnucash/import-export/aqb/assistant-ab-initial.c
index 13425a67c..946bf5731 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.c
+++ b/gnucash/import-export/aqb/assistant-ab-initial.c
@@ -89,6 +89,7 @@ gboolean aai_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer
 
 void aai_wizard_page_prepare (GtkAssistant *assistant, gpointer user_data);
 void aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data);
+void aai_match_delete_button_clicked_cb(GtkButton *button, gpointer user_data);
 
 #ifdef AQBANKING6
 static guint aai_ab_account_hash(gconstpointer v);
@@ -106,6 +107,8 @@ static gboolean find_gnc_acc_cb(gpointer key, gpointer value, gpointer user_data
 static gboolean clear_line_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data);
 static void account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
                                      GtkTreeViewColumn  *col, gpointer user_data);
+static void delete_account_match(ABInitialInfo *info, RevLookupData *data);
+static void delete_selected_match_cb(gpointer data, gpointer user_data);
 static void insert_acc_into_revhash_cb(gpointer ab_acc, gpointer gnc_acc, gpointer revhash);
 static void remove_acc_from_revhash_cb(gpointer ab_acc, gpointer gnc_acc, gpointer revhash);
 static void clear_kvp_acc_cb(gpointer key, gpointer value, gpointer user_data);
@@ -305,6 +308,66 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
     LEAVE(" ");
 }
 
+static void delete_account_match(ABInitialInfo *info, RevLookupData *data)
+{
+    g_return_if_fail(info && info->gnc_hash &&
+        info->account_view && data && data->ab_acc);
+
+    g_hash_table_remove(info->gnc_hash, data->ab_acc);
+    gtk_tree_model_foreach(
+        GTK_TREE_MODEL(info->account_store),
+        (GtkTreeModelForeachFunc) clear_line_cb,
+        data);
+}
+
+static void
+delete_selected_match_cb(gpointer data, gpointer user_data)
+{
+    GNC_AB_ACCOUNT_SPEC *ab_acc = NULL;
+    GtkTreeIter iter;
+    GtkTreeModel *model = NULL;
+    RevLookupData revLookupData = {NULL, NULL};
+
+    GtkTreePath *path = (GtkTreePath *) data;
+    ABInitialInfo *info = (ABInitialInfo *) user_data;
+    g_return_if_fail(path && info && info->account_view);
+
+    model = gtk_tree_view_get_model(info->account_view);
+    g_return_if_fail(model);
+
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        gtk_tree_model_get(model, &iter, ACCOUNT_LIST_COL_AB_ACCT, &revLookupData.ab_acc, -1);
+        if (revLookupData.ab_acc)
+            delete_account_match(info, &revLookupData);
+    }
+}
+
+void
+aai_match_delete_button_clicked_cb(GtkButton *button, gpointer user_data)
+{
+    GList *selected_matches = NULL;
+    GtkTreeSelection *selection = NULL;
+    ABInitialInfo *info = (ABInitialInfo *) user_data;
+
+    g_return_if_fail(info && info->api && info->account_view && info->gnc_hash);
+
+    PINFO("Selected account matches are deleted");
+
+    selection = gtk_tree_view_get_selection (info->account_view);
+    if (selection)
+    {
+        selected_matches = gtk_tree_selection_get_selected_rows (selection, NULL);
+        if (selected_matches)
+        {
+            g_list_foreach (selected_matches, delete_selected_match_cb, info);
+            g_list_free_full (
+                selected_matches,
+                (GDestroyNotify) gtk_tree_path_free);
+        }
+    }
+}
+
 #ifdef AQBANKING6
 static guint
 aai_ab_account_hash (gconstpointer v)
@@ -648,13 +711,7 @@ account_list_clicked_cb (GtkTreeView *view, GtkTreePath *path,
                 g_hash_table_find(info->gnc_hash, (GHRFunc) find_gnc_acc_cb,
                                   &data);
                 if (data.ab_acc)
-                {
-                    g_hash_table_remove(info->gnc_hash, data.ab_acc);
-                    gtk_tree_model_foreach(
-                        GTK_TREE_MODEL(info->account_store),
-                        (GtkTreeModelForeachFunc) clear_line_cb,
-                        &data);
-                }
+                    delete_account_match(info, &data);
 
                 /* Map ab_acc to gnc_acc */
                 g_hash_table_insert(info->gnc_hash, ab_acc, gnc_acc);
@@ -800,7 +857,7 @@ gnc_ab_initial_assistant_new(void)
     gtk_tree_view_append_column(info->account_view, column);
 
     selection = gtk_tree_view_get_selection(info->account_view);
-    gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+    gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
 
     gnc_restore_window_size (GNC_PREFS_GROUP,
                              GTK_WINDOW(info->window), gnc_ui_get_main_window(NULL));
diff --git a/gnucash/import-export/aqb/assistant-ab-initial.glade b/gnucash/import-export/aqb/assistant-ab-initial.glade
index 0c9d085b8..928ed90cf 100644
--- a/gnucash/import-export/aqb/assistant-ab-initial.glade
+++ b/gnucash/import-export/aqb/assistant-ab-initial.glade
@@ -125,6 +125,19 @@ Click on "Next" to proceed or "Cancel" to Abort Import.</property>
         <property name="border_width">12</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="account_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Double Click on the line of an Online Banking account name if you want to match it to a GnuCash account or select incorrect matches and click "Delete selected matches". Click "Next" when all desired accounts are matching.</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkScrolledWindow" id="account_scrolledwindow">
             <property name="visible">True</property>
@@ -143,20 +156,34 @@ Click on "Next" to proceed or "Cancel" to Abort Import.</property>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="account_label">
+          <object class="GtkBox" id="button_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Double Click on the line of an Online Banking account name if you want to match it to a GnuCash account. Click "Next" when all desired accounts are matching.</property>
-            <property name="wrap">True</property>
+            <child>
+              <object class="GtkButton" id="ab_match_delete_button">
+                <property name="label" translatable="yes">_Delete selected matches</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">start</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="aai_match_delete_button_clicked_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>



Summary of changes:
 gnucash/gtkbuilder/dialog-find-account.glade       |  7 +++
 gnucash/import-export/aqb/assistant-ab-initial.c   | 73 +++++++++++++++++++---
 .../import-export/aqb/assistant-ab-initial.glade   | 37 +++++++++--
 3 files changed, 104 insertions(+), 13 deletions(-)



More information about the gnucash-changes mailing list