gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Sep 10 15:24:29 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/a8c20604 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fcd054a2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a2e99bda (commit)
	 via  https://github.com/Gnucash/gnucash/commit/190fbc20 (commit)
	from  https://github.com/Gnucash/gnucash/commit/4dec95e6 (commit)



commit a8c20604ab55585575ff170104ee31cfa8804d85
Merge: fcd054a257 190fbc2031
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 10 12:22:38 2023 -0700

    Merge Bob Fewel's 'bug798990' into stable.


commit fcd054a257c3ea1d8f61c7664445eb83112f9ea2
Merge: 4dec95e642 a2e99bdafc
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 10 11:59:02 2023 -0700

    Merge Bob Fewell's 'bug798995' into stable.


commit a2e99bdafc87d97d058641c1faf5a29d1d24ff02
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Aug 18 12:09:12 2023 +0100

    Bug 798995 - Keystrokes ignored during ledger entry
    
    Some themes add additional pixels to list rows and dialogs, in this
    case with 'TraditionalOK' 2 pixels are added to each entry in the
    list and 2 to the popup. This make the calculation for the pop up
    height wrong and so when compared to the allocation height it is
    different so tries to resolve by re-poping the list and this
    cuases an endless loop.
    
    To fix this, use the calculated height which works for Adwaita but
    if this is different to the popup allocation height use that.

diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 80304cb292..816269e500 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -920,29 +920,20 @@ gnc_combo_cell_gui_move (BasicCell* bcell)
 }
 
 static int
-popup_get_height (G_GNUC_UNUSED GtkWidget* widget,
+popup_get_height (GtkWidget* widget,
                   int space_available,
-                  int row_height,
+                  G_GNUC_UNUSED int row_height,
                   gpointer user_data)
 {
     PopBox* box = user_data;
     GtkScrolledWindow* scrollwin = GNC_ITEM_LIST(widget)->scrollwin;
-    GtkWidget *hsbar = gtk_scrolled_window_get_hscrollbar (scrollwin);
-    GtkStyleContext *context = gtk_widget_get_style_context (hsbar);
-    /* Note: gtk_scrolled_window_get_overlay_scrolling (scrollwin) always returns
-       TRUE so look for style class "overlay-indicator" on the scrollbar. */
-    gboolean overlay = gtk_style_context_has_class (context, "overlay-indicator");
-    int count, height;
+    int height;
 
-    count = gnc_item_list_num_entries (box->item_list);
-    height = count * (gnc_item_list_get_cell_height (box->item_list) + 2);
-
-    if (!overlay)
-    {
-        gint minh, nath;
-        gtk_widget_get_preferred_height (hsbar, &minh, &nath);
-        height = height + minh;
-    }
+    // if popup_allocation_height set use that
+    if (box->item_edit->popup_allocation_height != -1)
+        height = box->item_edit->popup_allocation_height;
+    else
+        height = gnc_item_list_get_popup_height (GNC_ITEM_LIST(widget));
 
     if (height < space_available)
     {
diff --git a/gnucash/register/register-gnome/completioncell-gnome.c b/gnucash/register/register-gnome/completioncell-gnome.c
index b1eb0a420a..a1cbffbb2c 100644
--- a/gnucash/register/register-gnome/completioncell-gnome.c
+++ b/gnucash/register/register-gnome/completioncell-gnome.c
@@ -644,6 +644,7 @@ populate_list_store (CompletionCell* cell, const gchar* str)
     PopBox* box = cell->cell.gui_private;
 
     box->in_list_select = FALSE;
+    box->item_edit->popup_allocation_height = -1;
 
     if (box->stop_searching)
         return;
@@ -904,27 +905,20 @@ gnc_completion_cell_gui_move (BasicCell* bcell)
 }
 
 static int
-popup_get_height (G_GNUC_UNUSED GtkWidget* widget,
+popup_get_height (GtkWidget* widget,
                   int space_available,
-                  int row_height,
+                  G_GNUC_UNUSED int row_height,
                   gpointer user_data)
 {
     PopBox* box = user_data;
     GtkScrolledWindow* scrollwin = GNC_ITEM_LIST(widget)->scrollwin;
-    GtkWidget *hsbar = gtk_scrolled_window_get_hscrollbar (scrollwin);
-    GtkStyleContext *context = gtk_widget_get_style_context (hsbar);
-    /* Note: gtk_scrolled_window_get_overlay_scrolling (scrollwin) always returns
-       TRUE so look for style class "overlay-indicator" on the scrollbar. */
-    gboolean overlay = gtk_style_context_has_class (context, "overlay-indicator");
-    int count = gnc_item_list_num_entries (box->item_list);
-    int height = count * (gnc_item_list_get_cell_height (box->item_list) + 2);
-
-    if (!overlay)
-    {
-        gint minh, nath;
-        gtk_widget_get_preferred_height (hsbar, &minh, &nath);
-        height = height + minh;
-    }
+    int height;
+
+    // if popup_allocation_height set use that
+    if (box->item_edit->popup_allocation_height != -1)
+        height = box->item_edit->popup_allocation_height;
+    else
+        height = gnc_item_list_get_popup_height (GNC_ITEM_LIST(widget));
 
     if (height < space_available)
     {
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 74316db005..ee96f3d716 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -319,6 +319,7 @@ gnc_item_edit_init (GncItemEdit *item_edit)
     item_edit->popup_user_data = NULL;
     item_edit->popup_returned_height = 0;
     item_edit->popup_height_signal_id = 0;
+    item_edit->popup_allocation_height = -1;
 
     item_edit->style = NULL;
     item_edit->button_width = MIN_BUTT_WIDTH;
@@ -944,15 +945,15 @@ gnc_item_edit_destroying (GtkWidget *item_edit, gpointer data)
 static void
 check_popup_height_is_true (GtkWidget    *widget,
                             GdkRectangle *allocation,
-                            gpointer user_data)
+                            gpointer      user_data)
 {
     GncItemEdit *item_edit = GNC_ITEM_EDIT(user_data);
 
-    // if a larger font is specified in css for the sheet, the popup returned height value
-    // on first pop does not reflect the true height but the minimum height so just to be
-    // sure check this value against the allocated one.
+    // the popup returned height value on first pop sometimes does not reflect the true height
+    // but the minimum height so just to be sure check this value against the allocated one.
     if (allocation->height != item_edit->popup_returned_height)
     {
+        item_edit->popup_allocation_height = allocation->height;
         gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
 
         g_idle_add_full (G_PRIORITY_HIGH_IDLE,
@@ -1105,6 +1106,8 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
     gtk_toggle_button_set_active
         (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
 
+    item_edit->popup_allocation_height = -1;
+
     gtk_widget_grab_focus (GTK_WIDGET(item_edit->sheet));
 }
 
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 185f3e3251..899ccd474d 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -91,6 +91,7 @@ typedef struct
     PopupGetWidth    popup_get_width;
     gpointer         popup_user_data;
     gint             popup_returned_height;
+    gint             popup_allocation_height;
     gulong           popup_height_signal_id;
 
     GtkBorder        padding;
diff --git a/gnucash/register/register-gnome/gnucash-item-list.c b/gnucash/register/register-gnome/gnucash-item-list.c
index 0b1eee4296..efd0817a03 100644
--- a/gnucash/register/register-gnome/gnucash-item-list.c
+++ b/gnucash/register/register-gnome/gnucash-item-list.c
@@ -468,7 +468,7 @@ tree_view_selection_changed (GtkTreeSelection* selection,
 }
 
 
-gint
+static gint
 gnc_item_list_get_cell_height (GncItemList *item_list)
 {
 
@@ -481,6 +481,26 @@ gnc_item_list_get_cell_height (GncItemList *item_list)
     return min_height;
 }
 
+gint
+gnc_item_list_get_popup_height (GncItemList *item_list)
+{
+    GtkWidget *hsbar = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW(item_list->scrollwin));
+    GtkStyleContext *context = gtk_widget_get_style_context (hsbar);
+    /* Note: gtk_scrolled_window_get_overlay_scrolling (scrollwin) always returns
+       TRUE so look for style class "overlay-indicator" on the scrollbar. */
+    gboolean overlay = gtk_style_context_has_class (context, "overlay-indicator");
+    int count = gnc_item_list_num_entries (item_list);
+    int height = count * (gnc_item_list_get_cell_height (item_list) + 2);
+
+    if (!overlay)
+    {
+        gint minh, nath;
+        gtk_widget_get_preferred_height (hsbar, &minh, &nath);
+        height = height + minh;
+    }
+    return height;
+}
+
 
 GtkWidget*
 gnc_item_list_new (GtkListStore* list_store)
diff --git a/gnucash/register/register-gnome/gnucash-item-list.h b/gnucash/register/register-gnome/gnucash-item-list.h
index 4cf903c339..788af37193 100644
--- a/gnucash/register/register-gnome/gnucash-item-list.h
+++ b/gnucash/register/register-gnome/gnucash-item-list.h
@@ -71,7 +71,7 @@ GtkWidget *gnc_item_list_new (GtkListStore *shared_store);
 
 gint gnc_item_list_num_entries (GncItemList *item_list);
 
-gint gnc_item_list_get_cell_height (GncItemList *item_list);
+gint gnc_item_list_get_popup_height (GncItemList *item_list);
 
 void gnc_item_list_clear (GncItemList *item_list);
 

commit 190fbc20317cd8457e12c12bf6c390b92df9ffa1
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Aug 6 11:46:42 2023 +0100

    Bug 798990 - Notes No Longer Autofills
    
    With the change to delay loading the non focused registers, the notes
    and memo quick fills are empty. This is due to trying to populate the
    quick fill on the first load when there are no splits so change
    populating the quick fill lists to the subsequent load only.

diff --git a/gnucash/register/ledger-core/split-register-load.c b/gnucash/register/ledger-core/split-register-load.c
index 5a9bbd7035..1f756e07b0 100644
--- a/gnucash/register/ledger-core/split-register-load.c
+++ b/gnucash/register/ledger-core/split-register-load.c
@@ -354,6 +354,10 @@ update_info (SRInfo* info, SplitRegister* reg)
         gnc_split_register_get_current_trans_split (reg, NULL);
     info->cursor_hint_cursor_class =
         gnc_split_register_get_current_cursor_class (reg);
+
+    if (!info->first_pass && !info->quickfill_setup)
+        info->quickfill_setup = TRUE;
+
     info->hint_set_by_traverse = FALSE;
     info->traverse_to_new = FALSE;
     info->exact_traversal = FALSE;
@@ -746,16 +750,15 @@ gnc_split_register_load (SplitRegister* reg, GList* slist,
             }
         }
 
-        /* If this is the first load of the register,
-         * fill up the quickfill cells. */
-        if (info->first_pass)
+        /* On first load the split list is empty so fill up the quickfill cells
+         * only on the next load. */
+        if (!info->first_pass && !info->quickfill_setup)
             add_quickfill_completions (reg->table->layout, trans, split, has_last_num);
 
         gnc_completion_cell_add_menu_item (
             (CompletionCell*) gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
              xaccTransGetDescription (trans));
 
-
         if (trans == find_trans)
             new_trans_row = vcell_loc.virt_row;
 
diff --git a/gnucash/register/ledger-core/split-register-p.h b/gnucash/register/ledger-core/split-register-p.h
index e4081e83f3..276f2a7c6e 100644
--- a/gnucash/register/ledger-core/split-register-p.h
+++ b/gnucash/register/ledger-core/split-register-p.h
@@ -100,6 +100,9 @@ struct sr_info
     /** true if we are loading the register for the first time */
     gboolean first_pass;
 
+    /** true if we have setup the quickfills */
+    gboolean quickfill_setup;
+
     /** true if the user has already confirmed changes of a reconciled
      * split */
     gboolean change_confirmed;
diff --git a/gnucash/register/ledger-core/split-register-util.c b/gnucash/register/ledger-core/split-register-util.c
index 98cc4763c5..4e5afb8b83 100644
--- a/gnucash/register/ledger-core/split-register-util.c
+++ b/gnucash/register/ledger-core/split-register-util.c
@@ -55,6 +55,7 @@ gnc_split_register_init_info (SplitRegister *reg)
     info->last_date_entered = gnc_time64_get_today_start ();
 
     info->first_pass = TRUE;
+    info->quickfill_setup = FALSE;
     info->full_refresh = TRUE;
     info->separator_changed = TRUE;
 



Summary of changes:
 gnucash/register/ledger-core/split-register-load.c | 11 +++++----
 gnucash/register/ledger-core/split-register-p.h    |  3 +++
 gnucash/register/ledger-core/split-register-util.c |  1 +
 gnucash/register/register-gnome/combocell-gnome.c  | 25 +++++++--------------
 .../register/register-gnome/completioncell-gnome.c | 26 +++++++++-------------
 .../register/register-gnome/gnucash-item-edit.c    | 11 +++++----
 .../register/register-gnome/gnucash-item-edit.h    |  1 +
 .../register/register-gnome/gnucash-item-list.c    | 22 +++++++++++++++++-
 .../register/register-gnome/gnucash-item-list.h    |  2 +-
 9 files changed, 59 insertions(+), 43 deletions(-)



More information about the gnucash-changes mailing list