From 3fb370e1d0f1c2751e1cc6b6360541c4c48436fc Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 10 Sep 2020 10:41:37 +0200 Subject: [PATCH] Fix not updated volume icon on startup --- clapper_src/interface.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clapper_src/interface.js b/clapper_src/interface.js index 0a0cf0f0..8aa662f2 100644 --- a/clapper_src/interface.js +++ b/clapper_src/interface.js @@ -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) + 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; - debug(`set volume icon: ${icon}`); - this.controls.volumeButton.image.set_from_icon_name( - iconName, - this.controls.volumeButton.image.icon_size - ); + this.lastVolumeValue = volume; + this._player.set_volume(volume); } });