diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp index 34163a2d8c8..33f9a051928 100644 --- a/gnucash/gnome-utils/gnc-main-window.cpp +++ b/gnucash/gnome-utils/gnc-main-window.cpp @@ -3601,9 +3601,9 @@ gnc_main_window_menu_find_menu_item (GncMainWindow *window, const gchar *action_ void -gnc_main_window_menu_item_vis_by_action (GncMainWindow *window, - const gchar **action_names, - gboolean vis) +gnc_main_window_set_vis_of_items_by_action (GncMainWindow *window, + const gchar **action_names, + gboolean vis) { GncMainWindowPrivate *priv; @@ -3623,9 +3623,8 @@ gnc_main_window_menu_item_vis_by_action (GncMainWindow *window, gtk_widget_set_visible (menu_item, vis); } else - { - PINFO("Did not find menu_item with action name '%s' to set vis '%s'", action_names[i], vis ? "true" : "false"); - } + PINFO("Did not find menu_item with action name '%s' to set vis '%s'", + action_names[i], vis ? "true" : "false"); if (tool_item) { @@ -3634,9 +3633,8 @@ gnc_main_window_menu_item_vis_by_action (GncMainWindow *window, gtk_widget_set_visible (tool_item, vis); } else - { - PINFO("Did not find tool_item with action name '%s' to set vis '%s'\n", action_names[i], vis ? "true" : "false"); - } + PINFO("Did not find tool_item with action name '%s' to set vis '%s'", + action_names[i], vis ? "true" : "false"); } } @@ -4115,8 +4113,8 @@ gnc_main_window_setup_window (GncMainWindow *window) always_insensitive_actions, FALSE); - gnc_main_window_menu_item_vis_by_action (window, - always_hidden_actions, false); + gnc_main_window_set_vis_of_items_by_action (window, always_hidden_actions, + false); gtk_widget_insert_action_group (GTK_WIDGET(window), "mainwin", G_ACTION_GROUP(window)); diff --git a/gnucash/gnome-utils/gnc-main-window.h b/gnucash/gnome-utils/gnc-main-window.h index 167d8f752dc..50400197956 100644 --- a/gnucash/gnome-utils/gnc-main-window.h +++ b/gnucash/gnome-utils/gnc-main-window.h @@ -263,10 +263,20 @@ void gnc_main_window_merge_actions (GncMainWindow *window, void gnc_main_window_unmerge_actions (GncMainWindow *window, const gchar *group_name); - -void gnc_main_window_menu_item_vis_by_action (GncMainWindow *window, - const gchar **action_names, - gboolean vis); //FIXMEb added +/** Show or hide menu and toolbar items based on a NULL terminated + * list of action names + * + * @param window A pointer to the window whose user interface should + * be updated. + * + * @param action_names A NULL terminated list of actions names that + * should be modified. + * + * @param vis Whether to show or hide the widget items + */ +void gnc_main_window_set_vis_of_items_by_action (GncMainWindow *window, + const gchar **action_names, + gboolean vis); //FIXMEb added /** Find the menu item with the given action name for the window * specified. diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c index 9d5813b5f25..0a2c8c41dfe 100644 --- a/gnucash/gnome/gnc-plugin-page-register.c +++ b/gnucash/gnome/gnc-plugin-page-register.c @@ -910,10 +910,10 @@ gnc_plugin_page_register_ui_update (gpointer various, g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE); /* Set the vis of the StockAssistant */ - gnc_main_window_menu_item_vis_by_action (GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window), - actions_requiring_priced_account, - account && gnc_prefs_is_extra_enabled () && - xaccAccountIsPriced (account)); + gnc_main_window_set_vis_of_items_by_action (GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window), + actions_requiring_priced_account, + account && gnc_prefs_is_extra_enabled () && + xaccAccountIsPriced (account)); } /* If we are in a readonly book, or possibly a place holder diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c index 7469d101bd1..ab48cc86250 100644 --- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c +++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c @@ -333,17 +333,22 @@ gnc_plugin_ab_account_selected (GncPluginPage *plugin_page, Account *account, gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), need_account_actions, (account && bankcode && *bankcode && accountid && *accountid)); - gnc_main_window_menu_item_vis_by_action (window, need_account_actions, TRUE); + gnc_main_window_set_vis_of_items_by_action (window, need_account_actions, + TRUE); #if (AQBANKING_VERSION_INT < 60400) - gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), inactive_account_actions, FALSE); - gnc_main_window_menu_item_vis_by_action (window, inactive_account_actions, FALSE); + gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), + inactive_account_actions, FALSE); + gnc_main_window_set_vis_of_items_by_action (window, inactive_account_actions, + FALSE); #endif } else { - gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), need_account_actions, FALSE); - gnc_main_window_menu_item_vis_by_action (window, need_account_actions, FALSE); + gnc_plugin_set_actions_enabled (G_ACTION_MAP(simple_action_group), + need_account_actions, FALSE); + gnc_main_window_set_vis_of_items_by_action (window, need_account_actions, + FALSE); } } @@ -417,6 +422,7 @@ gnc_plugin_aqbanking_set_logwindow_visible (gboolean logwindow_visible) { GAction *action = gnc_main_window_find_action_in_group (gnc_main_window, PLUGIN_ACTIONS_NAME, MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW); + if (action) { GVariant *state = g_action_get_state (G_ACTION(action));