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:
Florian Müllner
2019-07-25 17:33:00 +02:00
parent 5545e84430
commit b970ee7293
4 changed files with 26 additions and 15 deletions

View File

@ -130,17 +130,16 @@ var StreamSlider = class {
_updateVolume() {
let muted = this._stream.is_muted;
this._slider.setValue(muted ? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
this._slider.value = muted
? 0 : (this._stream.volume / this._control.get_vol_max_norm());
this.emit('stream-updated');
}
_amplifySettingsChanged() {
this._allowAmplified = this._soundSettings.get_boolean(ALLOW_AMPLIFIED_VOLUME_KEY);
if (this._allowAmplified)
this._slider.setMaximumValue(this.getMaxLevel() / 100);
else
this._slider.setMaximumValue(1);
this._slider.maximum_level = this._allowAmplified
? this.getMaxLevel() / 100 : 1;
if (this._stream)
this._updateVolume();