From 2e7a68b055d79f90c5626540a266b9c2ba4637c2 Mon Sep 17 00:00:00 2001 From: charles kerr Date: Sun, 20 Dec 2015 12:05:44 -0600 Subject: refactor 'stop_reconnect_timer' into its own function in volume-warning --- src/volume-warning.vala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/volume-warning.vala b/src/volume-warning.vala index b5e1c1b..177ce9c 100644 --- a/src/volume-warning.vala +++ b/src/volume-warning.vala @@ -36,8 +36,6 @@ public class VolumeWarning : Object /* this is static to ensure it being freed after @context (loop does not have ref counting) */ private static PulseAudio.GLibMainLoop loop; - private uint _reconnect_timer = 0; - private PulseAudio.Context context; private bool _ignore_warning_this_time = false; private VolumeControl.Volume _volume = new VolumeControl.Volume(); @@ -109,10 +107,7 @@ public class VolumeWarning : Object private void stop_all_timers() { - if (_reconnect_timer != 0) { - Source.remove (_reconnect_timer); - _reconnect_timer = 0; - } + stop_reconnect_timer(); stop_high_volume_approved_timer(); stop_clamp_to_loud_timeout(); } @@ -362,6 +357,8 @@ public class VolumeWarning : Object private bool _connected_to_pulse = false; + private uint _reconnect_timer = 0; + private void context_state_callback (Context c) { switch (c.get_state ()) { @@ -393,6 +390,14 @@ public class VolumeWarning : Object } } + private void stop_reconnect_timer() + { + if (_reconnect_timer != 0) { + Source.remove (_reconnect_timer); + _reconnect_timer = 0; + } + } + bool reconnect_timeout () { _reconnect_timer = 0; -- cgit v1.2.3