GNOME Bugzilla – Bug 550485
Proposal: gtk_action_group_remove_all_actions()
Last modified: 2013-11-10 18:19:14 UTC
Sometimes menus have to be built and rebuilt on the fly, such as for spelling suggestions. When using actions to implement this, I like to define a special action group for the menu's actions. Then the next time I have to rebuild the menu, I can just indiscriminately blow away the all old actions in the action group before building new ones. The blowing away part is a bit cumbersome. Currently you have to remove actions one at a time: list = gtk_action_group_list_actions (action_group); while (iter = list; iter != NULL; iter = iter->next) gtk_action_group_remove_action (action_group, iter->data); g_list_free (list); A "remove_all" function for action groups would be a nice convenience: gtk_action_group_remove_all_actions (action_group);
Created attachment 117853 [details] [review] Proposed patch
Where I need to do that e.g. in epiphany etc, I just remove the action group from the UI manager and then create a new one and insert it. Does that not work here for some reason?
That would work too, but it's less desirable to destroy the container along with the contents. Especially if you've customized the previous action group's visibility or sensitivity settings, translation domain, signal handlers, etc.
given that GtkActionGroup is on the way out, I'll close this.