aboutsummaryrefslogtreecommitdiff
path: root/src/volume-warning-pulse.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-29 16:27:32 -0600
committercharles kerr <charlesk@canonical.com>2015-12-29 16:27:32 -0600
commit7a64a24d4d9a8749b4cccfc6e50d8dc2ce94dc02 (patch)
tree111332428d907879e3a2986feeed35f772150522 /src/volume-warning-pulse.vala
parent4887db8e4409fa6e83c4ab2b1d5e5429a6956980 (diff)
downloadayatana-indicator-sound-7a64a24d4d9a8749b4cccfc6e50d8dc2ce94dc02.tar.gz
ayatana-indicator-sound-7a64a24d4d9a8749b4cccfc6e50d8dc2ce94dc02.tar.bz2
ayatana-indicator-sound-7a64a24d4d9a8749b4cccfc6e50d8dc2ce94dc02.zip
add docs/comments to vol-warning-pulse
Diffstat (limited to 'src/volume-warning-pulse.vala')
-rw-r--r--src/volume-warning-pulse.vala25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/volume-warning-pulse.vala b/src/volume-warning-pulse.vala
index e6e6f21..e7b7585 100644
--- a/src/volume-warning-pulse.vala
+++ b/src/volume-warning-pulse.vala
@@ -21,6 +21,11 @@
using PulseAudio;
+/**
+ * A VolumeWarning that uses PulseAudio to
+ * (a) implement sound_system_set_multimedia_volume() and
+ * (b) keep the multimedia_active and multimedia_volume properties up-to-date
+ */
public class VolumeWarningPulse : VolumeWarning
{
public VolumeWarningPulse (IndicatorSound.Options options,
@@ -38,12 +43,18 @@ public class VolumeWarningPulse : VolumeWarning
pulse_disconnect();
}
+ protected override void preshow () {
+ /* showing the dialog can change the sink input index (bug #1484589)
+ * so cache it here for later use in sound_system_set_multimedia_volume() */
+ _target_sink_index = _multimedia_sink_index;
+ }
+
protected override void sound_system_set_multimedia_volume (PulseAudio.Volume volume) {
- var index = _warning_sink_index;
+ var index = _target_sink_index;
- GLib.return_if_fail(_pulse_context != null);
- GLib.return_if_fail(index != PulseAudio.INVALID_INDEX);
- GLib.return_if_fail(volume != PulseAudio.Volume.INVALID);
+ GLib.return_if_fail (_pulse_context != null);
+ GLib.return_if_fail (index != PulseAudio.INVALID_INDEX);
+ GLib.return_if_fail (volume != PulseAudio.Volume.INVALID);
unowned CVolume cvol = CVolume ();
cvol.set (1, volume);
@@ -51,10 +62,6 @@ public class VolumeWarningPulse : VolumeWarning
_pulse_context.set_sink_volume_by_index (index, cvol);
}
- protected override void preshow () {
- _warning_sink_index = _multimedia_sink_index;
- }
-
/***
**** PulseAudio: Tracking the active multimedia sink input
***/
@@ -68,7 +75,7 @@ public class VolumeWarningPulse : VolumeWarning
private uint soon_interval_msec = 500;
- private uint32 _warning_sink_index = PulseAudio.INVALID_INDEX;
+ private uint32 _target_sink_index = PulseAudio.INVALID_INDEX;
private uint32 _multimedia_sink_index = PulseAudio.INVALID_INDEX;
private uint32 _multimedia_sink_input_index = PulseAudio.INVALID_INDEX;