aboutsummaryrefslogtreecommitdiff
path: root/src/media-player-list.vala
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-04-03 22:20:18 -0400
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-04-03 22:20:18 -0400
commit9f030ed47653f96bf88a6f7b746555b2581701cf (patch)
treea8354eb937a834d6087df39459f47917d25dc9f6 /src/media-player-list.vala
parente341f4f758fc704ecbc26cd30b96782afa5d54e6 (diff)
downloadayatana-indicator-sound-9f030ed47653f96bf88a6f7b746555b2581701cf.tar.gz
ayatana-indicator-sound-9f030ed47653f96bf88a6f7b746555b2581701cf.tar.bz2
ayatana-indicator-sound-9f030ed47653f96bf88a6f7b746555b2581701cf.zip
Make MediaPlayerList iteratable instead of providing the "players" property
Diffstat (limited to 'src/media-player-list.vala')
-rw-r--r--src/media-player-list.vala22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/media-player-list.vala b/src/media-player-list.vala
index 73f21ce..893ec64 100644
--- a/src/media-player-list.vala
+++ b/src/media-player-list.vala
@@ -31,10 +31,26 @@ public class MediaPlayerList {
this.mpris_watcher.client_disappeared.connect (this.player_disappeared);
}
- public List<MediaPlayer> players {
- owned get {
- return this._players.get_values ();
+ /* only valid while the list is not changed */
+ public class Iterator {
+ HashTableIter<string, MediaPlayer> iter;
+
+ public Iterator (MediaPlayerList list) {
+ this.iter = HashTableIter<string, MediaPlayer> (list._players);
}
+
+ public MediaPlayer? next_value () {
+ MediaPlayer? player;
+
+ if (this.iter.next (null, out player))
+ return player;
+ else
+ return null;
+ }
+ }
+
+ public Iterator iterator () {
+ return new Iterator (this);
}
/**