[gtk/matthiasc/a11y-logging] a11y: Update GtkSpinButton



commit bf2c746c798c096b5088c0d804a9ae916190cfcf
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 17 14:41:06 2020 -0400

    a11y: Update GtkSpinButton
    
    Set the appropriate accessible role, and update
    the value properties.

 gtk/gtkspinbutton.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 4142946179..48cf499153 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -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]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]