Skip to content

Commit

Permalink
Rename gnc_main_window_menu_item_vis_by_action
Browse files Browse the repository at this point in the history
Rename the main window function gnc_main_window_menu_item_vis_by_action
to gnc_main_window_set_vis_of_items_by_action as it deals with menu and
toolbar items.
  • Loading branch information
Bob-IT committed Nov 5, 2022
1 parent e00bcf5 commit 5c498a1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 24 deletions.
20 changes: 9 additions & 11 deletions gnucash/gnome-utils/gnc-main-window.cpp
Expand Up @@ -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;

Expand All @@ -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)
{
Expand All @@ -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");
}
}

Expand Down Expand Up @@ -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));
Expand Down
18 changes: 14 additions & 4 deletions gnucash/gnome-utils/gnc-main-window.h
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions gnucash/gnome/gnc-plugin-page-register.c
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions gnucash/import-export/aqb/gnc-plugin-aqbanking.c
Expand Up @@ -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);
}

}
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 5c498a1

Please sign in to comment.