gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Mon Oct 5 08:04:44 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/c587504c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f685a32d (commit)
	from  https://github.com/Gnucash/gnucash/commit/1c0530da (commit)



commit c587504c58fd7715c8da0fd558e907e6fefb3545
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Oct 5 13:00:38 2020 +0100

    Correction to fix for Business 'Open Linked Document' sensitivity

diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
index 5fd587168..c47cde0db 100644
--- a/gnucash/gnome/gnc-plugin-page-invoice.c
+++ b/gnucash/gnome/gnc-plugin-page-invoice.c
@@ -1360,23 +1360,29 @@ gnc_plugin_page_invoice_cmd_link (GtkAction *action,
 
     ret_uri = gnc_doclink_get_uri_dialog (parent, _("Manage Document Link"), uri);
 
+    if (ret_uri)
+        has_uri = TRUE;
+
     if (ret_uri && g_strcmp0 (uri, ret_uri) != 0)
     {
         GtkWidget *doclink_button =
             gnc_invoice_window_get_doclink_button (priv->iw);
 
-        if (doclink_button)
+        if (g_strcmp0 (ret_uri, "") == 0)
         {
-            if (g_strcmp0 (ret_uri, "") == 0)
+            has_uri = FALSE;
+            if (doclink_button)
                 gtk_widget_hide (GTK_WIDGET(doclink_button));
-            else
+        }
+        else
+        {
+            if (doclink_button)
             {
                 gchar *display_uri =
                     gnc_doclink_get_unescaped_just_uri (ret_uri);
                 gtk_link_button_set_uri (GTK_LINK_BUTTON(doclink_button),
                                          display_uri);
                 gtk_widget_show (GTK_WIDGET(doclink_button));
-                has_uri = TRUE;
                 g_free (display_uri);
             }
         }

commit f685a32d9a93eed3536fbeae799510918b99444e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Oct 5 12:46:14 2020 +0100

    Bug 797967 - Manage Document Link errors
    
    If there are no document links, the default dialog is for a file uri
    and if the escape key is pressed in this default state the following
    error is added to the trace file...
    ERROR <Gtk> gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT
    (widget, event)' failed
    
    This coming from the GtkFileChooserButton and to fix this add a signal
    callback for the dialog 'key_press_event' to intercept the escape key
    and emit a GTK_RESPONSE_CANCEL to close the dialog.

diff --git a/gnucash/gnome/dialog-doclink.c b/gnucash/gnome/dialog-doclink.c
index 3fbc2e166..50cfd62e7 100644
--- a/gnucash/gnome/dialog-doclink.c
+++ b/gnucash/gnome/dialog-doclink.c
@@ -229,6 +229,19 @@ setup_file_dialog (GtkBuilder *builder, GtkFileChooserButton *fcb,
     g_free (display_uri);
 }
 
+static gboolean
+gnc_doclink_get_uri_event_cb (GtkWidget *widget, GdkEventKey *event,
+                              gpointer user_data)
+{
+    if (event->keyval == GDK_KEY_Escape)
+    {
+        gtk_dialog_response (GTK_DIALOG(widget),
+                             GTK_RESPONSE_CANCEL);
+        return TRUE;
+     }
+     return FALSE;
+}
+
 gchar *
 gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
                             const gchar *uri)
@@ -258,6 +271,10 @@ gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
     gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-doclink");
     gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-doclink");
 
+    // Use this event to capture the escape key being pressed
+    g_signal_connect (dialog, "key_press_event",
+                      G_CALLBACK(gnc_doclink_get_uri_event_cb), dialog);
+
     head_label = GTK_WIDGET(gtk_builder_get_object (builder, "path_head_label"));
     ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
 



Summary of changes:
 gnucash/gnome/dialog-doclink.c          | 17 +++++++++++++++++
 gnucash/gnome/gnc-plugin-page-invoice.c | 14 ++++++++++----
 2 files changed, 27 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list