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 688428 - Implement GAction subclasses for toggles and radios
Implement GAction subclasses for toggles and radios
Status: RESOLVED DUPLICATE of bug 667973
Product: glib
Classification: Platform
Component: gapplication
2.35.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-11-15 22:10 UTC by Cosimo Cecchi
Modified: 2013-05-24 02:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Cosimo Cecchi 2012-11-15 22:10:00 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
Comment 1 Allison Karlitskaya (desrt) 2012-11-15 22:14:15 UTC
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.
Comment 2 Matthias Clasen 2013-05-24 02:36:22 UTC

*** This bug has been marked as a duplicate of bug 667973 ***