diff options
author | charles kerr <charlesk@canonical.com> | 2015-12-29 14:16:16 -0600 |
---|---|---|
committer | charles kerr <charlesk@canonical.com> | 2015-12-29 14:16:16 -0600 |
commit | a018f6a52faf34212e719772cc45bfbfc4b21daa (patch) | |
tree | 8f1021fb0dc96ba73de11807d3f33705bc0e064e /src/volume-warning.vala | |
parent | 0463874601bf826dcd5b976d928e2d53c9517f94 (diff) | |
download | ayatana-indicator-sound-a018f6a52faf34212e719772cc45bfbfc4b21daa.tar.gz ayatana-indicator-sound-a018f6a52faf34212e719772cc45bfbfc4b21daa.tar.bz2 ayatana-indicator-sound-a018f6a52faf34212e719772cc45bfbfc4b21daa.zip |
dampen Pulse floods in vol-warning by requerying no more than once per sec
Diffstat (limited to 'src/volume-warning.vala')
-rw-r--r-- | src/volume-warning.vala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/volume-warning.vala b/src/volume-warning.vala index 86ceb85..bf587fd 100644 --- a/src/volume-warning.vala +++ b/src/volume-warning.vala @@ -76,6 +76,13 @@ public abstract class VolumeWarning : Object protected abstract void sound_system_set_multimedia_volume(PulseAudio.Volume volume); + protected void clear_timer (ref uint timer) { + if (timer != 0) { + Source.remove (timer); + timer = 0; + } + } + /*** **** ***/ @@ -174,10 +181,7 @@ public abstract class VolumeWarning : Object } } private void stop_high_volume_approved_timer() { - if (_high_volume_approved_timer != 0) { - Source.remove (_high_volume_approved_timer); - _high_volume_approved_timer = 0; - } + clear_timer(ref _high_volume_approved_timer); } private bool on_high_volume_approved_timer() { _high_volume_approved_timer = 0; |