mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
gtk-demo: Misc a11y fixes
Add some missing labels.
This commit is contained in:
parent
158a3d4f04
commit
e251e7583f
@ -95,6 +95,13 @@ do_entry_completion (GtkWidget *do_widget)
|
|||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_box_append (GTK_BOX (vbox), entry);
|
gtk_box_append (GTK_BOX (vbox), entry);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE, GTK_ACCESSIBLE_AUTOCOMPLETE_LIST,
|
||||||
|
-1);
|
||||||
|
|
||||||
/* Create the completion object */
|
/* Create the completion object */
|
||||||
completion = gtk_entry_completion_new ();
|
completion = gtk_entry_completion_new ();
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ do_entry_undo (GtkWidget *do_widget)
|
|||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
|
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
|
||||||
gtk_box_append (GTK_BOX (vbox), entry);
|
gtk_box_append (GTK_BOX (vbox), entry);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
@ -22,11 +22,15 @@ validate_more_details (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
|
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
|
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
|
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
|
||||||
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
|
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,10 +48,18 @@ mode_switch_state_set (GtkSwitch *sw,
|
|||||||
{
|
{
|
||||||
gtk_widget_set_visible (label, FALSE);
|
gtk_widget_set_visible (label, FALSE);
|
||||||
gtk_switch_set_state (sw, state);
|
gtk_switch_set_state (sw, state);
|
||||||
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_set_visible (label, TRUE);
|
gtk_widget_set_visible (label, TRUE);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
|
||||||
|
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
|
||||||
|
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||||
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -73,6 +85,9 @@ level_scale_value_changed (GtkRange *range,
|
|||||||
{
|
{
|
||||||
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
|
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
|
||||||
|
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
Loading…
Reference in New Issue
Block a user