From 0f18af8fd8c22b756436a5d7ff8c93e6d9a489a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Mar 2014 14:26:43 -0500 Subject: Move all the clearing of the player into one place --- src/service.vala | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index 8b83082..bfd4115 100644 --- a/src/service.vala +++ b/src/service.vala @@ -67,11 +67,7 @@ public class IndicatorSound.Service: Object { } void build_accountsservice () { - /* NOTE: This is a bit of a hack to ensure that accounts service doesn't - continue to export the player by keeping a ref in the timer */ - if (this.accounts_service != null) - this.accounts_service.player = null; - + clear_acts_player(); this.accounts_service = null; /* If we're not exporting, don't build anything */ @@ -91,6 +87,13 @@ public class IndicatorSound.Service: Object { this.eventually_update_player_actions(); } + void clear_acts_player () { + /* NOTE: This is a bit of a hack to ensure that accounts service doesn't + continue to export the player by keeping a ref in the timer */ + if (this.accounts_service != null) + this.accounts_service.player = null; + } + public int run () { if (this.loop != null) { warning ("service is already running"); @@ -110,9 +113,7 @@ public class IndicatorSound.Service: Object { this.loop.run (); - /* Ensure we clear the player right after the mainloop quits */ - if (this.accounts_service != null) - this.accounts_service.player = null; + clear_acts_player(); return 0; } @@ -400,9 +401,8 @@ public class IndicatorSound.Service: Object { } } - if (clear_accounts_player && accounts_service != null) { - accounts_service.player = null; - } + if (clear_accounts_player) + clear_acts_player(); this.player_action_update_id = 0; return false; -- cgit v1.2.3