diff options
author | Mirco Müller <mirco.mueller@canonical.com> | 2014-09-19 19:41:50 +0200 |
---|---|---|
committer | Mirco Müller <mirco.mueller@canonical.com> | 2014-09-19 19:41:50 +0200 |
commit | 3297337f253efc9ae15b07b78d3e1e9a0611e5ce (patch) | |
tree | f913827d9e4fa7f93c97823d1fb385e89043a7e8 /src/volume-control.vala | |
parent | 965fdf8817d11d382f7012999d48fa702c91a628 (diff) | |
download | ayatana-indicator-sound-3297337f253efc9ae15b07b78d3e1e9a0611e5ce.tar.gz ayatana-indicator-sound-3297337f253efc9ae15b07b78d3e1e9a0611e5ce.tar.bz2 ayatana-indicator-sound-3297337f253efc9ae15b07b78d3e1e9a0611e5ce.zip |
Trigger synchronous notification upon every volume-change attempt, thus the user gets to see visual and audible feedback every time a volume-key is pressed.
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r-- | src/volume-control.vala | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala index 8de5d2f..33ba878 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -76,7 +76,6 @@ public class VolumeControl : Object _notification.set_hint ("value", 0); _notification.set_hint ("x-canonical-private-synchronous", "true"); _notification.set_hint ("x-canonical-non-shaped-icon", "true"); - _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); setup_accountsservice.begin (); @@ -350,18 +349,19 @@ public class VolumeControl : Object public void set_volume (double 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 (); + 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.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); + _notification.show (); + if (set_volume_internal (volume)) { start_local_volume_timer(); } } |