aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2014-02-20 18:22:01 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2014-02-20 18:22:01 +0100
commit474b7ff95f176c0d1a12df3107c1b21b129b138d (patch)
tree889c7568bbc470b3931b5e22c17870e6422b3672 /src/service.vala
parent60d21d58c2dd67a083857aafe9c3d58c4bd0685e (diff)
downloadayatana-indicator-sound-474b7ff95f176c0d1a12df3107c1b21b129b138d.tar.gz
ayatana-indicator-sound-474b7ff95f176c0d1a12df3107c1b21b129b138d.tar.bz2
ayatana-indicator-sound-474b7ff95f176c0d1a12df3107c1b21b129b138d.zip
Clamp volume when in the action's change_state handler
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/service.vala b/src/service.vala
index 3a64cb2..87e8b8b 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -240,7 +240,8 @@ public class IndicatorSound.Service: Object {
var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, new Variant.double (volume));
volume_action.change_state.connect ( (action, val) => {
- volume_control.set_volume (val.get_double () * this.max_volume);
+ double v = val.get_double () * this.max_volume;
+ volume_control.set_volume (v.clamp (0.0, this.max_volume));
});
/* activating this action changes the volume by the amount given in the parameter */