diff options
Diffstat (limited to 'src/metadata-menu-item.vala')
-rw-r--r-- | src/metadata-menu-item.vala | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 2b865f7..5464074 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -1,22 +1,21 @@ using Dbusmenu; using Gee; -using CommonDefs; +using DbusmenuMetadata; public class MetadataMenuitem : PlayerItem { public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); - + this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); } - public override void update(HashMap<string, string> data) - { - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, data.get("title").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, data.get("album").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); - } + //public override void update(HashMap<string, string> data) + //{ + // this.property_set(MENUITEM_TEXT_ARTIST, data.get("artist").strip()); + // this.property_set(MENUITEM_TEXT_TITLE, data.get("title").strip()); + // this.property_set(MENUITEM_TEXT_ALBUM, data.get("album").strip()); + // this.property_set(MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); + //} public static string sanitize_image_path(string path) { @@ -27,21 +26,26 @@ public class MetadataMenuitem : PlayerItem debug("Sanitize image path - result = %s", result); return result; } - - public override void handle_event(string name, GLib.Value input_value, uint timestamp) + + public static HashMap<string, Type> attributes_format() { - debug("MetadataItem -> handle event caught!"); - } + HashMap<string,Type> results = new HashMap<string, Type>(); + results.set(MENUITEM_TEXT_TITLE, typeof(string)); + results.set(MENUITEM_TEXT_ARTIST, typeof(string)); + results.set(MENUITEM_TEXT_ALBUM, typeof(string)); + results.set(MENUITEM_TEXT_ARTURL, typeof(string)); + return results; + } + - public static HashMap<string, Type> attributes() + public static HashMap<string, string> format_updates(HashMap<string, Value?> data) { - HashMap<string, Type> result = new HashMap<string, Type>(); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, typeof(string)); + HashMap<string,string> results = new HashMap<string, string>(); - return result; + results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip()); + results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip()); + results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string)); + results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string)); + return results; } - }
\ No newline at end of file |