Fix not updated volume icon on startup

This commit is contained in:
Rafostar
2020-09-10 10:41:37 +02:00
parent 06914db0da
commit 3fb370e1d0

View File

@@ -340,12 +340,6 @@ class ClapperInterface extends Gtk.Grid
{
let volume = Number(volumeScale.get_value().toFixed(2));
if(volume === this.lastVolumeValue)
return;
this.lastVolumeValue = volume;
this._player.set_volume(volume);
let icon = (volume <= 0)
? 'muted'
: (volume <= 0.33)
@@ -358,13 +352,19 @@ class ClapperInterface extends Gtk.Grid
let iconName = `audio-volume-${icon}-symbolic`;
if(this.controls.volumeButton.image.icon_name === iconName)
return;
if(this.controls.volumeButton.image.icon_name !== iconName)
{
debug(`set volume icon: ${icon}`);
this.controls.volumeButton.image.set_from_icon_name(
iconName,
this.controls.volumeButton.image.icon_size
);
}
if(volume === this.lastVolumeValue)
return;
this.lastVolumeValue = volume;
this._player.set_volume(volume);
}
});