diff options
author | Ted Gould <ted@gould.cx> | 2014-10-09 09:47:01 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-10-09 09:47:01 -0500 |
commit | 27e2a3618ac09e9ca3dbbc30ed4d8ebec71feba9 (patch) | |
tree | e8daf94b45c7b61451fc5eb36930812aa7e32abb /src/volume-control.vala | |
parent | 03a879f644d27ec45a97caa7681e4428f7b341fd (diff) | |
download | ayatana-indicator-sound-27e2a3618ac09e9ca3dbbc30ed4d8ebec71feba9.tar.gz ayatana-indicator-sound-27e2a3618ac09e9ca3dbbc30ed4d8ebec71feba9.tar.bz2 ayatana-indicator-sound-27e2a3618ac09e9ca3dbbc30ed4d8ebec71feba9.zip |
No audio ping if we're doing multimedia, and no notification if we're not on phone
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r-- | src/volume-control.vala | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala index a4c97b6..17367e8 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -577,17 +577,22 @@ public class VolumeControl : Object public void set_volume (double 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.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); - _notification.show (); + /* Using this to detect whether we're on the phone or not */ + if (_pulse_use_stream_restore) { + 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); + if (_active_sink_input == -1 || _valid_roles[_active_sink_input] != "multimedia") + /* No audio ping if we're playing multimedia */ + _notification.set_hint ("sound-file", "/usr/share/sounds/ubuntu/stereo/message.ogg"); + _notification.show (); + } if (set_volume_internal (volume)) { start_local_volume_timer(); |