gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun May 24 14:27:12 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/608e700a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fafb3ef3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5f3ff8b6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/22cd3d72 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4da11b10 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b7d31878 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/15029518 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3036b726 (commit)



commit 608e700a2481c1cae6ebf13be2d9c45699c66e66
Merge: 3036b7265 fafb3ef3a
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun May 24 11:22:43 2020 -0700

    Merge Bob Fewell's 'gnc-edit-changes' into master.


commit fafb3ef3a880f6bcf285d13a50f9a28116b95eb8
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 10:51:51 2020 +0100

    Drop gnucash-scrolled-window.c in POTFILES.in as it has
     been removed.

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1de9b3532..6041f220f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -391,7 +391,6 @@ gnucash/register/register-gnome/gnucash-header.c
 gnucash/register/register-gnome/gnucash-item-edit.c
 gnucash/register/register-gnome/gnucash-item-list.c
 gnucash/register/register-gnome/gnucash-register.c
-gnucash/register/register-gnome/gnucash-scrolled-window.c
 gnucash/register/register-gnome/gnucash-sheet.c
 gnucash/register/register-gnome/gnucash-sheet-private.c
 gnucash/register/register-gnome/gnucash-style.c

commit 5f3ff8b65208f32aabce8e5f309fccbd43cf1fde
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 10:50:24 2020 +0100

    Remove extra vbox in gnc_item_edit.c
    
    The button is no longer required to be placed in an extra vortical box
    as the required Gtk+ version is 3.22.30

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 229403d06..a51e51110 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -848,7 +848,6 @@ gnc_item_edit_new (GnucashSheet *sheet)
     GtkBorder padding;
     GtkBorder margin;
     GtkBorder border;
-    GtkWidget *vb = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     GncItemEdit *item_edit =
             g_object_new (GNC_TYPE_ITEM_EDIT,
                           "sheet", sheet,
@@ -904,12 +903,7 @@ gnc_item_edit_new (GnucashSheet *sheet)
     gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.ebox),
                       item_edit->popup_toggle.tbutton);
 
-    /* The button needs to be packed into a vertical box so that the height and position
-     * can be controlled in earlier than Gtk3.20 versions */
-    gtk_box_pack_start (GTK_BOX(vb), item_edit->popup_toggle.ebox,
-                        FALSE, FALSE, 0);
-
-    gtk_box_pack_start (GTK_BOX(item_edit), vb, FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX(item_edit), item_edit->popup_toggle.ebox, FALSE, FALSE, 0);
     gtk_widget_show_all(GTK_WIDGET(item_edit));
     g_signal_connect(G_OBJECT(item_edit), "destroy",
                      G_CALLBACK(gnc_item_edit_destroying), NULL);

commit 22cd3d72965ebd9ea6655c3af37e9cc0b2d0aeae
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 18:17:01 2020 +0100

    Change the way the sheet popup treeview height is obtained.
    
    Instead of using the sheet row height as the basis of obtaining the
    popup height use the treeview cellrenderer height instead. This has the
    advantage that any CSS font change applied to the treeview will be used
    to get the correct height.

diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 11c4170e0..6b8223a5d 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -904,7 +904,8 @@ popup_get_height (G_GNUC_UNUSED GtkWidget* widget,
     int count, height;
 
     count = gnc_item_list_num_entries (box->item_list);
-    height = count * row_height;
+    height = count * (gnc_item_list_get_cell_height (box->item_list) + 2);
+
     if (height < space_available)
     {
         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
diff --git a/gnucash/register/register-gnome/gnucash-date-picker.c b/gnucash/register/register-gnome/gnucash-date-picker.c
index 6950e01f0..2af2b84aa 100644
--- a/gnucash/register/register-gnome/gnucash-date-picker.c
+++ b/gnucash/register/register-gnome/gnucash-date-picker.c
@@ -125,6 +125,8 @@ gnc_date_picker_class_init (GNCDatePickerClass *date_picker_class)
 
     object_class = G_OBJECT_CLASS (date_picker_class);
 
+    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(date_picker_class), "gnc-id-date-picker");
+
     gnc_date_picker_signals[DATE_SELECTED] =
         g_signal_new("date_selected",
                      G_TYPE_FROM_CLASS(object_class),
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index dfd40c691..229403d06 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -1015,7 +1015,10 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
     // Lets check popup height is the true height
     item_edit->popup_returned_height = popup_h;
 
-    gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
+    if (popup_h == popup_max_height)
+        gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
+    else
+        gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, -1);
 
     toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
 
@@ -1084,6 +1087,7 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
     gtk_widget_grab_focus (GTK_WIDGET (item_edit->sheet));
 }
 
+
 void
 gnc_item_edit_set_popup (GncItemEdit    *item_edit,
                          GtkWidget      *popup_item,
diff --git a/gnucash/register/register-gnome/gnucash-item-list.c b/gnucash/register/register-gnome/gnucash-item-list.c
index 667e0103f..50d4d2ec0 100644
--- a/gnucash/register/register-gnome/gnucash-item-list.c
+++ b/gnucash/register/register-gnome/gnucash-item-list.c
@@ -283,6 +283,7 @@ gnc_item_list_init (GncItemList* item_list)
     item_list->tree_view = NULL;
     item_list->list_store = NULL;
     item_list->temp_store = NULL;
+    item_list->cell_height = 0;
 }
 
 
@@ -385,6 +386,7 @@ gnc_item_list_class_init (GncItemListClass* item_list_class)
 
     gnc_item_list_parent_class = g_type_class_peek_parent (item_list_class);
 
+    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(item_list_class), "gnc-id-sheet-list");
 
     gnc_item_list_signals[SELECT_ITEM] =
         g_signal_new ("select_item",
@@ -474,11 +476,25 @@ tree_view_selection_changed (GtkTreeSelection* selection,
     g_free (string);
 }
 
+
+gint
+gnc_item_list_get_cell_height (GncItemList *item_list)
+{
+
+   gint min_height, nat_height;
+   gtk_cell_renderer_get_preferred_height (item_list->renderer,
+                                           GTK_WIDGET(item_list->tree_view),
+                                           &min_height,
+                                           &nat_height);
+
+    return min_height;
+}
+
+
 GtkWidget*
 gnc_item_list_new (GtkListStore* list_store)
 {
     GtkWidget* tree_view;
-    GtkCellRenderer* renderer;
     GtkTreeViewColumn* column;
 
     GncItemList* item_list =
@@ -508,9 +524,9 @@ gnc_item_list_new (GtkListStore* list_store)
     gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
                                           0, GTK_SORT_ASCENDING);
 
-    renderer = gtk_cell_renderer_text_new();
+    item_list->renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes (_ ("List"),
-                                                       renderer,
+                                                       item_list->renderer,
                                                        "text", 0,
                                                        NULL);
     gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
@@ -526,11 +542,9 @@ gnc_item_list_new (GtkListStore* list_store)
     g_signal_connect (G_OBJECT (tree_view), "key_press_event",
                       G_CALLBACK (gnc_item_list_key_event), item_list);
 
-    g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (
-            tree_view))), "changed",
+    g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (
+                                GTK_TREE_VIEW (tree_view))), "changed",
                       G_CALLBACK (tree_view_selection_changed), item_list);
 
     return GTK_WIDGET (item_list);
 }
-
-
diff --git a/gnucash/register/register-gnome/gnucash-item-list.h b/gnucash/register/register-gnome/gnucash-item-list.h
index c5e75f859..31ab1eaf3 100644
--- a/gnucash/register/register-gnome/gnucash-item-list.h
+++ b/gnucash/register/register-gnome/gnucash-item-list.h
@@ -45,6 +45,8 @@ typedef struct
     GtkScrolledWindow* scrollwin;
     GtkListStore *list_store; /* Contains the list items */
     GtkListStore *temp_store; /* Temporary store for typeahead select */
+    GtkCellRenderer *renderer;
+    gint cell_height;
 } GncItemList;
 
 typedef struct
@@ -69,6 +71,8 @@ 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);
+
 void gnc_item_list_clear (GncItemList *item_list);
 
 void gnc_item_list_append (GncItemList *item_list, const char *string);

commit 4da11b10e5a217cee3a080e723b9003d8c3ec544
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 18:11:01 2020 +0100

    Move setting up of the sheet popup size-allocate callback
    
    As the popup_item is cell dependant, the popup size-allocate check
    callback needs to be setup when entering a cell and removed when
    leaving so move this to the gnc_item_edit_set_popup function.

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index f6769c903..dfd40c691 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -1014,11 +1014,6 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
 
     // Lets check popup height is the true height
     item_edit->popup_returned_height = popup_h;
-    if (!item_edit->popup_height_signal_id)
-        item_edit->popup_height_signal_id =
-    g_signal_connect_after (item_edit->popup_item, "size-allocate",
-                                    G_CALLBACK(check_popup_height_is_true),
-                                    item_edit);
 
     gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
 
@@ -1104,6 +1099,24 @@ gnc_item_edit_set_popup (GncItemEdit    *item_edit,
     if (item_edit->is_popup)
         gnc_item_edit_hide_popup (item_edit);
 
+    /* setup size-allocate callback for popup_item height, done here as
+       item_edit is constant and popup_item changes per cell */
+    if (popup_item)
+    {
+        item_edit->popup_height_signal_id = g_signal_connect_after (
+                                            popup_item, "size-allocate",
+                                            G_CALLBACK(check_popup_height_is_true),
+                                            item_edit);
+    }
+    else
+    {
+        if (GNC_ITEM_EDIT (item_edit)->popup_height_signal_id > 0)
+        {
+            g_signal_handler_disconnect (item_edit->popup_item, item_edit->popup_height_signal_id);
+            item_edit->popup_height_signal_id = 0;
+        }
+    }
+
     item_edit->is_popup = popup_item != NULL;
 
     item_edit->popup_item       = popup_item;

commit b7d31878e8670cd3a384d8042e43b1b978ec9472
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 10:49:22 2020 +0100

    Error for g_signal_handler_disconnect in trace file
    
    When item_edit is destroyed it tries to remove a signal handler based
    on the saved id for the size-allocate signal for popups. If there have
    been no popup used this id value is 0 so to prevent this error check
    for id number greater than 0 before being used.

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index ffdb41978..f6769c903 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -61,7 +61,7 @@ enum
 static GtkBoxClass *gnc_item_edit_parent_class;
 
 static GtkToggleButtonClass *gnc_item_edit_tb_parent_class;
-static void gnc_item_edit_destroying(GtkWidget *this, gpointer data);
+static void gnc_item_edit_destroying (GtkWidget *this, gpointer data);
 static void
 gnc_item_edit_tb_init (GncItemEditTb *item_edit_tb)
 {
@@ -917,10 +917,12 @@ gnc_item_edit_new (GnucashSheet *sheet)
 }
 
 static void
-gnc_item_edit_destroying(GtkWidget *item_edit, gpointer data)
+gnc_item_edit_destroying (GtkWidget *item_edit, gpointer data)
 {
-    g_signal_handler_disconnect (GNC_ITEM_EDIT (item_edit)->popup_item,
-                                 GNC_ITEM_EDIT (item_edit)->popup_height_signal_id);
+    if (GNC_ITEM_EDIT (item_edit)->popup_height_signal_id > 0)
+        g_signal_handler_disconnect (GNC_ITEM_EDIT (item_edit)->popup_item,
+                                     GNC_ITEM_EDIT (item_edit)->popup_height_signal_id);
+
     while (g_idle_remove_by_data((gpointer)item_edit))
         continue;
 }

commit 1502951801b14b3acf73f1ba0d18b44f9b7cf110
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri May 22 10:48:37 2020 +0100

    Fix combocell when using action field
    
    When using type-ahead, it clears the tmp_store in gnc_combo_cell_enter
    so clearing the action list. Change this to only clear the tmp_store
    when using quickfill or type-ahead.

diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index bf8a6bb40..11c4170e0 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -641,7 +641,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
         *cursor_position += change_chars;
         box_str = match_str;
     }
-    else
+    else if (cell->shared_store)
     {
         // No start-of-name match, try type-ahead search, we match any substring of the full account name.
         GtkListStore *store = cell->shared_store;
@@ -655,7 +655,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
 
     if (match_str == NULL)
     {
-        if (gnc_item_list_using_temp (box->item_list))
+        if (cell->shared_store && gnc_item_list_using_temp (box->item_list))
         {
             block_list_signals (cell); //Prevent recursion
             gnc_item_list_set_temp_store (box->item_list, NULL);
@@ -666,6 +666,8 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
         block_list_signals (cell);
         gnc_item_list_select (box->item_list, NULL);
         unblock_list_signals (cell);
+        *cursor_position = *start_selection = newval_chars;
+        *end_selection = -1;
         return;
     }
 
@@ -980,9 +982,13 @@ gnc_combo_cell_enter (BasicCell* bcell,
                              popup_get_width, box);
 
     block_list_signals (cell);
-    // Clear the temp store to ensure we don't start in type-ahead mode.
-    gnc_item_list_set_temp_store (box->item_list, NULL);
-    gtk_list_store_clear (box->tmp_store);
+
+    if (cell->shared_store && gnc_item_list_using_temp (box->item_list))
+    {
+        // Clear the temp store to ensure we don't start in type-ahead mode.
+        gnc_item_list_set_temp_store (box->item_list, NULL);
+        gtk_list_store_clear (box->tmp_store);
+    }
     gnc_item_list_select (box->item_list, bcell->value);
     unblock_list_signals (cell);
 



Summary of changes:
 gnucash/register/register-gnome/combocell-gnome.c  | 19 ++++++---
 .../register/register-gnome/gnucash-date-picker.c  |  2 +
 .../register/register-gnome/gnucash-item-edit.c    | 47 ++++++++++++++--------
 .../register/register-gnome/gnucash-item-list.c    | 28 +++++++++----
 .../register/register-gnome/gnucash-item-list.h    |  4 ++
 po/POTFILES.in                                     |  1 -
 6 files changed, 70 insertions(+), 31 deletions(-)



More information about the gnucash-changes mailing list