diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2014-03-16 17:43:06 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2014-03-16 17:43:06 +0100 |
commit | 2ad60576f3975fab265bd44751c9af634f51a375 (patch) | |
tree | e03a71ac653012804b819bc5851b30c3809bd8b7 /src/volume-control.vala | |
parent | e2fdd75b6e7fd1c8572dd10356272668b99d33dd (diff) | |
download | ayatana-indicator-sound-2ad60576f3975fab265bd44751c9af634f51a375.tar.gz ayatana-indicator-sound-2ad60576f3975fab265bd44751c9af634f51a375.tar.bz2 ayatana-indicator-sound-2ad60576f3975fab265bd44751c9af634f51a375.zip |
Show a red icon in the panel when a sound is playing while mute is on
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r-- | src/volume-control.vala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala index e994922..8f21b60 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -31,6 +31,7 @@ public class VolumeControl : Object private PulseAudio.Context context; private bool _mute = true; + private bool _is_playing = false; private double _volume = 0.0; private double _mic_volume = 0.0; @@ -97,6 +98,13 @@ public class VolumeControl : Object this.notify_property ("mute"); } + var playing = (i.state == PulseAudio.SinkState.RUNNING); + if (_is_playing != playing) + { + _is_playing = playing; + this.notify_property ("is-playing"); + } + if (_volume != volume_to_double (i.volume.values[0])) { _volume = volume_to_double (i.volume.values[0]); @@ -235,6 +243,14 @@ public class VolumeControl : Object } } + public bool is_playing + { + get + { + return this._is_playing; + } + } + /* Volume operations */ private static PulseAudio.Volume double_to_volume (double vol) { |