aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 7b512a3..c43f5fe 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -50,9 +50,11 @@ public class Mpris2Controller : GLib.Object
this.player = Bus.get_proxy_sync ( BusType.SESSION,
this.owner.dbus_name,
"/org/mpris/MediaPlayer2" );
- this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
- this.owner.dbus_name,
- "/org/mpris/MediaPlayer2" );
+ if ( this.owner.use_playlists == true ){
+ this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
+ this.owner.dbus_name,
+ "/org/mpris/MediaPlayer2" );
+ }
this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
"org.freedesktop.Properties.PropertiesChanged",
"/org/mpris/MediaPlayer2" );
@@ -94,18 +96,10 @@ public class Mpris2Controller : GLib.Object
metadata.populated(MetadataMenuitem.attributes_format()));
}
Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
- if ( playlist_v != null && this.playlists_support_exist() ){
+ if ( playlist_v != null && this.owner.use_playlists == true ){
this.fetch_active_playlist();
}
}
-
- public bool playlists_support_exist()
- {
- if (this.playlists == null) return false;
- uint32? count = this.playlists.PlaylistCount;
- if ( count == null || count <= 0 ) return false;
- return true;
- }
private bool ensure_correct_playback_status(){
debug("TEST playback status = %s", this.player.PlaybackStatus);
@@ -153,11 +147,11 @@ public class Mpris2Controller : GLib.Object
this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
MetadataMenuitem.attributes_format());
- /*if ( playlists_support_exist() == true ){
+ if ( this.owner.use_playlists == true ){
debug ("it thinks that there is a valid playlist interface");
this.fetch_playlists();
this.fetch_active_playlist();
- }*/
+ }
}
public void transport_update(TransportMenuitem.action command)
@@ -185,6 +179,10 @@ public class Mpris2Controller : GLib.Object
PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
playlists_item.update(current_playlists);
}
+ else{
+ warning(" Playlists are on but its returning no current_playlists" );
+ this.owner.use_playlists = false;
+ }
return;
}
@@ -202,7 +200,7 @@ public class Mpris2Controller : GLib.Object
{
return (this.player != null && this.mpris2_root != null);
}
-
+
public void expose()
{
if(this.connected() == true){
@@ -212,15 +210,11 @@ public class Mpris2Controller : GLib.Object
public void activate_playlist (ObjectPath path)
{
- if ( playlists_support_exist() == false ){
- return;
- }
-
try{
this.playlists.ActivatePlaylist.begin(path);
}
catch(IOError e){
debug("Could not activate playlist %s because %s", (string)path, e.message);
}
- }
+ }
} \ No newline at end of file