forked from AuroraMiddleware/gtk
a11y: Handle relations in UI files
A bit hacky: we skip parsing values that have a reference or reference-list type, but we do not error out. Instead, we return a NULL value, which we catch in the GtkBuildable interface implementation to get the actual object, and construct a reference list value. There's still some ickyness around the value type that can only be solved by having an attribute and role taxonomy.
This commit is contained in:
parent
7702670d86
commit
80756322cd
@ -1445,11 +1445,10 @@ gtk_accessible_value_parse (const GtkAccessibleCollect *cstate,
|
||||
case GTK_ACCESSIBLE_COLLECT_REFERENCE:
|
||||
case GTK_ACCESSIBLE_COLLECT_REFERENCE_LIST:
|
||||
{
|
||||
/* We do not error out, to let the caller code deal
|
||||
* with the references themselves
|
||||
*/
|
||||
res = NULL;
|
||||
g_set_error (error, GTK_ACCESSIBLE_VALUE_ERROR,
|
||||
GTK_ACCESSIBLE_VALUE_ERROR_INVALID_VALUE,
|
||||
"Invalid relation “%s”",
|
||||
str);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -8831,6 +8831,23 @@ gtk_widget_buildable_finish_accessibility_properties (GtkWidget *widget,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value == NULL)
|
||||
{
|
||||
GObject *obj = gtk_builder_get_object (accessibility_data->builder,
|
||||
pinfo->value->str);
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
g_warning ("Failed to find accessible object “%s” for relation “%s”",
|
||||
pinfo->value->str,
|
||||
pinfo->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* FIXME: Need to distinguish between refs and refslist types */
|
||||
value = gtk_reference_list_accessible_value_new (g_list_append (NULL, obj));
|
||||
}
|
||||
|
||||
gtk_at_context_set_accessible_relation (context, relation, value);
|
||||
gtk_accessible_value_unref (value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user