diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-04-03 22:20:18 -0400 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-04-03 22:20:18 -0400 |
commit | 9f030ed47653f96bf88a6f7b746555b2581701cf (patch) | |
tree | a8354eb937a834d6087df39459f47917d25dc9f6 | |
parent | e341f4f758fc704ecbc26cd30b96782afa5d54e6 (diff) | |
download | ayatana-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
-rw-r--r-- | src/media-player-list.vala | 22 |
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); } /** |