gnucash master: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Tue May 19 11:30:25 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/6ee48544 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5640de09 (commit)
	from  https://github.com/Gnucash/gnucash/commit/279a632b (commit)



commit 6ee485441f2c2243b46dbb14aec96f16ca1fee94
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue May 19 11:19:13 2020 +0100

    Bug 797754 - Account Register scrolling stops working
    
    In an account register, scrolling stops working when the mouse pointer
    re-enters the scrollbar after leaving it. This was caused by a fix for
    the scrollbar not being updated in earlier versions of Gtk+. Having
    removed this earlier fix and tried on Windows 10 and two flavours of
    Linux with the current version of Gtk+ the earlier problem is not
    evident so this commit removes that fix.

diff --git a/gnucash/register/register-gnome/gnucash-register.c b/gnucash/register/register-gnome/gnucash-register.c
index 6253a63b1..37e892098 100644
--- a/gnucash/register/register-gnome/gnucash-register.c
+++ b/gnucash/register/register-gnome/gnucash-register.c
@@ -543,31 +543,6 @@ gnucash_register_configure (GnucashSheet *sheet, const gchar * state_section)
     LEAVE(" ");
 }
 
-static gboolean
-gnucash_register_enter_scrollbar (GtkWidget *widget,
-                                  GdkEvent *event, gpointer user_data)
-{
-    GnucashRegister *reg = user_data;
-    GnucashSheet *sheet = GNUCASH_SHEET(reg->sheet);
-    GtkWidget *vscrollbar = sheet->vscrollbar;
-    GtkWidget *hscrollbar = sheet->hscrollbar;
-
-    // There seems to be a problem with the scrollbar slider not being
-    // updated as the mouse moves possibly related to the following bug
-    // https://bugs.gnucash.org/show_bug.cgi?id=765410
-    // If they are hidden and shown it seems to fix it.
-
-    gtk_widget_hide (GTK_WIDGET(vscrollbar));
-    gtk_widget_show (GTK_WIDGET(vscrollbar));
-
-    if (gtk_widget_is_visible (hscrollbar))
-    {
-        gtk_widget_hide (GTK_WIDGET(hscrollbar));
-        gtk_widget_show (GTK_WIDGET(hscrollbar));
-    }
-    return FALSE;
-}
-
 
 static GtkWidget *
 gnucash_register_create_widget (Table *table)
@@ -614,9 +589,6 @@ gnucash_register_create_widget (Table *table)
     gtk_widget_show (scrollbar);
     GNUCASH_SHEET(sheet)->vscrollbar = scrollbar;
 
-    g_signal_connect(G_OBJECT(scrollbar), "enter-notify-event",
-                      G_CALLBACK(gnucash_register_enter_scrollbar), reg);
-
     scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GNUCASH_SHEET(sheet)->hadj);
     gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(scrollbar), 0, 2, 1, 1);
     gtk_widget_set_hexpand (GTK_WIDGET(scrollbar), TRUE);
@@ -629,9 +601,6 @@ gnucash_register_create_widget (Table *table)
     reg->hscrollbar_visible = TRUE;
     GNUCASH_SHEET(sheet)->hscrollbar = scrollbar;
 
-    g_signal_connect(G_OBJECT(scrollbar), "enter-notify-event",
-                      G_CALLBACK(gnucash_register_enter_scrollbar), reg);
-
     g_signal_connect (GNUCASH_SHEET(sheet)->hadj, "changed",
                       G_CALLBACK (gnucash_register_update_hadjustment), reg);
 
diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 7c4b4cdfe..04eca835d 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -1422,8 +1422,9 @@ gnucash_scroll_event (GtkWidget *widget, GdkEventScroll *event)
 
     if (event->delta_y == 0)
     {
-        // There are problems with the slider not tracking the value so
-        // when delta_y is 0 hide and showing the scrollbar seems to fix it
+        /* There are problems with the slider not tracking the value so
+           when delta_y is 0 hide and showing the scrollbar seems to fix it
+           observed when using mouse wheel on sheet after a page-up or down */
         gtk_widget_hide (GTK_WIDGET(sheet->vscrollbar));
         gtk_widget_show (GTK_WIDGET(sheet->vscrollbar));
     }

commit 5640de09df8f95283fa1b9effef4dec6c2c11741
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon May 18 13:16:26 2020 +0100

    Reselect the transaction rows in import-main-matcher
    
    Once the transfer account is selected and control returned to the
    Generic main matcher window the transaction rows will now be unselected.
    This commit reselects the appropriate rows.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 786c160b8..ce25126ae 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -523,6 +523,7 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (
     Account *assigned_account;
     GList *selected_rows, *l;
     gboolean first, is_selection;
+    GList *refs = NULL;
 
     ENTER("assign_transfer_account_to_selection_cb");
     treeview = GTK_TREE_VIEW(info->view);
@@ -532,6 +533,7 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (
     assigned_account = NULL;
     first = TRUE;
     is_selection = TRUE;
+
     DEBUG("Rows in selection = %i",
           gtk_tree_selection_count_selected_rows (selection));
     DEBUG("Entering loop over selection");
@@ -541,11 +543,13 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (
         for (l = selected_rows; l != NULL; l = l->next)
         {
             gchar *path_str = gtk_tree_path_to_string (l->data);
+            GtkTreeRowReference *ref = gtk_tree_row_reference_new (model, l->data);
             DEBUG("passing first = %s", first ? "true" : "false");
             DEBUG("passing is_selection = %s",
                         is_selection ? "true" : "false");
             DEBUG("passing path = %s", path_str);
             g_free (path_str);
+            refs = g_list_prepend (refs, ref);
             DEBUG("passing account value = %s",
                         gnc_account_get_full_name (assigned_account));
             gnc_gen_trans_assign_transfer_account (treeview,
@@ -556,10 +560,23 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (
             DEBUG("returned value of first = %s", first ? "true" : "false");
             if (assigned_account == NULL)
                 break;
-            gtk_tree_selection_unselect_path (selection, l->data);
+
         }
     }
     g_list_free_full (selected_rows, (GDestroyNotify) gtk_tree_path_free);
+
+    // now reselect the transaction rows.
+    for (l = refs; l != NULL; l = l->next)
+    {
+        GtkTreePath *path = gtk_tree_row_reference_get_path (l->data);
+
+        gtk_tree_selection_select_path (selection, path);
+
+        gtk_tree_path_free (path);
+        gtk_tree_row_reference_free (l->data);
+    }
+    g_list_free (refs);
+
     LEAVE("");
 }
 
@@ -579,6 +596,9 @@ gnc_gen_trans_row_activated_cb (GtkTreeView *treeview,
     gnc_gen_trans_assign_transfer_account (treeview,
                             &first, is_selection, path,
                             &assigned_account, info);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (treeview), path);
+
     DEBUG("account returned = %s", gnc_account_get_full_name (assigned_account));
     LEAVE("");
 }
@@ -1006,7 +1026,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
 
     g_object_unref (G_OBJECT(builder));
-    
+
     // Register this UI, it needs to be closed when the session is closed.
     info->id = gnc_register_gui_component (IMPORT_MAIN_MATCHER_CM_CLASS,
                                            NULL, /* no refresh handler */



Summary of changes:
 gnucash/import-export/import-main-matcher.c        | 24 +++++++++++++++--
 gnucash/register/register-gnome/gnucash-register.c | 31 ----------------------
 gnucash/register/register-gnome/gnucash-sheet.c    |  5 ++--
 3 files changed, 25 insertions(+), 35 deletions(-)



More information about the gnucash-changes mailing list