aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala13
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 ();