GNOME Bugzilla – Bug 667973
Consider ready-made toggle and radio actions
Last modified: 2018-05-24 13:41:06 UTC
This probably belongs more to the glib side of things... As far as I can tell, creating toggle menu items or radio menus requires quite a bit of manual handling to get the state from the action variant etc. It would be nice to have a simpler way to do that, speaking with desrt on irc he mentioned ToggleAction and RadioAction. Even better he also mentioned a GSettingAction to allow a menu to directly map to a gsetting.
Moving this to GIO where it belongs.
we have the GSettings action we will soon have a GObject property action meanwhile, I think we should either provide stock 'activate' functions for simple actions that are intended to function as toggles/radios or modify the gactionmap 'add from entries' code to do this if the user gives NULL for those pointer types. in general, I'd like to avoid trying to introduce more places for there to be state. Stateful actions will obviously be tied to some mechanism or backing store and I think it would be a shame to duplicate the state from that. This is the approach that the GSettings action takes -- it keeps no state of its own. The one thing that's missing here, however, is an easy way to emit state change notifications for actions when something else causes them to change (like say, the fullscreen state of the window changes from external sources, remembering that this is not a GObject property).
*** Bug 688428 has been marked as a duplicate of this bug. ***
*** Bug 705655 has been marked as a duplicate of this bug. ***
In bug #705655 I listed some of the things that app developers need to understand and do to have toggle and radio menu items. It is not a convenient API.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/500.