diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-08-06 22:11:56 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2015-08-06 22:11:56 -0500 |
commit | c7c00db856ca936559c650ef695452f90472d35e (patch) | |
tree | e0183056f3f6b4e7f4f9bebf0b53e19b52a085ea /src/volume-control-pulse.vala | |
parent | 5a30dde1f09e55729ec0b0b7ed451f15c6e635fa (diff) | |
download | ayatana-indicator-sound-c7c00db856ca936559c650ef695452f90472d35e.tar.gz ayatana-indicator-sound-c7c00db856ca936559c650ef695452f90472d35e.tar.bz2 ayatana-indicator-sound-c7c00db856ca936559c650ef695452f90472d35e.zip |
add time-based confirmation dialog for high volumes
Diffstat (limited to 'src/volume-control-pulse.vala')
-rw-r--r-- | src/volume-control-pulse.vala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 3d4d113..d3e93c5 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -44,6 +44,7 @@ public class VolumeControlPulse : VolumeControl private bool _is_playing = false; private VolumeControl.Volume _volume = new VolumeControl.Volume(); private double _mic_volume = 0.0; + private Settings _settings = new Settings ("com.canonical.indicator.sound"); /* Used by the pulseaudio stream restore extension */ private DBusConnection _pconn; @@ -95,7 +96,14 @@ public class VolumeControlPulse : VolumeControl /** true when high volume warnings should be shown */ public override bool high_volume { get { - return this._volume.volume > 0.75 && _active_port_headphone && stream == "multimedia"; + if (!_active_port_headphone) { + return false; + } + if (stream != "multimedia") { + return false; + } + var high_volume_level = this._settings.get_double("high-volume-level"); + return this._volume.volume > high_volume_level; } } |