From eb1dc0ff1ae607763635ad220b7b914ec9235417 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 11 Feb 2014 15:34:24 -0600 Subject: Update the player based on which one is running --- src/service.vala | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/service.vala') diff --git a/src/service.vala b/src/service.vala index b6ed0a5..25f3011 100644 --- a/src/service.vala +++ b/src/service.vala @@ -275,12 +275,24 @@ public class IndicatorSound.Service { } bool update_player_actions () { + bool clear_accounts_player = true; + foreach (var player in this.players) { SimpleAction? action = this.actions.lookup_action (player.id) as SimpleAction; if (action != null) { action.set_state (this.action_state_for_player (player)); action.set_enabled (player.can_raise); } + + /* If we're playing then put that data in accounts service */ + if (player.is_running && accounts_service != null) { + accounts_service.player = player; + clear_accounts_player = false; + } + } + + if (clear_accounts_player && accounts_service != null) { + accounts_service.player = null; } this.player_action_update_id = 0; -- cgit v1.2.3