diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-09-07 17:57:49 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-09-07 17:57:49 +0100 |
commit | cee98ff81f3511badf4ac804840b7879e02897f6 (patch) | |
tree | 36f5d3af936eceb2a05f26d2e92555ee9d8f9bdd /src/player-item.vala | |
parent | f17b3140b1ac0efd8c89ed15d2b2f1549595462d (diff) | |
parent | b7c9529e1830961e50ecf664b53b7a64b6643c41 (diff) | |
download | ayatana-indicator-sound-cee98ff81f3511badf4ac804840b7879e02897f6.tar.gz ayatana-indicator-sound-cee98ff81f3511badf4ac804840b7879e02897f6.tar.bz2 ayatana-indicator-sound-cee98ff81f3511badf4ac804840b7879e02897f6.zip |
remote album handling merge
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; } + } |