aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-12-09 11:36:33 +0000
committerConor Curran <conor.curran@canonical.com>2010-12-09 11:36:33 +0000
commita964487e2fcd11946b5f95ab36b20cbd1bea4a57 (patch)
treea294b7afb203aff91b163d533522e36280d20dfd /src/mpris2-controller.vala
parent0649b09ccf86ea2a158fb24061fc3a142e02f462 (diff)
downloadayatana-indicator-sound-a964487e2fcd11946b5f95ab36b20cbd1bea4a57.tar.gz
ayatana-indicator-sound-a964487e2fcd11946b5f95ab36b20cbd1bea4a57.tar.bz2
ayatana-indicator-sound-a964487e2fcd11946b5f95ab36b20cbd1bea4a57.zip
moving towards testing proposed playlists api
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 59e3122..2c19606 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -21,8 +21,8 @@ using Dbusmenu;
[DBus (name = "org.freedesktop.DBus.Properties")]
public interface FreeDesktopProperties : Object{
- public signal void PropertiesChanged(string source, HashTable<string, Variant?> changed_properties,
- string[] invalid);
+ public signal void PropertiesChanged (string source, HashTable<string, Variant?> changed_properties,
+ string[] invalid );
}
/*
@@ -34,13 +34,14 @@ public class Mpris2Controller : GLib.Object
public static const string root_interface = "org.mpris.MediaPlayer2" ;
public MprisRoot mpris2_root {get; construct;}
public MprisPlayer player {get; construct;}
+ public MprisPlaylists playlists {get; construct;}
public FreeDesktopProperties properties_interface {get; construct;}
public PlayerController owner {get; construct;}
-
+
public Mpris2Controller(PlayerController ctrl)
{
- GLib.Object(owner: ctrl);
+ GLib.Object(owner: ctrl);
}
construct{
@@ -51,6 +52,9 @@ public class Mpris2Controller : GLib.Object
this.player = Bus.get_proxy_sync ( BusType.SESSION,
root_interface.concat(".").concat(this.owner.mpris_name),
"/org/mpris/MediaPlayer2" );
+ this.playlists = Bus.get_proxy_sync ( BusType.SESSION,
+ root_interface.concat(".").concat(this.owner.mpris_name),
+ "/org/mpris/MediaPlayer2" );
this.properties_interface = Bus.get_proxy_sync ( BusType.SESSION,
"org.freedesktop.Properties.PropertiesChanged",
@@ -127,12 +131,14 @@ public class Mpris2Controller : GLib.Object
GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
MetadataMenuitem.attributes_format());
+ this.fetch_playlists();
}
public void transport_update(TransportMenuitem.action command)
{
debug("transport_event input = %i", (int)command);
if(command == TransportMenuitem.action.PLAY_PAUSE){
+ this.fetch_playlists();
this.player.PlayPause.begin();
}
else if(command == TransportMenuitem.action.PREVIOUS){
@@ -143,6 +149,26 @@ public class Mpris2Controller : GLib.Object
}
}
+ public void fetch_playlists()
+ {
+ if (this.playlists == null){
+ warning("Playlists object is null");
+ return;
+ }
+ PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0, 10, "Alphabetical", false);
+ 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;
+ playlists_item.update(current_playlists);
+ /*foreach(PlaylistDetails detail in current_playlists){
+ debug( "Playlist Name = %s", detail.name);
+ debug( "Playlist path = %s", detail.path);
+ debug( "Playlist icon path = %s", detail.icon_path);
+ debug(" \n \n \n \n \n ");
+ }*/
+ }
+ }
+
public bool connected()
{
return (this.player != null && this.mpris2_root != null);