[gnome-shell] a11y: using generic accessible at slider



commit 84d8d4f622d398bc7378c0b3594492be2cf858ff
Author: Alejandro Piñeiro <apinheiro igalia com>
Date:   Thu Aug 22 23:15:35 2013 +0200

    a11y: using generic accessible at slider
    
    Needed in order to fill the AtkValue implementation using
    signal callbacks (ala ShellGenericContainer).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=648623

 js/ui/slider.js |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/slider.js b/js/ui/slider.js
index ab90d61..e098846 100644
--- a/js/ui/slider.js
+++ b/js/ui/slider.js
@@ -29,6 +29,17 @@ const Slider = new Lang.Class({
 
         this._releaseId = this._motionId = 0;
         this._dragging = false;
+
+        this._customAccessible = St.GenericAccessible.new_for_actor(this.actor);
+        this.actor.set_accessible(this._customAccessible);
+
+        this._customAccessible.connect('get-current-value', Lang.bind(this, this._getCurrentValue));
+        this._customAccessible.connect('get-minimum-value', Lang.bind(this, this._getMinimumValue));
+        this._customAccessible.connect('get-maximum-value', Lang.bind(this, this._getMaximumValue));
+        this._customAccessible.connect('get-minimum-increment', Lang.bind(this, this._getMinimumIncrement));
+        this._customAccessible.connect('set-current-value', Lang.bind(this, this._setCurrentValue));
+
+        this.connect('value-changed', Lang.bind(this, this._valueChanged));
     },
 
     setValue: function(value) {
@@ -204,6 +215,30 @@ const Slider = new Lang.Class({
         this.emit('value-changed', this._value);
     },
 
+    _getCurrentValue: function (actor) {
+        return this._value;
+    },
+
+    _getMinimumValue: function (actor) {
+        return 0;
+    },
+
+    _getMaximumValue: function (actor) {
+        return 1;
+    },
+
+    _getMinimumIncrement: function (actor) {
+        return 0.1;
+    },
+
+    _setCurrentValue: function (actor, value) {
+        this._value = value;
+    },
+
+    _valueChanged: function (slider, value, property) {
+        this._customAccessible.notify ("accessible-value");
+    },
+
     get value() {
         return this._value;
     }


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