diff options
author | Ted Gould <ted@gould.cx> | 2014-02-11 15:34:24 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-02-11 15:34:24 -0600 |
commit | eb1dc0ff1ae607763635ad220b7b914ec9235417 (patch) | |
tree | 10f334e1d1d66756f9e167ab1d23a897f6f6c6e3 /src | |
parent | a38509fd4b0023456c48fcb014f6ba0063b16f23 (diff) | |
download | ayatana-indicator-sound-eb1dc0ff1ae607763635ad220b7b914ec9235417.tar.gz ayatana-indicator-sound-eb1dc0ff1ae607763635ad220b7b914ec9235417.tar.bz2 ayatana-indicator-sound-eb1dc0ff1ae607763635ad220b7b914ec9235417.zip |
Update the player based on which one is running
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/accounts-service-user.vala | 2 | ||||
-rw-r--r-- | src/service.vala | 12 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ff68ca..3ee6a65 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,6 +79,9 @@ vala_add(indicator-sound-service ) vala_add(indicator-sound-service accounts-service-user.vala + DEPENDS + media-player + mpris2-interfaces ) vala_finish(indicator-sound-service diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 7639b2e..33fb6e9 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -22,6 +22,8 @@ public class AccountsServiceUser : Object { Act.UserManager accounts_manager = Act.UserManager.get_default(); Act.User? user = null; + public MediaPlayer? player = null; + public AccountsServiceUser () { user = accounts_manager.get_user(GLib.Environment.get_user_name()); 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; |