diff options
Diffstat (limited to 'src/service.vala')
-rw-r--r-- | src/service.vala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala index 1590844..d966de9 100644 --- a/src/service.vala +++ b/src/service.vala @@ -7,6 +7,7 @@ public class IndicatorSound.Service { this.players = new MediaPlayerList (); this.players.player_added.connect (this.player_added); + this.players.player_removed.connect (this.player_removed); this.actions = new SimpleActionGroup (); this.actions.add_entries (action_entries, this); @@ -158,4 +159,18 @@ public class IndicatorSound.Service { eventually_update_player_actions (); player.notify.connect (this.eventually_update_player_actions); } + + void player_removed (MediaPlayer player) { + this.actions.remove (player.id); + + int n = this.menu.get_n_items (); + for (int i = 0; i < n; i++) { + string action; + this.menu.get_item_attribute (i, "action", "s", out action); + if (action == player.id) { + this.menu.remove (i); + break; + } + } + } } |