aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control-pulse.vala
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-01-05 13:13:41 -0600
committerCharles Kerr <charles.kerr@canonical.com>2016-01-05 13:13:41 -0600
commit7dcc73303a60aba6c636408fa22ccaed07baf64c (patch)
treeb0b4a1fa061be766576e663ac67c63fd2b445563 /src/volume-control-pulse.vala
parent3c528a11f39af91d2856aeac606fdaf8a6c6b673 (diff)
parent6f4f8c2b9caee08499a3a9ee3fd434c2b6a0f3ca (diff)
downloadayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.tar.gz
ayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.tar.bz2
ayatana-indicator-sound-7dcc73303a60aba6c636408fa22ccaed07baf64c.zip
adding lp:~xavi-garcia-mena/indicator-sound/action-sync-volume
Diffstat (limited to 'src/volume-control-pulse.vala')
-rw-r--r--src/volume-control-pulse.vala20
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; }