mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
modelbutton: Set a11y shortcuts
This commit is contained in:
parent
d562c86638
commit
94f5d2db0d
@ -587,6 +587,17 @@ update_accessible_properties (GtkModelButton *button)
|
|||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
if (button->accel_label)
|
||||||
|
{
|
||||||
|
const char *text = gtk_label_get_label (GTK_LABEL (button->accel_label));
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS, text,
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gtk_accessible_reset_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -831,6 +842,7 @@ update_accel (GtkModelButton *self,
|
|||||||
if (!self->accel_label)
|
if (!self->accel_label)
|
||||||
{
|
{
|
||||||
self->accel_label = g_object_new (GTK_TYPE_LABEL,
|
self->accel_label = g_object_new (GTK_TYPE_LABEL,
|
||||||
|
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||||
"css-name", "accelerator",
|
"css-name", "accelerator",
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_insert_before (self->accel_label, GTK_WIDGET (self), NULL);
|
gtk_widget_insert_before (self->accel_label, GTK_WIDGET (self), NULL);
|
||||||
@ -880,6 +892,8 @@ update_accel (GtkModelButton *self,
|
|||||||
self->controller = NULL;
|
self->controller = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_accessible_properties (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1481,7 +1495,7 @@ gtk_model_button_init (GtkModelButton *self)
|
|||||||
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
|
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
|
||||||
|
|
||||||
self->role = GTK_BUTTON_ROLE_NORMAL;
|
self->role = GTK_BUTTON_ROLE_NORMAL;
|
||||||
self->label = gtk_label_new ("");
|
self->label = g_object_new (GTK_TYPE_LABEL, "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION, NULL);
|
||||||
gtk_widget_set_halign (self->label, GTK_ALIGN_START);
|
gtk_widget_set_halign (self->label, GTK_ALIGN_START);
|
||||||
gtk_widget_set_parent (self->label, GTK_WIDGET (self));
|
gtk_widget_set_parent (self->label, GTK_WIDGET (self));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user