a11y: Update GtkSpinButton

Set the appropriate accessible role, and update
the value properties.
This commit is contained in:
Matthias Clasen 2020-07-17 14:41:06 -04:00 committed by Emmanuele Bassi
parent b7777add36
commit c36ad5f474

View File

@ -549,6 +549,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
gtk_widget_class_set_css_name (widget_class, I_("spinbutton"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_SPIN_BUTTON);
}
static GtkEditable *
@ -1069,9 +1070,16 @@ adjustment_changed_cb (GtkAdjustment *adjustment, gpointer data)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (data);
spin_button->timer_step = gtk_adjustment_get_step_increment (spin_button->adjustment);
spin_button->timer_step = gtk_adjustment_get_step_increment (adjustment);
update_buttons_sensitivity (spin_button);
gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, gtk_adjustment_get_upper (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_MIN, gtk_adjustment_get_lower (adjustment),
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, gtk_adjustment_get_value (adjustment),
-1);
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
}
@ -1251,6 +1259,10 @@ gtk_spin_button_value_changed (GtkAdjustment *adjustment,
g_signal_emit (spin_button, spinbutton_signals[VALUE_CHANGED], 0);
gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, gtk_adjustment_get_value (adjustment),
-1);
update_buttons_sensitivity (spin_button);
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_VALUE]);