Some time ago I asked how to add accessibility to an IconView widget in Gtk3, because all the icons just said “Icon”, but had no answer.
Now, after doing some investigation, finally found how to do it, so I’ll share it here in case anyone needs it too.
The idea is to get the Atk.Object from the icon view using `gtk_widget_get_accessible()`, and then get the Atk.Object for each child icon using `atk_object_ref_accessible_child(child_number)`. To know how many children the icon view has, just use `atk_object_get_n_accessible_children()`.
With this Atk.Object, now we can set the name, role, description… for that specific icon.
An example in Vala, extracted from Cronopete. Here, `this.path_view` is the Gtk.IconView:
var accessible = this.path_view.get_accessible();
var child = accessible.ref_accessible_child(counter);
child.set_name("%s %s".printf(f.name, f.isdir ? _("Folder") : _("File")));
child.set_role(Atk.Role.UNKNOWN);