diff options
author | Conor Curran <conor.curran@canonical.com> | 2012-03-19 18:35:30 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2012-03-19 18:35:30 +0000 |
commit | 90c440a05e9d0f45583719c921e2fbd2d4eefaa7 (patch) | |
tree | 6dbdc57d1fda0336d3717a79c697ecdf1a3074af /src/mpris2-controller.vala | |
parent | 2e894a27c5563346d54bbce25754d6e850747d63 (diff) | |
download | ayatana-indicator-sound-90c440a05e9d0f45583719c921e2fbd2d4eefaa7.tar.gz ayatana-indicator-sound-90c440a05e9d0f45583719c921e2fbd2d4eefaa7.tar.bz2 ayatana-indicator-sound-90c440a05e9d0f45583719c921e2fbd2d4eefaa7.zip |
more defensive approach to dealing with the playlistdetails struct specifically the activeplaylist prop, tweaked player label padding by 1 pixel
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r-- | src/mpris2-controller.vala | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 0fa7b6c..9cd02c4 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -92,7 +92,7 @@ public class Mpris2Controller : GLib.Object } Variant? playlist_v = changed_properties.lookup("ActivePlaylist"); if ( playlist_v != null && this.owner.use_playlists == true ){ - Timeout.add (300, this.fetch_active_playlist); + Timeout.add (500, this.fetch_active_playlist); } Variant? playlist_count_v = changed_properties.lookup("PlaylistCount"); if ( playlist_count_v != null && this.owner.use_playlists == true ){ @@ -240,14 +240,30 @@ public class Mpris2Controller : GLib.Object playlists_item.update(current_playlists); } else{ - warning(" Playlists are on but its returning no current_playlists" ); + warning(" Playlists are on but %s is returning no current_playlists ?", + this.owner.app_info.get_name()); this.owner.use_playlists = false; } } + private bool validate_playlists_details() + { + if (this.playlists.ActivePlaylist.valid == false){ + return false; + } + if (this.playlists.ActivePlaylist.details == null){ + return false; + } + if (this.playlists.ActivePlaylist.details.path == null || + this.playlists.ActivePlaylist.details.name == null){ + return false; + } + return true; + } + private bool fetch_active_playlist() { - if (this.playlists.ActivePlaylist.valid == false){ + if (this.validate_playlists_details() == false){ return false; } PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; |