aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-29 12:02:14 -0600
committercharles kerr <charlesk@canonical.com>2015-12-29 12:02:14 -0600
commitf2fc1297ac47b5885ba3b875b9a4e188f12d68a2 (patch)
tree667e964e3659b6fcfa7fb3cdee6a3a9641f07c4a
parent64a358c9121164906e71d3c5441fc5f8453bf45e (diff)
downloadayatana-indicator-sound-f2fc1297ac47b5885ba3b875b9a4e188f12d68a2.tar.gz
ayatana-indicator-sound-f2fc1297ac47b5885ba3b875b9a4e188f12d68a2.tar.bz2
ayatana-indicator-sound-f2fc1297ac47b5885ba3b875b9a4e188f12d68a2.zip
fix oops in last commit
-rw-r--r--src/volume-warning-pulse.vala25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/volume-warning-pulse.vala b/src/volume-warning-pulse.vala
index 9dabfc1..9be2359 100644
--- a/src/volume-warning-pulse.vala
+++ b/src/volume-warning-pulse.vala
@@ -68,10 +68,11 @@ public class VolumeWarningPulse : VolumeWarning
private void update_multimedia_volume()
{
- GLib.return_if_fail(_pulse_context != null;
+ GLib.return_if_fail(_pulse_context != null);
GLib.return_if_fail(_multimedia_sink_index != PulseAudio.INVALID_INDEX);
GLib.message("updating multimedia volume");
+
_pulse_context.get_sink_info_by_index(_multimedia_sink_index, (c,i) => {
GLib.return_if_fail(i != null);
_multimedia_cvolume = i.volume;
@@ -79,6 +80,21 @@ public class VolumeWarningPulse : VolumeWarning
});
}
+ private void set_multimedia_sink_index(uint32 index)
+ {
+ if (index == PulseAudio.INVALID_INDEX)
+ {
+ _multimedia_sink_index = PulseAudio.INVALID_INDEX;
+ multimedia_volume = PulseAudio.Volume.INVALID;
+ }
+ else if (_multimedia_sink_index != index)
+ {
+ _multimedia_sink_index = index;
+ multimedia_volume = PulseAudio.Volume.INVALID;
+ update_multimedia_volume();
+ }
+ }
+
private void on_sink_input_info (Context c, SinkInputInfo? i, int eol)
{
if (i == null)
@@ -86,16 +102,13 @@ public class VolumeWarningPulse : VolumeWarning
if (is_active_multimedia(i)) {
GLib.message("on_sink_input_info() setting multimedia sink input index to %d, sink index to %d", (int)i.index, (int)i.sink);
- _multimedia_sink_index = i.sink;
_multimedia_sink_input_index = i.index;
- multimedia_volume = PulseAudio.Volume.INVALID; // don't let high-volume get set to 'true' until multimedia_volume is updated
- update_multimedia_volume();
+ set_multimedia_sink_index(i.sink);
multimedia_active = true;
}
else if (i.index == _multimedia_sink_input_index) {
- _multimedia_sink_index = PulseAudio.INVALID_INDEX;
_multimedia_sink_input_index = PulseAudio.INVALID_INDEX;
- multimedia_volume = PulseAudio.Volume.INVALID;
+ set_multimedia_sink_index(PulseAudio.INVALID_INDEX);
multimedia_active = false;
}
}