From 4600123677c7897e76eb8b666c2b3211ebcd19d4 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Tue, 1 Oct 2013 14:02:12 +0200 Subject: service: use vala's double.clamp() --- src/service.vala | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/service.vala b/src/service.vala index 9c7bcc9..9041097 100644 --- a/src/service.vala +++ b/src/service.vala @@ -82,12 +82,7 @@ public class IndicatorSound.Service { int delta = param.get_int32(); /* positive for up, negative for down */ double v = this.volume_control.get_volume () + volume_step_percentage * delta; - if (v > 1.0) - v = 1.0; - else if (v < 0.0) - v = 0.0; - - this.volume_control.set_volume (v); + this.volume_control.set_volume (v.clamp (0.0, 1.0)); } void activate_desktop_settings (SimpleAction action, Variant? param) { -- cgit v1.2.3