aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-04-04 16:59:01 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-04-04 16:59:01 +0200
commit4138cbeb33798018034dff8c0a83ea70850d912f (patch)
tree180e08fc52bbbbf527ec2c7c21f503e69613a8a2
parent6fabe993476761f2bb1852c3380ca2e5be1e0ac4 (diff)
downloadayatana-indicator-sound-4138cbeb33798018034dff8c0a83ea70850d912f.tar.gz
ayatana-indicator-sound-4138cbeb33798018034dff8c0a83ea70850d912f.tar.bz2
ayatana-indicator-sound-4138cbeb33798018034dff8c0a83ea70850d912f.zip
Really sync player list with preferred-media-players setting
Writing back to the key was missing.
-rw-r--r--src/service.vala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala
index a291f2d..cf0f1c2 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -165,6 +165,13 @@ public class IndicatorSound.Service {
this.player_action_update_id = Idle.add (this.update_player_actions);
}
+ void update_preferred_players () {
+ var builder = new VariantBuilder (VariantType.STRING_ARRAY);
+ foreach (var player in this.players)
+ builder.add ("s", player.id);
+ this.settings.set_value ("preferred-media-players", builder.end ());
+ }
+
void player_added (MediaPlayer player) {
var item = new MenuItem (player.name, player.id);
item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player");
@@ -175,6 +182,8 @@ public class IndicatorSound.Service {
this.actions.insert (action);
player.notify.connect (this.eventually_update_player_actions);
+
+ this.update_preferred_players ();
}
void player_removed (MediaPlayer player) {
@@ -189,5 +198,7 @@ public class IndicatorSound.Service {
break;
}
}
+
+ this.update_preferred_players ();
}
}