GNOME Bugzilla – Bug 688428
Implement GAction subclasses for toggles and radios
Last modified: 2013-05-24 02:36:22 UTC
GtkAction has GtkToggleAction/GtkRadioAction subclasses for associating a boolean or enumerated state. Even if the design of GAction doesn't make this strictly necessary, I think GAction should have some subclasses for these cases too, which would make the API easier to use. Some ideas: - GToggleAction could implicitly have a boolean state and a boolean parameter linked together, to avoid the need to use an activation callback just to flip the state - GEnumeratedAction could do some enum magic to allow the use of e.g. "foo-action::enum-nick" as a detailed parameter, which would be automatically translated to the correct enum value
GToggleAction would most likely take no parameter and activation would toggle it. The enum magic would become quite magic... on one extreme I see something like: GEnumeratedaction *g_enumerated_action_new_for_enum (GType enum_type) which internally constructs a dynamic subtype of GEnumeratedAction corresponding to the given GType ('GEnumeratedAction+YourEnumType' or so) and adds a property to itself with the correct type. This would be a lovely synergyfest if mixed with g_settings_bind() support for enum-typed properties... On the more mundane end we could just have some generic int or something.
*** This bug has been marked as a duplicate of bug 667973 ***