From b03499a823ded3f262aa065ee24b3e30a4cf0ca3 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 27 Jan 2011 17:08:08 -0600 Subject: playlist fetching is now async and some compilation warnings sorted --- src/mpris2-controller.vala | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/mpris2-controller.vala') 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; -- cgit v1.2.3