From 239820c5a6bfb917b206a35517981b98e8f5d27a Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Fri, 28 Oct 2022 16:58:44 +0100 Subject: [PATCH] Fix the binding of the extra business items when gnucash started with --nofile --- gnucash/gnome-utils/gnc-main-window.cpp | 4 ++++ gnucash/gnome/gnc-plugin-business.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp index ff3cd126cd..9b754a1a1e 100644 --- a/gnucash/gnome-utils/gnc-main-window.cpp +++ b/gnucash/gnome-utils/gnc-main-window.cpp @@ -4113,6 +4113,10 @@ main_window_realize_cb (GtkWidget *widget, gpointer user_data) GncMainWindowPrivate *priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); gnc_add_accelerator_keys_for_menu (GTK_WIDGET(priv->menubar), priv->accel_group); + + /* need to signal menu has been changed, this will call the + business function 'bind_extra_toolbuttons_visibility' */ + g_signal_emit_by_name (window, "menu_changed", nullptr); } static void diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c index a71e87e01f..dbaae7f947 100644 --- a/gnucash/gnome/gnc-plugin-business.c +++ b/gnucash/gnome/gnc-plugin-business.c @@ -840,9 +840,11 @@ gnc_plugin_business_main_window_menu_changed (GncMainWindow *window, GncPluginPage *page, gpointer user_data) { + // page could be NULL when gnucash started with --nofile if (page == gnc_main_window_get_current_page (window)) { - gnc_plugin_business_main_window_page_changed (window, page, user_data); + if (page) + gnc_plugin_business_main_window_page_changed (window, page, user_data); bind_extra_toolbuttons_visibility (window); } }