summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-07-13 17:47:36 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2020-07-26 20:31:15 +0100
commitc56e9b2031fbc3eea5262329c18b8ad06dc7f86b (patch)
treeb24fbc9a682d9c4f706bcea727dc280d9feeafdd
parent93978544c025244873b6523f2f9b9d372cf8719f (diff)
downloadgtk+-c56e9b2031fbc3eea5262329c18b8ad06dc7f86b.tar.gz
a11y: Add binding-friendly accessible property setter
Matching the one for the accessible state.
-rw-r--r--gtk/gtkaccessible.c37
-rw-r--r--gtk/gtkaccessible.h4
2 files changed, 41 insertions, 0 deletions
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 0d6e2bd717..c06612ba83 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -239,3 +239,40 @@ gtk_accessible_update_property (GtkAccessible *self,
out:
va_end (args);
}
+
+/**
+ * gtk_accessible_update_property_value:
+ * @self: a #GtkAccessible
+ * @property: a #GtkAccessibleProperty
+ * @value: a #GValue with the value for @property
+ *
+ * Updates an accessible property.
+ *
+ * This function should be called by #GtkWidget types whenever an accessible
+ * property change must be communicated to assistive technologies.
+ *
+ * This function is meant to be used by language bindings.
+ */
+void
+gtk_accessible_update_property_value (GtkAccessible *self,
+ GtkAccessibleProperty property,
+ const GValue *value)
+{
+ GtkATContext *context;
+
+ g_return_if_fail (GTK_IS_ACCESSIBLE (self));
+
+ context = gtk_accessible_get_at_context (self);
+ if (context == NULL)
+ return;
+
+ GtkAccessibleValue *real_value =
+ gtk_accessible_value_collect_for_property_value (property, value);
+
+ if (real_value == NULL)
+ return;
+
+ gtk_at_context_set_accessible_property (context, property, real_value);
+ gtk_accessible_value_unref (real_value);
+ gtk_at_context_update (context);
+}
diff --git a/gtk/gtkaccessible.h b/gtk/gtkaccessible.h
index f95ba930d2..9ad56784c7 100644
--- a/gtk/gtkaccessible.h
+++ b/gtk/gtkaccessible.h
@@ -46,5 +46,9 @@ GDK_AVAILABLE_IN_ALL
void gtk_accessible_update_state_value (GtkAccessible *self,
GtkAccessibleState state,
const GValue *value);
+GDK_AVAILABLE_IN_ALL
+void gtk_accessible_update_property_value (GtkAccessible *self,
+ GtkAccessibleProperty property,
+ const GValue *value);
G_END_DECLS