diff options
author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-01-05 15:08:24 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2016-01-05 15:08:24 +0000 |
commit | de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4 (patch) | |
tree | b0b4a1fa061be766576e663ac67c63fd2b445563 /src/volume-control-pulse.vala | |
parent | e1feb61a02a1353b42fcd85ced8e0489c711a451 (diff) | |
parent | 6f4f8c2b9caee08499a3a9ee3fd434c2b6a0f3ca (diff) | |
download | ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.tar.gz ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.tar.bz2 ayatana-indicator-sound-de52ce976216ffb25bfb2c3ff3729b6fcf2ec9f4.zip |
Adds an action to signal the UI to sync the current volume when we are waiting for the user to confirm or reject the high volume notification. Fixes: #1512798, #1520548
Approved by: PS Jenkins bot, Charles Kerr, Nick Dedekind
Diffstat (limited to 'src/volume-control-pulse.vala')
-rw-r--r-- | src/volume-control-pulse.vala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 66b6ba4..4bd3076 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -42,6 +42,7 @@ public class VolumeControlPulse : VolumeControl private PulseAudio.Context context; private bool _mute = true; private bool _is_playing = false; + private bool _ignore_warning_this_time = false; private VolumeControl.Volume _volume = new VolumeControl.Volume(); private double _mic_volume = 0.0; private Settings _settings = new Settings ("com.canonical.indicator.sound"); @@ -344,6 +345,10 @@ public class VolumeControlPulse : VolumeControl var vol = new VolumeControl.Volume(); vol.volume = volume_to_double (lvolume); vol.reason = VolumeControl.VolumeReasons.PULSE_CHANGE; + // Ignore changes from PULSE to avoid issues with + // some apps that change the volume in the sink + // We only take into account volume changes from the user + this._ignore_warning_this_time = true; this.volume = vol; } } @@ -388,6 +393,10 @@ public class VolumeControlPulse : VolumeControl var vol = new VolumeControl.Volume(); vol.volume = volume_to_double (volume); vol.reason = VolumeControl.VolumeReasons.VOLUME_STREAM_CHANGE; + // Ignore changes from PULSE to avoid issues with + // some apps that change the volume in the sink + // We only take into account volume changes from the user + this._ignore_warning_this_time = true; this.volume = vol; } catch (GLib.Error e) { warning ("unable to get volume for active role %s (%s)", sink_input_objp, e.message); @@ -741,6 +750,17 @@ public class VolumeControlPulse : VolumeControl private bool _warning_volume_enabled; private double _warning_volume_norms; /* 1.0 == PA_VOLUME_NORM */ private bool _high_volume = false; + public override bool ignore_high_volume { + get { + if (_ignore_warning_this_time) { + warning("Ignore"); + _ignore_warning_this_time = false; + return true; + } + return false; + } + set { } + } public override bool high_volume { get { return this._high_volume; } private set { this._high_volume = value; } |