aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-08-19 18:20:27 +0100
committerConor Curran <conor.curran@canonical.com>2010-08-19 18:20:27 +0100
commite6fc3937fd425dfed550884bf9852e16f1cb7401 (patch)
treeb4c5a09abeba6ef8f4af682d18646ebec7c0364c /src/mpris2-controller.vala
parent6c2b00b21e60c5b667bb3d82639190af58d3c847 (diff)
downloadayatana-indicator-sound-e6fc3937fd425dfed550884bf9852e16f1cb7401.tar.gz
ayatana-indicator-sound-e6fc3937fd425dfed550884bf9852e16f1cb7401.tar.bz2
ayatana-indicator-sound-e6fc3937fd425dfed550884bf9852e16f1cb7401.zip
set position works without a jumping slider, correct button press behaviour of the title and metadata menuitems clipboard functionality in place
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 65d881a..815426f 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -119,13 +119,14 @@ public class Mpris2Controller : GLib.Object
Value? meta_v = changed_properties.lookup("Metadata");
if(meta_v != null){
debug("metadata is not empty");
- debug("artist : %s", this.player.Metadata.lookup("artist").get_string());
+ debug("artist : %s", this.player.Metadata.lookup("artist").get_string());
+
this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.player.Metadata,
MetadataMenuitem.attributes_format());
this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format());
if((int)this.player.Metadata.lookup("artist").get_string().len() > 0 ||
- (int)this.player.Metadata.lookup("artist").get_string().len() > 0){
+ (int)this.player.Metadata.lookup("title").get_string().len() > 0){
this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.player.Metadata,
ScrubMenuitem.attributes_format());
}
@@ -208,19 +209,20 @@ public class Mpris2Controller : GLib.Object
warning("Can't fetch the duration of the track therefore cant set the position");
return;
}
- // work in microseconds (scale up by 10 TTP-of 3)
- uint32 total_time = time_value.get_uint() * 1000;
+ // work in microseconds (scale up by 10 TTP-of 6)
+ uint32 total_time = time_value.get_uint() * 1000000;
debug("total time of track = %i", (int)total_time);
- double new_time_position = total_time * position/100.0;
+ double new_time_position = total_time * (position/100.0);
debug("new position = %f", (new_time_position));
Value? v = this.player.Metadata.lookup("trackid");
if(v != null){
if(v.holds (typeof (string))){
- debug("the trackid = %s", v.get_string());
DBus.ObjectPath path = new ObjectPath(v.get_string());
try{
- //this.player.SetPosition(path, (int64)(new_time_position));
+ this.player.SetPosition(path, (int64)(new_time_position));
+ ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
+ scrub.update_position(((int32)new_time_position) / 1000);
}
catch(DBus.Error e){
error("DBus Error calling the player objects SetPosition method %s",