a11y: userMenu: support for IMStatus combobox and

suspend/power-off label

https://bugzilla.gnome.org/show_bug.cgi?id=671404
This commit is contained in:
Alejandro Piñeiro 2012-03-15 19:04:54 +01:00
parent 7c25dead17
commit 06354a8c9a
2 changed files with 15 additions and 0 deletions

View File

@ -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) {

View File

@ -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);
}
});