After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 550485 - Proposal: gtk_action_group_remove_all_actions()
Proposal: gtk_action_group_remove_all_actions()
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.13.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-09-02 15:12 UTC by Matthew Barnes
Modified: 2013-11-10 18:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.43 KB, patch)
2008-09-02 15:17 UTC, Matthew Barnes
none Details | Review

Description Matthew Barnes 2008-09-02 15:12:59 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);
Comment 1 Matthew Barnes 2008-09-02 15:17:13 UTC
Created attachment 117853 [details] [review]
Proposed patch
Comment 2 Christian Persch 2008-09-02 15:39:01 UTC
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?
Comment 3 Matthew Barnes 2008-09-02 15:54:09 UTC
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.
Comment 4 Matthias Clasen 2013-11-10 18:19:14 UTC
given that GtkActionGroup is on the way out, I'll close this.