aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-01-27 17:08:08 -0600
committerConor Curran <conor.curran@canonical.com>2011-01-27 17:08:08 -0600
commitb03499a823ded3f262aa065ee24b3e30a4cf0ca3 (patch)
tree53e523624e195a02084e78153638aa2e1df1fe73 /src/mpris2-controller.vala
parent4e0d98ea31ff315c03d2a297af0743cd92acfedf (diff)
downloadayatana-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
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala25
1 files changed, 17 insertions, 8 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;