panelMenu: Use the accessible-name property instead of a label actor
We already have code for this in StWidget. https://bugzilla.gnome.org/show_bug.cgi?id=705898
This commit is contained in:
parent
ef09596648
commit
33e51cc38b
@ -521,7 +521,7 @@ const AppMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
this._targetApp = targetApp;
|
this._targetApp = targetApp;
|
||||||
this._label.setText(targetApp.get_name());
|
this._label.setText(targetApp.get_name());
|
||||||
this.setName(targetApp.get_name());
|
this.actor.set_accessible_name(targetApp.get_name());
|
||||||
|
|
||||||
this._syncIcon();
|
this._syncIcon();
|
||||||
this._arrow.show();
|
this._arrow.show();
|
||||||
|
@ -101,6 +101,7 @@ const Button = new Lang.Class({
|
|||||||
this.parent({ reactive: true,
|
this.parent({ reactive: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
track_hover: true,
|
track_hover: true,
|
||||||
|
accessible_name: nameText ? nameText : "",
|
||||||
accessible_role: Atk.Role.MENU });
|
accessible_role: Atk.Role.MENU });
|
||||||
|
|
||||||
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
||||||
@ -111,8 +112,6 @@ const Button = new Lang.Class({
|
|||||||
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
||||||
else
|
else
|
||||||
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
||||||
|
|
||||||
this.setName(nameText);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSensitive: function(sensitive) {
|
setSensitive: function(sensitive) {
|
||||||
@ -121,22 +120,6 @@ const Button = new Lang.Class({
|
|||||||
this.actor.track_hover = sensitive;
|
this.actor.track_hover = sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
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) {
|
setMenu: function(menu) {
|
||||||
if (this.menu)
|
if (this.menu)
|
||||||
this.menu.destroy();
|
this.menu.destroy();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user