forked from AuroraMiddleware/gtk
a11y: Allow bulk attribute update with the GValue API
Like we do for the varargs API.
This commit is contained in:
parent
701a0dabd0
commit
911a71c705
@ -174,10 +174,11 @@ out:
|
|||||||
/**
|
/**
|
||||||
* gtk_accessible_update_state_value:
|
* gtk_accessible_update_state_value:
|
||||||
* @self: a #GtkAccessible
|
* @self: a #GtkAccessible
|
||||||
* @state: a #GtkAccessibleState
|
* @n_states: the number of accessible states to set
|
||||||
* @value: a #GValue with the value for @state
|
* @states: (array length=n_states): an array of #GtkAccessibleState
|
||||||
|
* @values: (array length=n_states): an array of #GValues, one for each state
|
||||||
*
|
*
|
||||||
* Updates an accessible state.
|
* Updates an array of accessible states.
|
||||||
*
|
*
|
||||||
* This function should be called by #GtkWidget types whenever an accessible
|
* This function should be called by #GtkWidget types whenever an accessible
|
||||||
* state change must be communicated to assistive technologies.
|
* state change must be communicated to assistive technologies.
|
||||||
@ -186,35 +187,40 @@ out:
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_accessible_update_state_value (GtkAccessible *self,
|
gtk_accessible_update_state_value (GtkAccessible *self,
|
||||||
GtkAccessibleState state,
|
int n_states,
|
||||||
const GValue *value)
|
GtkAccessibleState states[],
|
||||||
|
const GValue values[])
|
||||||
{
|
{
|
||||||
GtkATContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
||||||
|
g_return_if_fail (n_states > 0);
|
||||||
|
|
||||||
context = gtk_accessible_get_at_context (self);
|
GtkATContext *context = gtk_accessible_get_at_context (self);
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GError *error = NULL;
|
for (int i = 0; i < n_states; i++)
|
||||||
GtkAccessibleValue *real_value =
|
|
||||||
gtk_accessible_value_collect_for_state_value (state, value, &error);
|
|
||||||
|
|
||||||
if (error != NULL)
|
|
||||||
{
|
{
|
||||||
g_critical ("Unable to collect the value for state “%s”: %s",
|
GtkAccessibleState state = states[i];
|
||||||
gtk_accessible_state_get_attribute_name (state),
|
const GValue *value = &(values[i]);
|
||||||
error->message);
|
GError *error = NULL;
|
||||||
g_error_free (error);
|
GtkAccessibleValue *real_value =
|
||||||
return;
|
gtk_accessible_value_collect_for_state_value (state, value, &error);
|
||||||
|
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_critical ("Unable to collect the value for state “%s”: %s",
|
||||||
|
gtk_accessible_state_get_attribute_name (state),
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_at_context_set_accessible_state (context, state, real_value);
|
||||||
|
|
||||||
|
if (real_value != NULL)
|
||||||
|
gtk_accessible_value_unref (real_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_at_context_set_accessible_state (context, state, real_value);
|
|
||||||
|
|
||||||
if (real_value != NULL)
|
|
||||||
gtk_accessible_value_unref (real_value);
|
|
||||||
|
|
||||||
gtk_at_context_update (context);
|
gtk_at_context_update (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,10 +318,11 @@ out:
|
|||||||
/**
|
/**
|
||||||
* gtk_accessible_update_property_value:
|
* gtk_accessible_update_property_value:
|
||||||
* @self: a #GtkAccessible
|
* @self: a #GtkAccessible
|
||||||
* @property: a #GtkAccessibleProperty
|
* @n_properties: the number of accessible properties to set
|
||||||
* @value: a #GValue with the value for @property
|
* @properties: (array length=n_properties): an array of #GtkAccessibleProperty
|
||||||
|
* @values: (array length=n_properties): an array of #GValues, one for each property
|
||||||
*
|
*
|
||||||
* Updates an accessible property.
|
* Updates an array of accessible properties.
|
||||||
*
|
*
|
||||||
* This function should be called by #GtkWidget types whenever an accessible
|
* This function should be called by #GtkWidget types whenever an accessible
|
||||||
* property change must be communicated to assistive technologies.
|
* property change must be communicated to assistive technologies.
|
||||||
@ -324,35 +331,40 @@ out:
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_accessible_update_property_value (GtkAccessible *self,
|
gtk_accessible_update_property_value (GtkAccessible *self,
|
||||||
GtkAccessibleProperty property,
|
int n_properties,
|
||||||
const GValue *value)
|
GtkAccessibleProperty properties[],
|
||||||
|
const GValue values[])
|
||||||
{
|
{
|
||||||
GtkATContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
||||||
|
g_return_if_fail (n_properties > 0);
|
||||||
|
|
||||||
context = gtk_accessible_get_at_context (self);
|
GtkATContext *context = gtk_accessible_get_at_context (self);
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GError *error = NULL;
|
for (int i = 0; i < n_properties; i++)
|
||||||
GtkAccessibleValue *real_value =
|
|
||||||
gtk_accessible_value_collect_for_property_value (property, value, &error);
|
|
||||||
|
|
||||||
if (error != NULL)
|
|
||||||
{
|
{
|
||||||
g_critical ("Unable to collect the value for property “%s”: %s",
|
GtkAccessibleProperty property = properties[i];
|
||||||
gtk_accessible_property_get_attribute_name (property),
|
const GValue *value = &(values[i]);
|
||||||
error->message);
|
GError *error = NULL;
|
||||||
g_error_free (error);
|
GtkAccessibleValue *real_value =
|
||||||
return;
|
gtk_accessible_value_collect_for_property_value (property, value, &error);
|
||||||
|
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_critical ("Unable to collect the value for property “%s”: %s",
|
||||||
|
gtk_accessible_property_get_attribute_name (property),
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_at_context_set_accessible_property (context, property, real_value);
|
||||||
|
|
||||||
|
if (real_value != NULL)
|
||||||
|
gtk_accessible_value_unref (real_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_at_context_set_accessible_property (context, property, real_value);
|
|
||||||
|
|
||||||
if (real_value != NULL)
|
|
||||||
gtk_accessible_value_unref (real_value);
|
|
||||||
|
|
||||||
gtk_at_context_update (context);
|
gtk_at_context_update (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,10 +453,11 @@ out:
|
|||||||
/**
|
/**
|
||||||
* gtk_accessible_update_relation_value:
|
* gtk_accessible_update_relation_value:
|
||||||
* @self: a #GtkAccessible
|
* @self: a #GtkAccessible
|
||||||
* @relation: a #GtkAccessibleRelation
|
* @n_relations: the number of accessible relations to set
|
||||||
* @value: a #GValue with the value for @relation
|
* @relations: (array length=n_relations): an array of #GtkAccessibleRelation
|
||||||
|
* @values: (array length=n_relations): an array of #GValues, one for each relation
|
||||||
*
|
*
|
||||||
* Updates an accessible relation.
|
* Updates an array of accessible relations.
|
||||||
*
|
*
|
||||||
* This function should be called by #GtkWidget types whenever an accessible
|
* This function should be called by #GtkWidget types whenever an accessible
|
||||||
* relation change must be communicated to assistive technologies.
|
* relation change must be communicated to assistive technologies.
|
||||||
@ -453,35 +466,40 @@ out:
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_accessible_update_relation_value (GtkAccessible *self,
|
gtk_accessible_update_relation_value (GtkAccessible *self,
|
||||||
GtkAccessibleRelation relation,
|
int n_relations,
|
||||||
const GValue *value)
|
GtkAccessibleRelation relations[],
|
||||||
|
const GValue values[])
|
||||||
{
|
{
|
||||||
GtkATContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
g_return_if_fail (GTK_IS_ACCESSIBLE (self));
|
||||||
|
g_return_if_fail (n_relations > 0);
|
||||||
|
|
||||||
context = gtk_accessible_get_at_context (self);
|
GtkATContext *context = gtk_accessible_get_at_context (self);
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GError *error = NULL;
|
for (int i = 0; i < n_relations; i++)
|
||||||
GtkAccessibleValue *real_value =
|
|
||||||
gtk_accessible_value_collect_for_relation_value (relation, value, &error);
|
|
||||||
|
|
||||||
if (error != NULL)
|
|
||||||
{
|
{
|
||||||
g_critical ("Unable to collect the value for relation “%s”: %s",
|
GtkAccessibleRelation relation = relations[i];
|
||||||
gtk_accessible_relation_get_attribute_name (relation),
|
const GValue *value = &(values[i]);
|
||||||
error->message);
|
GError *error = NULL;
|
||||||
g_error_free (error);
|
GtkAccessibleValue *real_value =
|
||||||
return;
|
gtk_accessible_value_collect_for_relation_value (relation, value, &error);
|
||||||
|
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_critical ("Unable to collect the value for relation “%s”: %s",
|
||||||
|
gtk_accessible_relation_get_attribute_name (relation),
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_at_context_set_accessible_relation (context, relation, real_value);
|
||||||
|
|
||||||
|
if (real_value != NULL)
|
||||||
|
gtk_accessible_value_unref (real_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_at_context_set_accessible_relation (context, relation, real_value);
|
|
||||||
|
|
||||||
if (real_value != NULL)
|
|
||||||
gtk_accessible_value_unref (real_value);
|
|
||||||
|
|
||||||
gtk_at_context_update (context);
|
gtk_at_context_update (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,16 +52,19 @@ void gtk_accessible_update_relation (GtkAccessible
|
|||||||
...);
|
...);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_accessible_update_state_value (GtkAccessible *self,
|
void gtk_accessible_update_state_value (GtkAccessible *self,
|
||||||
GtkAccessibleState state,
|
int n_states,
|
||||||
const GValue *value);
|
GtkAccessibleState states[],
|
||||||
|
const GValue values[]);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_accessible_update_property_value (GtkAccessible *self,
|
void gtk_accessible_update_property_value (GtkAccessible *self,
|
||||||
GtkAccessibleProperty property,
|
int n_properties,
|
||||||
const GValue *value);
|
GtkAccessibleProperty properties[],
|
||||||
|
const GValue values[]);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_accessible_update_relation_value (GtkAccessible *self,
|
void gtk_accessible_update_relation_value (GtkAccessible *self,
|
||||||
GtkAccessibleRelation relation,
|
int n_relations,
|
||||||
const GValue *value);
|
GtkAccessibleRelation relations[],
|
||||||
|
const GValue values[]);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_accessible_reset_state (GtkAccessible *self,
|
void gtk_accessible_reset_state (GtkAccessible *self,
|
||||||
|
Loading…
Reference in New Issue
Block a user