aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-29 16:15:01 -0600
committercharles kerr <charlesk@canonical.com>2015-12-29 16:15:01 -0600
commit637af434c801d6be5909441217b66afd03f0dcc0 (patch)
tree26b20869c89d04cc39c257b06f42e2d1f4fd67c8
parent66f5198878b8a244f8bd967074480821be43c69e (diff)
downloadayatana-indicator-sound-637af434c801d6be5909441217b66afd03f0dcc0.tar.gz
ayatana-indicator-sound-637af434c801d6be5909441217b66afd03f0dcc0.tar.bz2
ayatana-indicator-sound-637af434c801d6be5909441217b66afd03f0dcc0.zip
tidy up vol-warning-pulse's override methods
-rw-r--r--src/volume-warning-pulse.vala32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/volume-warning-pulse.vala b/src/volume-warning-pulse.vala
index 09b96d1..5b6b632 100644
--- a/src/volume-warning-pulse.vala
+++ b/src/volume-warning-pulse.vala
@@ -39,9 +39,22 @@ public class VolumeWarningPulse : VolumeWarning
}
protected override void sound_system_set_multimedia_volume (PulseAudio.Volume volume) {
- pulse_set_sink_volume(volume);
+ var index = _warning_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);
+
+ unowned CVolume cvol = CVolume ();
+ cvol.set (_multimedia_cvolume.channels, volume);
+ GLib.message ("setting multimedia volume to %s", cvol.to_string());
+ _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
***/
@@ -256,21 +269,4 @@ public class VolumeWarningPulse : VolumeWarning
if (_pulse_context.connect (server_string, Context.Flags.NOFAIL, null) < 0)
GLib.warning ("pa_context_connect() failed: %s\n", PulseAudio.strerror(_pulse_context.errno()));
}
-
- void pulse_set_sink_volume (PulseAudio.Volume volume) {
- var index = _warning_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);
-
- unowned CVolume cvol = CVolume ();
- cvol.set (_multimedia_cvolume.channels, volume);
- GLib.message ("setting multimedia volume to %s", cvol.to_string());
- _pulse_context.set_sink_volume_by_index (index, cvol);
- }
-
- protected override void preshow () {
- _warning_sink_index = _multimedia_sink_index;
- }
}