From df55c0f3142de41dd742eda7a59a4b1392882d2b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 25 Jun 2010 12:59:15 +0100 Subject: fixes two bugs, album art crasher and unreported metadata reset on trackchange --- src/mpris-controller.vala | 1 + src/player-item.vala | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index a6d27be..beaf02c 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -56,6 +56,7 @@ public class MprisController : GLib.Object private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { debug("onTrackChange"); + this.controller.custom_items[this.controller.METADATA].reset(MetadataMenuitem.attributes_format()); this.controller.custom_items[this.controller.METADATA].update(ht, MetadataMenuitem.attributes_format()); } diff --git a/src/player-item.vala b/src/player-item.vala index 7fcf912..a5c5512 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -27,6 +27,13 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerItem() { } + + public void reset(HashSet attrs){ + foreach(string s in attrs){ + debug("attempting to set prop %s to null", s); + this.property_set(s, null); + } + } public void update(HashTable data, HashSet attributes) { @@ -39,7 +46,8 @@ public class PlayerItem : Dbusmenu.Menuitem string[] input_keys = property.split("-"); string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; debug("search key = %s", search_key); - Value v = data.lookup(search_key); + Value? v = data.lookup(search_key); + if (v.holds (typeof (string))){ debug("with value : %s", v.get_string()); this.property_set(property, this.sanitize_string(v.get_string())); -- cgit v1.2.3