aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-04-03 22:43:37 -0400
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-04-03 22:43:37 -0400
commit83c37bd14bcca1b2774bdb9f73c3742da65a65a3 (patch)
tree260383dbaa59742a4d48dabc7bf3d9fd88eb281e /src
parent7519d2eb92c06b5a88d79a9a8f28b53c33b96c3b (diff)
downloadayatana-indicator-sound-83c37bd14bcca1b2774bdb9f73c3742da65a65a3.tar.gz
ayatana-indicator-sound-83c37bd14bcca1b2774bdb9f73c3742da65a65a3.tar.bz2
ayatana-indicator-sound-83c37bd14bcca1b2774bdb9f73c3742da65a65a3.zip
Remove players when settings key changes
Diffstat (limited to 'src')
-rw-r--r--src/service.vala15
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;
+ }
+ }
+ }
}