a11y: Setting a name/label_actor for several items on the panel
https://bugzilla.gnome.org/show_bug.cgi?id=667376
This commit is contained in:
parent
5a85fc0e55
commit
74dd298891
@ -69,6 +69,7 @@ const DateMenuButton = new Lang.Class({
|
||||
|
||||
// Date
|
||||
this._date = new St.Label();
|
||||
this.actor.label_actor = this._date;
|
||||
this._date.style_class = 'datemenu-date-label';
|
||||
vbox.add(this._date);
|
||||
|
||||
|
@ -237,7 +237,7 @@ const AppMenuButton = new Lang.Class({
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
_init: function(menuManager) {
|
||||
this.parent(0.0, true);
|
||||
this.parent(0.0, null, true);
|
||||
|
||||
this._startingApps = [];
|
||||
|
||||
@ -537,6 +537,7 @@ const AppMenuButton = new Lang.Class({
|
||||
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
|
||||
|
||||
this._label.setText(targetApp.get_name());
|
||||
this.setName(targetApp.get_name());
|
||||
|
||||
this._iconBox.set_child(icon);
|
||||
this._iconBox.show();
|
||||
|
@ -96,7 +96,7 @@ const Button = new Lang.Class({
|
||||
Name: 'PanelMenuButton',
|
||||
Extends: ButtonBox,
|
||||
|
||||
_init: function(menuAlignment, dontCreateMenu) {
|
||||
_init: function(menuAlignment, nameText, dontCreateMenu) {
|
||||
this.parent({ reactive: true,
|
||||
can_focus: true,
|
||||
track_hover: true });
|
||||
@ -108,6 +108,24 @@ const Button = new Lang.Class({
|
||||
this.menu = null;
|
||||
else
|
||||
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
||||
|
||||
this.setName(nameText);
|
||||
},
|
||||
|
||||
setName: function(text) {
|
||||
if (text != null) {
|
||||
// This is the easiest way to provide a accessible name to
|
||||
// this widget. The label could be also used for other
|
||||
// purposes in the future.
|
||||
if (!this.label) {
|
||||
this.label = new St.Label({ text: text });
|
||||
this.actor.label_actor = this.label;
|
||||
} else
|
||||
this.label.text = text;
|
||||
} else {
|
||||
this.label = null;
|
||||
this.actor.label_actor = null;
|
||||
}
|
||||
},
|
||||
|
||||
setMenu: function(menu) {
|
||||
@ -203,8 +221,8 @@ const SystemStatusButton = new Lang.Class({
|
||||
Name: 'SystemStatusButton',
|
||||
Extends: Button,
|
||||
|
||||
_init: function(iconName,tooltipText) {
|
||||
this.parent(0.0);
|
||||
_init: function(iconName, tooltipText, nameText) {
|
||||
this.parent(0.0, nameText);
|
||||
|
||||
this._iconActor = new St.Icon({ icon_name: iconName,
|
||||
icon_type: St.IconType.SYMBOLIC,
|
||||
|
@ -389,6 +389,7 @@ const PopupMenuItem = new Lang.Class({
|
||||
|
||||
this.label = new St.Label({ text: text });
|
||||
this.addActor(this.label);
|
||||
this.actor.label_actor = this.label
|
||||
}
|
||||
});
|
||||
|
||||
@ -1428,6 +1429,7 @@ const PopupSubMenuMenuItem = new Lang.Class({
|
||||
|
||||
this.label = new St.Label({ text: text });
|
||||
this.addActor(this.label);
|
||||
this.actor.label_actor = this.label;
|
||||
this._triangle = new St.Label({ text: '\u25B8' });
|
||||
this.addActor(this._triangle, { align: St.Align.END });
|
||||
|
||||
|
@ -44,7 +44,7 @@ const ATIndicator = new Lang.Class({
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
|
||||
_init: function() {
|
||||
this.parent('preferences-desktop-accessibility', null);
|
||||
this.parent('preferences-desktop-accessibility', null, _("Accessibility"));
|
||||
|
||||
let highContrast = this._buildHCItem();
|
||||
this.menu.addMenuItem(highContrast);
|
||||
|
@ -28,7 +28,7 @@ const Indicator = new Lang.Class({
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
|
||||
_init: function() {
|
||||
this.parent('bluetooth-disabled', null);
|
||||
this.parent('bluetooth-disabled', null, _("Bluetooth"));
|
||||
|
||||
this._applet = new GnomeBluetoothApplet.Applet();
|
||||
|
||||
|
@ -113,6 +113,7 @@ const NMNetworkMenuItem = new Lang.Class({
|
||||
}
|
||||
|
||||
this._label = new St.Label({ text: title });
|
||||
this.actor.label_actor = this._label;
|
||||
this.addActor(this._label);
|
||||
this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
|
||||
this.addActor(this._icons, { align: St.Align.END });
|
||||
@ -1537,7 +1538,7 @@ const NMApplet = new Lang.Class({
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
|
||||
_init: function() {
|
||||
this.parent('network-error', null);
|
||||
this.parent('network-error', null, _("Network"));
|
||||
|
||||
this._client = NMClient.Client.new();
|
||||
|
||||
|
@ -57,7 +57,7 @@ const Indicator = new Lang.Class({
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
|
||||
_init: function() {
|
||||
this.parent('battery-missing', null);
|
||||
this.parent('battery-missing', null, _("Battery"));
|
||||
|
||||
this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
|
||||
|
||||
|
@ -22,7 +22,7 @@ const Indicator = new Lang.Class({
|
||||
Extends: PanelMenu.SystemStatusButton,
|
||||
|
||||
_init: function() {
|
||||
this.parent('audio-volume-muted', null);
|
||||
this.parent('audio-volume-muted', null, _("Volume"));
|
||||
|
||||
this._control = new Gvc.MixerControl({ name: 'GNOME Shell Volume Control' });
|
||||
this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
|
||||
|
@ -466,6 +466,7 @@ const UserMenuButton = new Lang.Class({
|
||||
}));
|
||||
|
||||
this._name = new St.Label();
|
||||
this.actor.label_actor = this._name;
|
||||
box.add(this._name, { y_align: St.Align.MIDDLE, y_fill: false });
|
||||
this._userLoadedId = this._user.connect('notify::is-loaded', Lang.bind(this, this._updateUserName));
|
||||
this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUserName));
|
||||
|
Loading…
Reference in New Issue
Block a user