From 6bab9d75b22aa21ed27e4961e6dbf4bbcdd2e94c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 15 Jul 2010 13:23:52 +0100 Subject: label text updating according to position and duration and scrub bar positioning now working --- src/mpris-controller.vala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/mpris-controller.vala') diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index f40614c..5e4dce2 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -50,23 +50,38 @@ public class MprisController : GLib.Object this.mpris_player.TrackChange += onTrackChange; this.mpris_player.StatusChange += onStatusChange; + initial_update(); + } + private void initial_update() + { status st = this.mpris_player.GetStatus(); int play_state = st.playback; debug("GetStatusChange - play state %i", play_state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(play_state); this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris_player.GetMetadata(), MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), + ScrubMenuitem.attributes_format()); + // temporary fix + ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + scrub.update_position(this.mpris_player.PositionGet()); } - private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { debug("onTrackChange"); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, MetadataMenuitem.attributes_format()); + debug("about to update the duration on the scrub bar"); + this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), + ScrubMenuitem.attributes_format()); + // temporary fix + ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + scrub.update_position(this.mpris_player.PositionGet()); } public void transport_event(TransportMenuitem.action command) -- cgit v1.2.3