[gnome-shell] a11y: userMenu: support for IMStatus combobox and suspend/power-off label



commit 06354a8c9a752683baec46ea79a38457fda8dab6
Author: Alejandro PiÃeiro <apinheiro igalia com>
Date:   Thu Mar 15 19:04:54 2012 +0100

    a11y: userMenu: support for IMStatus combobox and
     suspend/power-off label
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671404

 js/ui/popupMenu.js |   14 ++++++++++++++
 js/ui/userMenu.js  |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 3781319..3aca567 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -446,6 +446,7 @@ const PopupAlternatingMenuItem = new Lang.Class({
         this.label = new St.Label({ text: text });
         this.state = PopupAlternatingMenuItemState.DEFAULT;
         this.addActor(this.label);
+        this.actor.label_actor = this.label;
 
         this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
     },
@@ -1602,6 +1603,10 @@ const PopupComboMenu = new Lang.Class({
         this._activeItemPos = position;
     },
 
+    getActiveItem: function() {
+        return this._getMenuItems()[this._activeItemPos];
+    },
+
     setItemVisible: function(position, visible) {
         if (!visible && position == this._activeItemPos) {
             log('Trying to hide the active menu item.');
@@ -1623,6 +1628,8 @@ const PopupComboBoxMenuItem = new Lang.Class({
     _init: function (params) {
         this.parent(params);
 
+        this.actor.accessible_role = Atk.Role.COMBO_BOX;
+
         this._itemBox = new Shell.Stack();
         this.addActor(this._itemBox);
 
@@ -1719,6 +1726,11 @@ const PopupComboBoxMenuItem = new Lang.Class({
                          Lang.bind(this, this._itemActivated, position));
     },
 
+    checkAccessibleLabel: function() {
+        let activeItem = this._menu.getActiveItem();
+        this.actor.label_actor = activeItem.label;
+    },
+
     setActiveItem: function(position) {
         let item = this._items[position];
         if (!item)
@@ -1729,6 +1741,8 @@ const PopupComboBoxMenuItem = new Lang.Class({
         this._activeItemPos = position;
         for (let i = 0; i < this._items.length; i++)
             this._items[i].visible = (i == this._activeItemPos);
+
+        this.checkAccessibleLabel();
     },
 
     setItemVisible: function(position, visible) {
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index ebb0ff7..86c10e5 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -57,6 +57,7 @@ const IMStatusItem = new Lang.Class({
             this._icon.icon_name = iconName;
 
         this.label = new St.Label({ text: label });
+        this.actor.label_actor = this.label;
         this.addActor(this.label);
     }
 });



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