diff options
author | Ted Gould <ted@gould.cx> | 2014-03-24 15:02:45 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-03-24 15:02:45 +0000 |
commit | 3cd9a899d19e4ece80844fe300a5d79ccbcbc2b6 (patch) | |
tree | 223b54f0dc2ab38d6edbe65a3bd778cbc4219739 /src/service.vala | |
parent | 7a312f2f03a0bc0c52ce8a6f834849d70233cf61 (diff) | |
parent | d114c16f06803c8619d652b3a9dda31da3f1699a (diff) | |
download | ayatana-indicator-sound-3cd9a899d19e4ece80844fe300a5d79ccbcbc2b6.tar.gz ayatana-indicator-sound-3cd9a899d19e4ece80844fe300a5d79ccbcbc2b6.tar.bz2 ayatana-indicator-sound-3cd9a899d19e4ece80844fe300a5d79ccbcbc2b6.zip |
Create players on the phone greeter based on the accounts service data
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/service.vala b/src/service.vala index f6c5f01..0e32bfe 100644 --- a/src/service.vala +++ b/src/service.vala @@ -18,7 +18,7 @@ */ public class IndicatorSound.Service: Object { - public Service () { + public Service (MediaPlayerList playerlist) { this.settings = new Settings ("com.canonical.indicator.sound"); this.sharedsettings = new Settings ("com.ubuntu.sound"); @@ -27,7 +27,7 @@ public class IndicatorSound.Service: Object { this.volume_control = new VolumeControl (); - this.players = new MediaPlayerList (); + this.players = playerlist; this.players.player_added.connect (this.player_added); this.players.player_removed.connect (this.player_removed); @@ -39,6 +39,7 @@ public class IndicatorSound.Service: Object { this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal); this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS)); + this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE)); this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); @@ -441,15 +442,15 @@ public class IndicatorSound.Service: Object { this.menus.@foreach ( (profile, menu) => menu.add_player (player)); SimpleAction action = new SimpleAction.stateful (player.id, null, this.action_state_for_player (player)); + action.set_enabled (player.can_raise); action.activate.connect ( () => { player.activate (); }); this.actions.add_action (action); var play_action = new SimpleAction.stateful ("play." + player.id, null, player.state); play_action.activate.connect ( () => player.play_pause () ); this.actions.add_action (play_action); - player.notify.connect ( (object, pspec) => { - if (pspec.name == "state") - play_action.set_state (player.state); + player.notify["state"].connect ( (object, pspec) => { + play_action.set_state (player.state); }); var next_action = new SimpleAction ("next." + player.id, null); @@ -476,6 +477,8 @@ public class IndicatorSound.Service: Object { this.actions.remove_action ("previous." + player.id); this.actions.remove_action ("play-playlist." + player.id); + player.notify.disconnect (this.eventually_update_player_actions); + this.menus.@foreach ( (profile, menu) => menu.remove_player (player)); this.update_preferred_players (); |