aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-24 15:55:33 -0600
committerTed Gould <ted@gould.cx>2014-02-24 15:55:33 -0600
commitfaa10b31c7868206156c33fc3bc0b2d6c726e63d (patch)
tree8dae6e71108b45fe8ea8cee0b43e5eb0bbee1056 /src
parenta758202c3799256ddded7ee790744d6fe3c1c4a7 (diff)
downloadayatana-indicator-sound-faa10b31c7868206156c33fc3bc0b2d6c726e63d.tar.gz
ayatana-indicator-sound-faa10b31c7868206156c33fc3bc0b2d6c726e63d.tar.bz2
ayatana-indicator-sound-faa10b31c7868206156c33fc3bc0b2d6c726e63d.zip
Add in the iterator support
Diffstat (limited to 'src')
-rw-r--r--src/media-player-list-greeter.vala24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/media-player-list-greeter.vala b/src/media-player-list-greeter.vala
index c07663a..2488c07 100644
--- a/src/media-player-list-greeter.vala
+++ b/src/media-player-list-greeter.vala
@@ -81,5 +81,29 @@ public class MediaPlayerListGreeter : MediaPlayerList {
}
}
+ /* We need to have an iterator for the interface, but eh, we can
+ only ever have one player for the current user */
+ public class Iterator : MediaPlayerList.Iterator {
+ int i = 0;
+ MediaPlayerListGreeter list;
+ public Iterator (MediaPlayerListGreeter in_list) {
+ list = in_list;
+ }
+
+ public override MediaPlayer? next_value () {
+ MediaPlayer? retval = null;
+
+ if (i == 0) {
+ retval = list.players.lookup(list.selected_user);
+ }
+ i++;
+
+ return retval;
+ }
+ }
+
+ public override MediaPlayerList.Iterator iterator() {
+ return new Iterator(this) as MediaPlayerList.Iterator;
+ }
}