barLevel: Use setters instead of methods
Switching to getters/setters make the code suitable for using with Tweener and as GObject properties, both of which we'll do soon enough. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
This commit is contained in:
@ -34,7 +34,11 @@ var BarLevel = class {
|
||||
this.connect('value-changed', this._valueChanged.bind(this));
|
||||
}
|
||||
|
||||
setValue(value) {
|
||||
get value() {
|
||||
return this._value;
|
||||
}
|
||||
|
||||
set value(value) {
|
||||
if (isNaN(value))
|
||||
throw TypeError('The bar level value must be a number');
|
||||
|
||||
@ -42,7 +46,13 @@ var BarLevel = class {
|
||||
this.actor.queue_repaint();
|
||||
}
|
||||
|
||||
setMaximumValue(value) {
|
||||
// eslint-disable-next-line camelcase
|
||||
get maximum_value() {
|
||||
return this._maxValue;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
set maximum_value(value) {
|
||||
if (isNaN(value))
|
||||
throw TypeError('The bar level max value must be a number');
|
||||
|
||||
@ -51,7 +61,13 @@ var BarLevel = class {
|
||||
this.actor.queue_repaint();
|
||||
}
|
||||
|
||||
setOverdriveStart(value) {
|
||||
// eslint-disable-next-line camelcase
|
||||
get overdrive_start() {
|
||||
return this._overdriveStart;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
set overdrive_start(value) {
|
||||
if (isNaN(value))
|
||||
throw TypeError('The overdrive limit value must be a number');
|
||||
if (value > this._maxValue)
|
||||
@ -196,9 +212,5 @@ var BarLevel = class {
|
||||
_valueChanged() {
|
||||
this._customAccessible.notify("accessible-value");
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this._value;
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(BarLevel.prototype);
|
||||
|
Reference in New Issue
Block a user