[gtk/ebassi/new-a11y: 59/71] a11y: Implement role and state change in GtkSwitch
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/new-a11y: 59/71] a11y: Implement role and state change in GtkSwitch
- Date: Wed, 22 Jul 2020 12:26:44 +0000 (UTC)
commit 8b7bf9409dd142fa5b18d9aa5be7f58b56244621
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Jul 17 14:31:02 2020 +0100
a11y: Implement role and state change in GtkSwitch
Set the "switch" role, and update the "checked" state when the :active
property is toggled.
gtk/gtkswitch.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 7563c5b099..bca74e7b27 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -605,6 +605,8 @@ gtk_switch_class_init (GtkSwitchClass *klass)
g_object_class_override_property (gobject_class, PROP_ACTION_TARGET, "action-target");
gtk_widget_class_set_css_name (widget_class, I_("switch"));
+
+ gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_SWITCH);
}
static void
@@ -699,6 +701,10 @@ gtk_switch_set_active (GtkSwitch *self,
g_object_notify_by_pspec (G_OBJECT (self), switch_props[PROP_ACTIVE]);
+ gtk_accessible_update_state (GTK_ACCESSIBLE (self),
+ GTK_ACCESSIBLE_STATE_CHECKED, is_active,
+ -1);
+
gtk_widget_queue_allocate (GTK_WIDGET (self));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]