gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Tue Mar 23 06:27:40 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/2be07b3e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/48698395 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/03fa0ed6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8b79002a (commit)
	from  https://github.com/Gnucash/gnucash/commit/27435b10 (commit)



commit 2be07b3e1c813769a3eb3ec308121ea22311e960
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Mar 23 10:25:03 2021 +0000

    Make the chart on the report page icon larger to align better with the account page icon.

diff --git a/data/pixmaps/hicolor/16x16/actions/gnc-account-report.png b/data/pixmaps/hicolor/16x16/actions/gnc-account-report.png
index 5ef812d73..8de169552 100644
Binary files a/data/pixmaps/hicolor/16x16/actions/gnc-account-report.png and b/data/pixmaps/hicolor/16x16/actions/gnc-account-report.png differ

commit 48698395e223fa9d157e8f961a29e91876946f87
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Mar 23 10:09:25 2021 +0000

    Bug 797621 - Sometimes freeze on Invoice Sales Tax Table
    
    If there are no entries in the list, the return height of
    popup_get_height was 0 but when a confirmation check is made on true
    height it returned 1 and so try and queue a resize and hence a loop so
    in popup_get_height return 1 if list is empty.
    
    Also to prevent this from happening entirely, disable the toggle button
    when there are no entries in the list. The entry will still be active
    so new list entries can be created as before.

diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 27fd7c799..e169416c4 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -916,7 +916,9 @@ popup_get_height (G_GNUC_UNUSED GtkWidget* widget,
     {
         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
                                         GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
-        return height;
+        // if the list is empty height would be 0 so return 1 instead to
+        // satisfy the check_popup_height_is_true function
+        return height ? height : 1;
     }
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
                                     GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -973,6 +975,7 @@ gnc_combo_cell_enter (BasicCell* bcell,
 {
     ComboCell* cell = (ComboCell*) bcell;
     PopBox* box = bcell->gui_private;
+    PopupToggle popup_toggle;
     GList* find = NULL;
 
     if (bcell->value)
@@ -999,6 +1002,12 @@ gnc_combo_cell_enter (BasicCell* bcell,
     gnc_item_list_select (box->item_list, bcell->value);
     unblock_list_signals (cell);
 
+    popup_toggle = box->item_edit->popup_toggle;
+
+    // if the list is empty disable the toggle button
+    gtk_widget_set_sensitive (GTK_WIDGET(popup_toggle.tbutton),
+                              gnc_item_list_num_entries (box->item_list));
+
     combo_connect_signals (cell);
 
     *cursor_position = -1;

commit 03fa0ed611b9a4da315a3eb2bbd579aa8b080a54
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Mar 23 09:59:32 2021 +0000

    Allow the context menu when GncCellRendererTextView is in edit mode.

diff --git a/gnucash/gnome-utils/gnc-cell-renderer-text-view.c b/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
index 367e2ad9a..ad1d48dc1 100644
--- a/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
+++ b/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
@@ -71,13 +71,20 @@ gcrtv_editing_done (GtkCellEditable         *editable,
     gchar       *path;
     const gchar *new_text;
 
-    if (GNC_CELL_VIEW (editable)->focus_out_id > 0)
+    if (GNC_CELL_VIEW(editable)->focus_out_id > 0)
     {
         g_signal_handler_disconnect (GNC_CELL_VIEW(editable)->text_view,
                                      GNC_CELL_VIEW(editable)->focus_out_id);
         GNC_CELL_VIEW(editable)->focus_out_id = 0;
     }
 
+    if (GNC_CELL_VIEW(editable)->populate_popup_id > 0)
+    {
+        g_signal_handler_disconnect (GNC_CELL_VIEW(editable)->text_view,
+                                     GNC_CELL_VIEW(editable)->populate_popup_id);
+        GNC_CELL_VIEW(editable)->populate_popup_id = 0;
+    }
+
     if (GNC_CELL_VIEW(editable)->editing_canceled)
     {
         gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER(cell_tv), TRUE);
@@ -120,9 +127,8 @@ gcrtv_start_editing (GtkCellRenderer      *cell,
     g_object_get (G_OBJECT(cell_tv), "editable", &iseditable, NULL);
 
     /* If the cell isn't editable we return NULL. */
-    if (iseditable == FALSE) {
+    if (iseditable == FALSE)
         return NULL;
-    }
 
     editable = g_object_new (GNC_TYPE_CELL_VIEW, NULL);
 
diff --git a/gnucash/gnome-utils/gnc-cell-view.c b/gnucash/gnome-utils/gnc-cell-view.c
index 2a94e5a14..2a68dad32 100644
--- a/gnucash/gnome-utils/gnc-cell-view.c
+++ b/gnucash/gnome-utils/gnc-cell-view.c
@@ -81,6 +81,7 @@ gnc_cell_view_init (GncCellView *cv)
     gtk_widget_show (cv->text_view);
 
     cv->focus_out_id = 0;
+    cv->populate_popup_id = 0;
     cv->tooltip_id = 0;
 
     gtk_widget_set_can_focus (GTK_WIDGET(cv->text_view), TRUE);
@@ -167,9 +168,28 @@ gtk_cell_editable_key_press_event (GtkTextView   *text_view,
     return FALSE;
 }
 
+static void
+gcv_popup_unmap (GtkMenu *menu, GncCellView *cv)
+{
+  cv->in_popup_menu = FALSE;
+}
+
+static void
+gcv_populate_popup (GtkTextView *text_view,
+                    GtkWidget   *popup,
+                    GncCellView *cv)
+{
+    cv->in_popup_menu = TRUE;
+    g_signal_connect (popup, "unmap",
+                      G_CALLBACK (gcv_popup_unmap), cv);
+}
+
 static gboolean
 gcv_focus_out_event (GtkWidget *widget, GdkEvent *event, GncCellView *cv)
 {
+    if (cv->in_popup_menu)
+        return FALSE;
+
     cv->editing_canceled = TRUE;
 
     if (cv->focus_out_id > 0)
@@ -177,6 +197,11 @@ gcv_focus_out_event (GtkWidget *widget, GdkEvent *event, GncCellView *cv)
         g_signal_handler_disconnect (cv->text_view, cv->focus_out_id);
         cv->focus_out_id = 0;
     }
+    if (cv->populate_popup_id > 0)
+    {
+        g_signal_handler_disconnect (cv->text_view, cv->populate_popup_id);
+        cv->populate_popup_id = 0;
+    }
     gtk_cell_editable_editing_done (GTK_CELL_EDITABLE(cv));
     gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(cv));
 
@@ -217,6 +242,11 @@ gcv_start_editing (GtkCellEditable *cell_editable,
     cv->focus_out_id = g_signal_connect (G_OBJECT(cv->text_view),
                                          "focus-out-event",
                                          G_CALLBACK(gcv_focus_out_event), cv);
+
+    cv->populate_popup_id = g_signal_connect (G_OBJECT(cv->text_view),
+                                              "populate-popup",
+                                              G_CALLBACK(gcv_populate_popup),
+                                              cv);
 }
 
 static void
diff --git a/gnucash/gnome-utils/gnc-cell-view.h b/gnucash/gnome-utils/gnc-cell-view.h
index 6fb7a3f1d..601e4cc71 100644
--- a/gnucash/gnome-utils/gnc-cell-view.h
+++ b/gnucash/gnome-utils/gnc-cell-view.h
@@ -43,7 +43,9 @@ struct _GncCellView
     GtkTextBuffer *buffer;
 
     gulong         focus_out_id;
+    gulong         populate_popup_id;
     guint          tooltip_id;
+    gboolean       in_popup_menu;
     gboolean       editing_canceled;
 };
 

commit 8b79002a758b74b9a336dce6e3eb721d09fafb45
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Mar 23 09:59:09 2021 +0000

    Bug 798147 - Accounts Page Notes entry crash
    
    There were a couple of places that a value was being used after it had
    been freed so they were fixed.

diff --git a/gnucash/gnome-utils/gnc-cell-renderer-text-view.c b/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
index 445848417..367e2ad9a 100644
--- a/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
+++ b/gnucash/gnome-utils/gnc-cell-renderer-text-view.c
@@ -89,6 +89,8 @@ gcrtv_editing_done (GtkCellEditable         *editable,
 
     new_text = gnc_cell_view_get_text (GNC_CELL_VIEW(editable));
 
+    gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(editable));
+
     g_signal_emit_by_name (cell_tv, "edited", path, new_text);
 }
 
diff --git a/gnucash/gnome-utils/gnc-cell-view.c b/gnucash/gnome-utils/gnc-cell-view.c
index bf82389e5..2a94e5a14 100644
--- a/gnucash/gnome-utils/gnc-cell-view.c
+++ b/gnucash/gnome-utils/gnc-cell-view.c
@@ -53,9 +53,14 @@ G_DEFINE_TYPE_WITH_CODE (GncCellView, gnc_cell_view, GTK_TYPE_EVENT_BOX,
                          gnc_cell_view_editable_init))
 
 static void
-gnc_cell_view_finalize (GObject *gobject)
+gnc_cell_view_dispose (GObject *gobject)
 {
-    G_OBJECT_CLASS (gnc_cell_view_parent_class)->finalize (gobject);
+    if (GNC_CELL_VIEW(gobject)->tooltip_id > 0)
+    {
+        g_source_remove (GNC_CELL_VIEW(gobject)->tooltip_id);
+        GNC_CELL_VIEW(gobject)->tooltip_id = 0;
+    }
+    G_OBJECT_CLASS (gnc_cell_view_parent_class)->dispose (gobject);
 }
 
 static void
@@ -75,6 +80,9 @@ gnc_cell_view_init (GncCellView *cv)
     gtk_container_add (GTK_CONTAINER(cv), GTK_WIDGET(cv->text_view));
     gtk_widget_show (cv->text_view);
 
+    cv->focus_out_id = 0;
+    cv->tooltip_id = 0;
+
     gtk_widget_set_can_focus (GTK_WIDGET(cv->text_view), TRUE);
     gtk_widget_add_events (GTK_WIDGET(cv), GDK_KEY_PRESS_MASK);
     gtk_widget_add_events (GTK_WIDGET(cv), GDK_KEY_RELEASE_MASK);
@@ -86,7 +94,7 @@ gnc_cell_view_class_init (GncCellViewClass *klass)
     GObjectClass  *gobject_class = G_OBJECT_CLASS(klass);
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
 
-    gobject_class->finalize = gnc_cell_view_finalize;
+    gobject_class->dispose = gnc_cell_view_dispose;
 
     gobject_class->set_property = gnc_cell_view_set_property;
     gobject_class->get_property = gnc_cell_view_get_property;
@@ -144,11 +152,9 @@ gtk_cell_editable_key_press_event (GtkTextView   *text_view,
     if (key_event->keyval == GDK_KEY_Escape)
     {
         cv->editing_canceled = TRUE;
-        gtk_cell_editable_editing_done (GTK_CELL_EDITABLE(cv));
-
-        if (GTK_IS_CELL_EDITABLE(cv))
-            gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(cv));
 
+        gtk_cell_editable_editing_done (GTK_CELL_EDITABLE(cv));
+        gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(cv));
         return TRUE;
     }
 
@@ -156,10 +162,6 @@ gtk_cell_editable_key_press_event (GtkTextView   *text_view,
          && (key_event->state & GDK_SHIFT_MASK))
     {
         gtk_cell_editable_editing_done (GTK_CELL_EDITABLE(cv));
-
-        if (GTK_IS_CELL_EDITABLE(cv))
-            gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(cv));
-
         return TRUE;
     }
     return FALSE;
@@ -184,8 +186,11 @@ gcv_focus_out_event (GtkWidget *widget, GdkEvent *event, GncCellView *cv)
 static gboolean
 gcv_remove_tooltip (GncCellView *cv)
 {
-    if (GTK_IS_WIDGET(cv->text_view))
+    if (cv->tooltip_id > 0)
+    {
         gtk_widget_set_tooltip_text (GTK_WIDGET(cv->text_view), NULL);
+        cv->tooltip_id = 0;
+    }
     return FALSE;
 }
 
@@ -196,8 +201,8 @@ gcv_start_editing (GtkCellEditable *cell_editable,
     GncCellView *cv = GNC_CELL_VIEW(cell_editable);
     GtkTextIter siter, eiter;
 
-    // Remove the text_view tooltip after 5secs
-    g_timeout_add (5000, (GSourceFunc) gcv_remove_tooltip, cv);
+    // Remove the text_view tooltip after 5secs to stop it recuring
+    cv->tooltip_id = g_timeout_add (5000, (GSourceFunc) gcv_remove_tooltip, cv);
 
     gtk_text_buffer_get_bounds (cv->buffer, &siter, &eiter);
     gtk_text_buffer_select_range (cv->buffer, &eiter, &siter);
diff --git a/gnucash/gnome-utils/gnc-cell-view.h b/gnucash/gnome-utils/gnc-cell-view.h
index 7f76da6ac..6fb7a3f1d 100644
--- a/gnucash/gnome-utils/gnc-cell-view.h
+++ b/gnucash/gnome-utils/gnc-cell-view.h
@@ -43,6 +43,7 @@ struct _GncCellView
     GtkTextBuffer *buffer;
 
     gulong         focus_out_id;
+    guint          tooltip_id;
     gboolean       editing_canceled;
 };
 



Summary of changes:
 .../hicolor/16x16/actions/gnc-account-report.png   | Bin 417 -> 333 bytes
 gnucash/gnome-utils/gnc-cell-renderer-text-view.c  |  14 ++++-
 gnucash/gnome-utils/gnc-cell-view.c                |  63 ++++++++++++++++-----
 gnucash/gnome-utils/gnc-cell-view.h                |   3 +
 gnucash/register/register-gnome/combocell-gnome.c  |  11 +++-
 5 files changed, 73 insertions(+), 18 deletions(-)



More information about the gnucash-changes mailing list