diff options
Diffstat (limited to 'src/metadata-menu-item.vala')
-rw-r--r-- | src/metadata-menu-item.vala | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 82926b1..f62cd46 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -1,40 +1,41 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + using Dbusmenu; using Gee; +using DbusmenuMetadata; -public class MetadataMenuitem : Dbusmenu.Menuitem +public class MetadataMenuitem : PlayerItem { - /* Not ideal duplicate definition of const - see common-defs/h */ - const string DBUSMENU_METADATA_MENUITEM_TYPE = "x-canonical-metadata-menu-item"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST = "x-canonical-metadata-text-artist"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_PIECE = "x-canonical-metadata-text-piece"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER = "x-canonical-metadata-text-container"; - const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH = "x-canonical-metadata-image"; - public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); + this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); } - public void update(HashMap<string, string> data) + public static HashSet<string> attributes_format() { - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, data.get("title").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, data.get("album").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); - } - - public static string sanitize_image_path(string path) - { - string result = path.strip(); - if(result.has_prefix("file:///")){ - result = result.slice(7, result.len()); - } - debug("Sanitize image path - result = %s", result); - return result; + HashSet<string> attrs = new HashSet<string>(); + attrs.add(MENUITEM_TEXT_TITLE); + attrs.add(MENUITEM_TEXT_ARTIST); + attrs.add(MENUITEM_TEXT_ALBUM); + attrs.add(MENUITEM_ARTURL); + return attrs; } - public override void handle_event(string name, GLib.Value input_value, uint timestamp) - { - debug("MetadataItem -> handle event caught!"); - } }
\ No newline at end of file |