GNOME Bugzilla – Bug 649804
AtkAction would be better with add/remove methods
Last modified: 2021-06-10 11:27:20 UTC
Right now AtkAction are targetted to implement it and define all the actions on that implementation. But this makes complex to implement things like this: a) Object A: defines X actions Object B (A subclass): define Y additional actions. Accessible object for Object B would required to redefine AtkAction and being sure that call his parent to get the proper number of actions and all the actions. b) Object A: defines X actions Object B (A subclass): redefines one action Object B would require to implement AtkAction, and probably reimplement all those X actions. So I propose to improve AtkAction by adding add/remove functions. And probably adding the registration stuff on AtkAction, so Object A and Object B would just require to be sure that add/remove the proper actions. Probably that would also good to create a "action dictionary" with some common-toolkit. This approach is used on Gail (gailcell) and on CallyActor: http://git.gnome.org/browse/clutter/tree/clutter/cally/cally-actor.h
ATK 2011 Hackfest Conclusion: * It doesn't solve any real problem, Alejandro Piñeiro just felt that would make code cleaner * People not sure if it is really worth at this moment, as it is more like a nitpick * In the case of cally that wouldn't require a lot of changes, but in the case of gail yes. * It is an ATK2 thing, so as it is a low priority thing, we can consider it later.
[Mass-reassigning open atk bug reports for better trackability as requested in https://bugzilla.gnome.org/show_bug.cgi?id=653179 . PLEASE NOTE: If you have watched the previous assignee of this bug report as a workaround for actually getting notified of changes in atk bugs, you yourself will now have to add atk-maint@gnome.bugs to your watchlist at the bottom of https://bugzilla.gnome.org/userprefs.cgi?tab=email to keep watching atk bug reports in GNOME Bugzilla. Sorry for the noise: Feel free to filter for this comment in order to mass-delete the triggered bugmail.]
ATK 2012 Hackfest additional conclusions: * It would be good to have a signal to emit if a action is added/removed * Bad idea to emit those during creation time * But this could be problematic with the fact that do_action is based on the index * Deprecate that method * Add a do_action_by_name method
Having an interface to add (and maybe remove) actions would be very useful for custom widgets like we use in Sugar [1]. To give a concrete example: Our "owner icon" (XO icon representing the user [2]) is derived from GtkEventBox and exposes a context menu ("Palette" in Sugar terms) on right-click or hover. This is a new action (probably "menu") that our subclass adds. GtkEventBox itself has no actions defined at all. With the current ATK API, we have to provide our own custom instance of AtkObject/AtkAction instead of just calling a single method like we do for names, descriptions, roles and relationships. [1] https://wiki.sugarlabs.org/go/What_is_Sugar%3F [2] https://wiki.sugarlabs.org/go/Human_Interface_Guidelines#Home
Forgot to mention: In Sugar, Palettes can be attached to many different widgets. With a setter method, we'd only need to add a single line of code to take care of all cases. With the current API, we will need custom AtkObject instances for all the different widgets that can have a Palette.
(In reply to comment #5) > Forgot to mention: In Sugar, Palettes can be attached to many different > widgets. With a setter method, we'd only need to add a single line of code to > take care of all cases. With the current API, we will need custom AtkObject > instances for all the different widgets that can have a Palette. This is a good point that I forgot to mention on the original description. Adding that _add/_remove API would allow to add actions per instance, instead of just per-class.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of atk, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a ticket at https://gitlab.gnome.org/GNOME/atk/-/issues/ Thank you for your understanding and your help.