aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-08-13 18:57:00 +0100
committerConor Curran <conor.curran@canonical.com>2010-08-13 18:57:00 +0100
commitf648465adb85a872c97bdb9b9a7d638cb8803049 (patch)
tree0991507fefb5333caeedf5bf9a2b45019773ae82
parenta936550cb2d904f09f712712a38c76779905d3b5 (diff)
downloadayatana-indicator-sound-f648465adb85a872c97bdb9b9a7d638cb8803049.tar.gz
ayatana-indicator-sound-f648465adb85a872c97bdb9b9a7d638cb8803049.tar.bz2
ayatana-indicator-sound-f648465adb85a872c97bdb9b9a7d638cb8803049.zip
player object implemented bar the property signal thing
-rw-r--r--src/mpris2-controller.vala43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index debbd76..fb17bea 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -35,7 +35,6 @@ public interface MprisRoot : Object {
public interface MprisPlayer : Object {
public abstract HashTable<string, Value?> Metadata{owned get; set;}
- public abstract int32 Capabilities{owned get; set;}
public abstract int32 Position{owned get; set;}
public abstract string PlaybackStatus{owned get; set;}
@@ -96,17 +95,19 @@ public class Mpris2Controller : GLib.Object
}
return true;
}
+
+ private int determine_play_state(){
+ string status = this.mpris2_player.PlaybackStatus;
+ if(status == "Playing"){
+ return 0;
+ }
+ return 1;
+ }
public void initial_update()
{
- /*this.mpris2_player.TrackChanged += onTrackChanged;
- this.mpris2_player.StatusChanged += onStatusChanged;
-
- bool r = (bool)this.mpris2_player.Status.Shuffle_State;
- int32 p = (int32)this.mpris2_player.Status.Playback_State;
-
+ int32 p = determine_play_state();
debug("initial update - play state %i", p);
- debug("initial update - shuffle state %s", r.to_string());
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris2_player.Metadata,
@@ -115,7 +116,7 @@ public class Mpris2Controller : GLib.Object
ScrubMenuitem.attributes_format());
ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
scrub.update_position(this.mpris2_player.Position);
- */
+
}
public void transport_event(TransportMenuitem.action command)
@@ -123,13 +124,31 @@ public class Mpris2Controller : GLib.Object
debug("transport_event input = %i", (int)command);
if(command == TransportMenuitem.action.PLAY_PAUSE){
debug("transport_event PLAY_PAUSE");
- this.mpris2_player.PlayPause();
+ try{
+ this.mpris2_player.PlayPause();
+ }
+ catch(DBus.Error error){
+ warning("DBus Error calling the player objects PlayPause method %s",
+ error.message);
+ }
}
else if(command == TransportMenuitem.action.PREVIOUS){
- this.mpris2_player.Previous();
+ try{
+ this.mpris2_player.Previous();
+ }
+ catch(DBus.Error error){
+ warning("DBus Error calling the player objects Previous method %s",
+ error.message);
+ }
}
else if(command == TransportMenuitem.action.NEXT){
- this.mpris2_player.Next();
+ try{
+ this.mpris2_player.Next();
+ }
+ catch(DBus.Error error){
+ warning("DBus Error calling the player objects Next method %s",
+ error.message);
+ }
}
}