Delete action on account page not disabled on edits

When the notes or description cells are edited, the toolbar delete
account action was not being disabled and so when you tried to deleted
some text the account was deleted instead.

Fixed by specifying correct action group and using it.
pull/1537/head
Robert Fewell 3 years ago
parent a84f191ed8
commit b59bf0b633

@ -3526,8 +3526,9 @@ gnc_main_window_find_action_in_group (GncMainWindow *window,
g_return_val_if_fail (action_name != nullptr, nullptr);
auto action_group = gtk_widget_get_action_group (GTK_WIDGET(window), group_name);
if (action_group)
action = g_action_map_lookup_action (G_ACTION_MAP(window), action_name);
action = g_action_map_lookup_action (G_ACTION_MAP(action_group), action_name);
return action;
}

@ -598,9 +598,9 @@ static void
gnc_plugin_page_account_editing_started_cd (gpointer various, GncPluginPageRegister *page)
{
GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(page);
GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(plugin_page->window),
"EditDeleteAccountAction");
GAction *action = gnc_main_window_find_action_in_group (GNC_MAIN_WINDOW(plugin_page->window),
"GncPluginPageAccountTreeActions",
"EditDeleteAccountAction");
if (action != NULL)
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
}
@ -609,9 +609,9 @@ static void
gnc_plugin_page_account_editing_finished_cb (gpointer various, GncPluginPageRegister *page)
{
GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(page);
GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(plugin_page->window),
"EditDeleteAccountAction");
GAction *action = gnc_main_window_find_action_in_group (GNC_MAIN_WINDOW(plugin_page->window),
"GncPluginPageAccountTreeActions",
"EditDeleteAccountAction");
if (action != NULL)
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
}

Loading…
Cancel
Save