From e6886725945a09d3f286d35b313e23c94c2a091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirco=20M=C3=BCller?= Date: Tue, 5 Aug 2014 11:13:51 +0200 Subject: Move the triggering of the volume up/down notification into set_volume(). --- src/volume-control.vala | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/volume-control.vala b/src/volume-control.vala index 5a16621..6148b79 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -310,12 +310,8 @@ public class VolumeControl : Object private void set_volume_success_cb (Context c, int success) { - if ((bool)success) { + if ((bool)success) volume_changed (_volume); - _notification.update ("Volume", "", "audio-volume-medium"); - _notification.set_hint ("value", _volume); - _notification.show (); - } } private void sink_info_set_volume_cb (Context c, SinkInfo? i, int eol) @@ -353,8 +349,20 @@ public class VolumeControl : Object public void set_volume (double volume) { - if (set_volume_internal (volume)) + if (set_volume_internal (volume)) { + if (_volume == 0.0) + _notification.update ("Volume", "", "audio-volume-muted"); + if (_volume > 0.0 && _volume <= 0.33) + _notification.update ("Volume", "", "audio-volume-low"); + if (_volume > 0.33 && _volume <= 0.66) + _notification.update ("Volume", "", "audio-volume-medium"); + if (_volume > 0.66 && _volume <= 1.0) + _notification.update ("Volume", "", "audio-volume-high"); + _notification.set_hint ("value", _volume * 100.0); + _notification.show (); + start_local_volume_timer(); + } } void set_mic_volume_success_cb (Context c, int success) -- cgit v1.2.3