aboutsummaryrefslogtreecommitdiff
path: root/src/volume-warning.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-20 12:05:44 -0600
committercharles kerr <charlesk@canonical.com>2015-12-20 12:05:44 -0600
commit2e7a68b055d79f90c5626540a266b9c2ba4637c2 (patch)
treeb6b8eb2c372ff00c73e1669502cb23f846ae5fa7 /src/volume-warning.vala
parentd48b473907c9b061c5937b32f34952f3d81ea9b2 (diff)
downloadayatana-indicator-sound-2e7a68b055d79f90c5626540a266b9c2ba4637c2.tar.gz
ayatana-indicator-sound-2e7a68b055d79f90c5626540a266b9c2ba4637c2.tar.bz2
ayatana-indicator-sound-2e7a68b055d79f90c5626540a266b9c2ba4637c2.zip
refactor 'stop_reconnect_timer' into its own function in volume-warning
Diffstat (limited to 'src/volume-warning.vala')
-rw-r--r--src/volume-warning.vala17
1 files changed, 11 insertions, 6 deletions
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;