gnucash maint: Fix gtk accelerator mixups by explicitly disabling actions that are not relevant

Geert Janssens gjanssens at
Mon Sep 24 11:15:20 EDT 2018

Updated	 via (commit)
	from (commit)

commit f89a40e3ebf7ffae2f59b352d5d2d2cbb00f1ab1
Author: Geert Janssens <geert at>
Date:   Mon Sep 24 17:15:11 2018 +0200

    Fix gtk accelerator mixups by explicitly disabling actions that are not relevant
    The issue I found was with File->Print and its variants for various page types.
    They all use the same '<primary>p' as global accelerator. It was possible to
    have gnucash invoke the 'Print Report...' action instead of the 'Print Invoice...'
    action when hitting <primary>p on an invoice page. If no report page was
    open at this point, gnucash would crash. If a report was open, gnucash
    would invoke the print action on that report instead of opening an
    invoice report for the invoice. This looks like a bug internally in
    the gtkaction handling or our improper use of it. However I could
    work around it by disabling action groups before unmerging them.

diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index b29e1a2..76d8ebb 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -287,6 +287,7 @@ gnc_plugin_page_merge_actions (GncPluginPage *page,
     priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
     priv->ui_merge = ui_merge;
+    gtk_action_group_set_sensitive (priv->action_group, TRUE);
     priv->merge_id = gnc_plugin_add_actions(priv->ui_merge,
@@ -307,6 +308,7 @@ gnc_plugin_page_unmerge_actions (GncPluginPage *page,
     g_return_if_fail (priv->action_group != NULL);
     gtk_ui_manager_remove_ui(ui_merge, priv->merge_id);
+    gtk_action_group_set_sensitive (priv->action_group, FALSE);
     gtk_ui_manager_remove_action_group(ui_merge, priv->action_group);
     priv->ui_merge = NULL;

Summary of changes:
 gnucash/gnome-utils/gnc-plugin-page.c | 2 ++
 1 file changed, 2 insertions(+)

More information about the gnucash-changes mailing list