diff options
author | Ted Gould <ted@gould.cx> | 2014-02-12 16:47:26 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-02-12 16:47:26 -0600 |
commit | 2d9d89bb932174f6b54e6ba6586deafe511a685b (patch) | |
tree | 0ff9f58d4237b9e5a1f4673cdb48e22aa248cd13 /src | |
parent | 3ddbdeeaab92406fc9fc67e5925368f53b45d592 (diff) | |
download | ayatana-indicator-sound-2d9d89bb932174f6b54e6ba6586deafe511a685b.tar.gz ayatana-indicator-sound-2d9d89bb932174f6b54e6ba6586deafe511a685b.tar.bz2 ayatana-indicator-sound-2d9d89bb932174f6b54e6ba6586deafe511a685b.zip |
Putting an abstract MediaPlayerList class in the middle of the Mpris implementation
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/media-player-list-mpris.vala (renamed from src/media-player-list.vala) | 19 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d58afb..3efe14e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,6 +63,12 @@ vala_add(indicator-sound-service media-player-list.vala DEPENDS media-player +) +vala_add(indicator-sound-service + media-player-list-mpris.vala + DEPENDS + media-player-list + media-player media-player-mpris mpris2-interfaces ) diff --git a/src/media-player-list.vala b/src/media-player-list-mpris.vala index 87ca1f0..0ed3c72 100644 --- a/src/media-player-list.vala +++ b/src/media-player-list-mpris.vala @@ -21,23 +21,23 @@ * MediaPlayerList is a list of media players that should appear in the sound menu. Its main responsibility is * to listen for MPRIS players on the bus and attach them to the corresponding %Player objects. */ -public class MediaPlayerList { +public class MediaPlayerListMpris : MediaPlayerList { - public MediaPlayerList () { + public MediaPlayerListMpris () { this._players = new HashTable<string, MediaPlayerMpris> (str_hash, str_equal); BusWatcher.watch_namespace (BusType.SESSION, "org.mpris.MediaPlayer2", this.player_appeared, this.player_disappeared); } /* only valid while the list is not changed */ - public class Iterator { + public class Iterator : MediaPlayerList.Iterator { HashTableIter<string, MediaPlayerMpris> iter; - public Iterator (MediaPlayerList list) { + public Iterator (MediaPlayerListMpris list) { this.iter = HashTableIter<string, MediaPlayerMpris> (list._players); } - public MediaPlayer? next_value () { + public override MediaPlayer? next_value () { MediaPlayerMpris? player; if (this.iter.next (null, out player)) @@ -47,8 +47,8 @@ public class MediaPlayerList { } } - public Iterator iterator () { - return new Iterator (this); + public override MediaPlayerList.Iterator iterator () { + return new Iterator (this) as MediaPlayerList.Iterator; } /** @@ -89,7 +89,7 @@ public class MediaPlayerList { * Synchronizes the player list with @desktop_ids. After this call, this list will only contain the players * in @desktop_ids. Players that were running but are not in @desktop_ids will remain in the list. */ - public void sync (string[] desktop_ids) { + public override void sync (string[] desktop_ids) { /* hash desktop_ids for faster lookup */ var hash = new HashTable<string, unowned string> (str_hash, str_equal); @@ -107,9 +107,6 @@ public class MediaPlayerList { this.insert (id); } - public signal void player_added (MediaPlayer player); - public signal void player_removed (MediaPlayer player); - HashTable<string, MediaPlayerMpris> _players; void player_appeared (DBusConnection connection, string name, string owner) { |