diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2012-03-30 10:45:03 -0400 |
---|---|---|
committer | Package Import Robot <package-import@ubuntu.com> | 2012-03-30 10:45:03 -0400 |
commit | 01d561bf282f03825ca22533f66d72ba44fd85a9 (patch) | |
tree | edee2e0c9543f22f13bf3baed30c9f6096c170a9 /src/mpris2-controller.vala | |
parent | 2e2e1a5d8571b6a75de63ad771be172251a874a3 (diff) | |
parent | 31b5a5a6508535ed1af86919c79d75571f1a65ef (diff) | |
download | ayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.tar.gz ayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.tar.bz2 ayatana-indicator-sound-01d561bf282f03825ca22533f66d72ba44fd85a9.zip |
Import upstream version 0.8.5.0
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r-- | src/mpris2-controller.vala | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 0fa7b6c..2cc8d12 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,33 @@ 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 == null){ + return false; + } + 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; |