From 06354a8c9a752683baec46ea79a38457fda8dab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Thu, 15 Mar 2012 19:04:54 +0100 Subject: [PATCH] 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(+) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 378131927..3aca567d7 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 ebb0ff791..86c10e5f5 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); } });