Merge lp:~cjcurran/indicator-sound/timeout-for-metadata into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Rejected
Rejected by: Conor Curran
Proposed branch: lp:~cjcurran/indicator-sound/timeout-for-metadata
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 37 lines (+12/-8)
1 file modified
src/mpris2-controller.vala (+12/-8)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/timeout-for-metadata
Reviewer Review Type Date Requested Status
Ted Gould (community) Needs Information
Review via email: mp+58179@code.launchpad.net

Description of the change

Place timeout in the mpris controller to accommodate flaky mpris dbus behaviour (it can be seen sometimes that the players emit a property changed on the metadata property but the actual value of the property which the service then tries to use is the old value)

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Do we need to check to see if we have one of these timeout queued so that if we get multiple messages we don't queue multiple timeouts?

review: Needs Information

Unmerged revisions

238. By Conor Curran

timeout in place for metadata updates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/mpris2-controller.vala'
2--- src/mpris2-controller.vala 2011-03-29 10:43:34 +0000
3+++ src/mpris2-controller.vala 2011-04-18 19:02:26 +0000
4@@ -83,13 +83,7 @@
5 }
6 Variant? meta_v = changed_properties.lookup("Metadata");
7 if(meta_v != null){
8- GLib.HashTable<string, Variant?> changed_updates = clean_metadata();
9- PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
10- metadata.reset ( MetadataMenuitem.attributes_format());
11- metadata.update ( changed_updates,
12- MetadataMenuitem.attributes_format());
13- metadata.property_set_bool ( MENUITEM_PROP_VISIBLE,
14- metadata.populated(MetadataMenuitem.attributes_format()));
15+ Timeout.add (300, this.ensure_correct_metadata);
16 }
17 Variant? playlist_v = changed_properties.lookup("ActivePlaylist");
18 if ( playlist_v != null && this.owner.use_playlists == true ){
19@@ -113,7 +107,17 @@
20 title.alter_label (this.mpris2_root.Identity);
21 }
22 }
23-
24+
25+ private bool ensure_correct_metadata(){
26+ GLib.HashTable<string, Variant?> changed_updates = clean_metadata();
27+ PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
28+ metadata.reset ( MetadataMenuitem.attributes_format());
29+ metadata.update ( changed_updates,
30+ MetadataMenuitem.attributes_format());
31+ metadata.property_set_bool ( MENUITEM_PROP_VISIBLE,
32+ metadata.populated(MetadataMenuitem.attributes_format()));
33+ return false;
34+ }
35 private bool ensure_correct_playback_status(){
36 //debug("TEST playback status = %s", this.player.PlaybackStatus);
37 Transport.State p = (Transport.State)this.determine_play_state(this.player.PlaybackStatus);

Subscribers

People subscribed via source and target branches