Re: [g-a-devel] Adding an AtkObject attribute?



On 04/06/18 14:40, Samuel Thibault wrote:
Hello,

I am having a look at

https://github.com/mate-desktop/caja/issues/999

which is essentially about adding an AtkObject attribute to the
caja desktop window. Looking at how attributes are managed, atk
apparently just lets the implemtation provide a get_attributes()
method which does the real work. Apparently the caja desktop window
is just based on gtkwidget itself, whose get_attributes() method
(gtk_widget_accessible_get_attributes) just returns "toolkit"->"gtk"
with no way to add any attribute.

I'm wondering: can I perhaps just make caja_desktop_window_init replace
the accessible's get_attributes method with its own method, which
would call gtk_widget_accessible_get_attributes and append the desired
attribute to the attribute set before returning it?

I guess that instead of caja_desktop_window_init you mean something ilke
caja_desktop_window_class_init. If that is the case, yes, that is the
usual way to go. In general we can see AtkObject attributes as class
attributes. You can find an example of the get_attributes override at
GtkEntryAccessible.

Here the override for the custom get_attributes:
https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/a11y/gtkentryaccessible.c#L750

And here the custom get_attributes:
https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/a11y/gtkentryaccessible.c#L417

Note that the custom get_attributes calls first the parent
get_atributes, and then it adds their own ones (in this case
"placeholder-text").

BR






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]