diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2010-09-08 12:24:23 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2010-09-08 12:24:23 +0200 |
commit | b347212eb1cb41fb9739a9873b0ff8eb8abb4b77 (patch) | |
tree | 3c9cb3c86b5668c2c03155c60a041f6cc85d28ba /src/player-item.vala | |
parent | 80e5ad4f83a8b1218133761de11d433a7854041e (diff) | |
download | ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.gz ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.bz2 ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.zip |
Import upstream version 0.4.2
Diffstat (limited to 'src/player-item.vala')
-rw-r--r-- | src/player-item.vala | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/player-item.vala b/src/player-item.vala index fbfacbd..68ae6ef 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -25,7 +25,7 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerController owner {get; construct;} public string item_type { get; construct; } private const int EMPTY = -1; - + public PlayerItem(string type) { Object(item_type: type); @@ -42,6 +42,12 @@ public class PlayerItem : Dbusmenu.Menuitem } } + /** + * update() + * Base update method for playeritems, takes the attributes and the incoming updates + * and attmepts to update the appropriate props on the object. + * Album art is handled separately to deal with remote and local file paths. + */ public void update(HashTable<string, Value?> data, HashSet<string> attributes) { debug("PlayerItem::update()"); @@ -59,16 +65,14 @@ public class PlayerItem : Dbusmenu.Menuitem if (v.holds (typeof (string))){ string update = v.get_string().strip(); debug("with value : %s", update); - // Special case for the arturl URI's. - if(property.contains("mpris:artUrl")){ - try{ - update = Filename.from_uri(update.strip()); - } - catch(ConvertError e){ - warning("Problem converting URI %s to file path", update); - } + if(property.contains("mpris:artUrl")){ + // We know its a metadata instance because thats the only + // object with the arturl prop + MetadataMenuitem metadata = this as MetadataMenuitem; + metadata.fetch_art(update.strip(), property); + continue; } - this.property_set(property, update); + this.property_set(property, update); } else if (v.holds (typeof (int))){ debug("with value : %i", v.get_int()); @@ -83,7 +87,6 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } - if(this.property_get_bool(MENUITEM_PROP_VISIBLE) == false){ this.property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -101,5 +104,6 @@ public class PlayerItem : Dbusmenu.Menuitem } return false; } + } |