From federico on IRC:

GtkLabel just does two things for accessibility:

  1. Set its role on the GTK side to GTK_ACCESSIBLE_ROLE_LABEL in the class initialization function gtk_label_class_init (

    Later, that gets translated with gtk_accessible_role_to_atspi_role() to an AtspiRole enum value in gtk_accessible_role_to_atspi_role (

    Those enum values in AtspiRole ( correspond to the integer values that the Accessible.GetRole() method expects (, and which are unfortunately just hardcoded in atspi-constants.h (

  2. The other thing GtkLabel does is to change its text in its corresponding GtkAtContext. Every widget gets a GtkAtContext created for it; it's just an object that collects data to feed to the a11y backend. gtk_label_set_text_internal ( is where the label changes the text, and much later that gets collected, and sent to the accessibility backend's state_change method , gtk_at_context_update (

    The only implementation of state_change right now is for the atspi backend. And for labels in particular, gtk_at_spi_context_state_change ( picks up the new accessible-name, and emits it as a dbus signal via emit_property_changed() in emit_property_changed (

Going in the other direction, when a screen reader asks an accessible object for its Name property:

The gtkatspicontext receives the property request from dbus, and processes it in handle_accessible_get_property ( - that calls gtk_at_context_get_name(), which is at and the first thing that function does is to call gtk_at_context_get_name_accumulate(), which does the ARIA magic to compute a name based on an object's actual label, labelled-by, etc. ([[])]

How editable_handle_method() gets called? GTK uses the g_dbus API internally to talk DBus. Whereas in python it's super easy to do something like

@dbus.service.method('', in_signature="whatever", out_signature="whatever")
def MyMethodName(self, blah, blah, blah):

In C it's a bit more complicated. g_dbus wants to be told the path of the object, the name of an interface, and a vtable with functions that when called, can deal with calling methods or getting/setting properties

For example, first gets the vtable for the editable text interface, and calls g_dbus_connection_register_object(). That vtable is gtk_at_spi_context_register_object ( - its first element is the handler that g_dbus will call when it wants to call a method on the interface. The "call a method

From the editable text interface" handler is text_view_handle_method ( - you'll see that it compares the method_name with SetTextContents, InsertText, etc. - all methods names from