Using GList is a bit lame, and makes the API more complicated to use
than necessary in the common case.
The only real use case for a GList is gtk_widget_add_mnemonic_label(),
and for that we can use the GValue-based API instead.
Fixes: #3343
This makes it so that you have to explicitly specify
"true" and "false" for the checked state, but it
matches how this enumeration is meant to be used.
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.
Bail out early, instead of going deep into the GtkAccessibleValue type
equal() implementation, where we expect both accessible values to have
the same type.
We're currently overloading NULL to mean both "this value is undefined,
and should be reset to its default" and "the value collection failed".
Let's do error reporting right, by using GError to mean "the collection
failed, for this specific reason"; then, we can use a NULL return value
to signal that the accessible attribute should be reset to its default
value.
This is only relevant for pointer-sized attribute values: strings,
references, and reference lists; numeric, boolean, tristate, and token
values either cannot be undefined, or have a specific "undefined" value.
Accessible values storing references and reference lists can be unset by
using NULL to mean "undefined"; since we cannot return the NULL value,
we need to intercept it when collecting a value, and replace it with an
undefined GtkAccessibleValue, which is also the value used as the
default for GtkAccessibleRelation values that store a reference or a
reference list.
Fixes: #2955
Reduce the amount of subclassing, by handling collection of fundamental
types directly from the generic code paths. We now handle boolean,
tristate, integer, number, string, and relation values in the generic
code path; if an attribute supports the "undefined" value, we return the
undefined value singleton.
Drop roles and properties that were deprecated in WAI-ARIA 1.1, and add
new roles and properties defined in WAI-ARIA 1.2 and later.
We also split the relationship properties into their own enumeration, so
we can keep the GtkAccessibleProperty type more compact.
It's pointless, we can use an explicit value of `-1` everywhere.
Additionally, it complicates all code that uses the state enumeration as
an array index, since now we need to guard against a negative offset.
All accessible properties and states may have one of the following
types:
- true/false
- true/false/undefined
- true/false/mixed/undefined
- reference (to another UI element)
- reference list
- integer
- number (real numerical value)
- string
- token (one of a limited set of allowed values)
- token list
See: https://www.w3.org/WAI/PF/aria/states_and_properties#propcharacteristic_value
The GtkAccessibleValue is a simple reference counted type that can be
"subclassed" to implement each value type.
This initial commit adds GtkAccessibleValue and the basic subclasses for
plain boolean, tristate (true/false/undefined), and token types,
including statically allocated values that can be shared instead of
allocated.