diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-01-27 17:08:08 -0600 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-01-27 17:08:08 -0600 |
commit | b03499a823ded3f262aa065ee24b3e30a4cf0ca3 (patch) | |
tree | 53e523624e195a02084e78153638aa2e1df1fe73 | |
parent | 4e0d98ea31ff315c03d2a297af0743cd92acfedf (diff) | |
download | ayatana-indicator-sound-b03499a823ded3f262aa065ee24b3e30a4cf0ca3.tar.gz ayatana-indicator-sound-b03499a823ded3f262aa065ee24b3e30a4cf0ca3.tar.bz2 ayatana-indicator-sound-b03499a823ded3f262aa065ee24b3e30a4cf0ca3.zip |
playlist fetching is now async and some compilation warnings sorted
-rw-r--r-- | src/mpris2-controller.vala | 25 | ||||
-rw-r--r-- | src/mpris2-interfaces.vala | 8 | ||||
-rw-r--r-- | src/music-player-bridge.vala | 4 | ||||
-rw-r--r-- | src/player-controller.vala | 14 |
4 files changed, 23 insertions, 28 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index a7b3de1..03571e6 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -95,12 +95,12 @@ public class Mpris2Controller : GLib.Object } Variant? playlist_count_v = changed_properties.lookup("PlaylistCount"); if ( playlist_count_v != null && this.owner.use_playlists == true ){ - this.fetch_playlists(); + this.fetch_playlists.begin(); this.fetch_active_playlist(); } Variant? playlist_orderings_v = changed_properties.lookup("Orderings"); if ( playlist_orderings_v != null && this.owner.use_playlists == true ){ - this.fetch_playlists(); + this.fetch_playlists.begin(); this.fetch_active_playlist(); } } @@ -156,7 +156,7 @@ public class Mpris2Controller : GLib.Object MetadataMenuitem.attributes_format()); if ( this.owner.use_playlists == true ){ - this.fetch_playlists(); + this.fetch_playlists.begin(); this.fetch_active_playlist(); } } @@ -188,12 +188,21 @@ public class Mpris2Controller : GLib.Object } } - public void fetch_playlists() + public async void fetch_playlists() { - PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0, - 10, - "Alphabetical", - false); + PlaylistDetails[] current_playlists = null; + + try{ + current_playlists = yield this.playlists.GetPlaylists (0, + 10, + "Alphabetical", + false); + } + catch (IOError e){ + debug("Could not fetch playlists because %s", e.message); + return; + } + if( current_playlists != null ){ debug( "Size of the playlist array = %i", current_playlists.length ); PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala index 9d0b8c9..0a0909f 100644 --- a/src/mpris2-interfaces.vala +++ b/src/mpris2-interfaces.vala @@ -68,8 +68,8 @@ public interface MprisPlaylists : Object { //methods public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError; - public abstract PlaylistDetails[] GetPlaylists ( uint32 index, - uint32 max_count, - string order, - bool reverse_order ) throws IOError; + public abstract async PlaylistDetails[] GetPlaylists ( uint32 index, + uint32 max_count, + string order, + bool reverse_order ) throws IOError; }
\ No newline at end of file diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 7587684..c167e08 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -141,8 +141,8 @@ public class MusicPlayerBridge : GLib.Object this.root_menu = menu; this.try_to_add_inactive_familiar_clients(); this.watcher = new Mpris2Watcher (); - this.watcher.client_appeared += this.client_has_become_available; - this.watcher.client_disappeared += this.client_has_vanished; + this.watcher.client_appeared.connect (this.client_has_become_available); + this.watcher.client_disappeared.connect (this.client_has_vanished); } private static AppInfo? create_app_info ( string desktop ) diff --git a/src/player-controller.vala b/src/player-controller.vala index adefb65..024b88b 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -189,20 +189,6 @@ public class PlayerController : GLib.Object } } - private static string format_player_name(owned string app_info_name) - { - string result = app_info_name.down().strip(); - var tokens = result.split(" "); - if(tokens.length > 1){ - result = tokens[0]; - } - if(result.length > 1){ - result = result.up(1).concat(result.slice(1, result.length)); - } - debug("PlayerController->format_player_name - : %s", result); - return result; - } - private void determine_state() { if(this.mpris_bridge.connected() == true){ |