[gnome-shell/wip/gtkmenutrackeritem: 7/9] remoteMenu: Add support for extended accessibility roles
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/gtkmenutrackeritem: 7/9] remoteMenu: Add support for extended accessibility roles
- Date: Thu, 9 May 2013 21:51:57 +0000 (UTC)
commit 4f1ae20cee3401c4ee741dd48c303f855a09251f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu May 9 16:24:40 2013 -0400
remoteMenu: Add support for extended accessibility roles
js/ui/remoteMenu.js | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/remoteMenu.js b/js/ui/remoteMenu.js
index dd98602..f144cf6 100644
--- a/js/ui/remoteMenu.js
+++ b/js/ui/remoteMenu.js
@@ -1,5 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+const Atk = imports.gi.Atk;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gio = imports.gi.Gio;
@@ -29,12 +30,12 @@ const RemoteMenuItemMapper = new Lang.Class({
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
this._trackerItem.connect('notify::sensitive', Lang.bind(this, this._updateSensitivity));
- this._trackerItem.connect('notify::role', Lang.bind(this, this._updateDecoration));
+ this._trackerItem.connect('notify::role', Lang.bind(this, this._updateRole));
this._trackerItem.connect('notify::toggled', Lang.bind(this, this._updateDecoration));
this._updateLabel();
this._updateSensitivity();
- this._updateDecoration();
+ this._updateRole();
},
_updateLabel: function() {
@@ -59,6 +60,18 @@ const RemoteMenuItemMapper = new Lang.Class({
this.menuItem.setOrnament(ornament);
},
+
+ _updateRole: function() {
+ let a11yRoles = {};
+ a11yRoles[ShellMenu.MenuTrackerItemRole.NORMAL] = Atk.Role.MENU_ITEM;
+ a11yRoles[ShellMenu.MenuTrackerItemRole.RADIO] = Atk.Role.RADIO_MENU_ITEM;
+ a11yRoles[ShellMenu.MenuTrackerItemRole.CHECK] = Atk.Role.CHECK_MENU_ITEM;
+
+ let a11yRole = a11yRoles[this._trackerItem.role];
+ this.menuItem.actor.accessible_role = a11yRole;
+
+ this._updateDecoration();
+ },
});
const RemoteMenu = new Lang.Class({
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]