aboutsummaryrefslogtreecommitdiff
path: root/src/playlists-menu-item.vala
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-03-11 12:56:28 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-03-11 12:56:28 -0500
commitd1a4d4e51d74192975dd2aa1dda35581b1d23d73 (patch)
tree59a8e63ea80a23797a97c2965a17eff3f48b97cd /src/playlists-menu-item.vala
parentf2b815cf615ba4532a7e04254ddb4acd1bbb75ff (diff)
parenta65cff5ec2d7625408d58fe6b23ddb40d7f63ee2 (diff)
downloadayatana-indicator-sound-d1a4d4e51d74192975dd2aa1dda35581b1d23d73.tar.gz
ayatana-indicator-sound-d1a4d4e51d74192975dd2aa1dda35581b1d23d73.tar.bz2
ayatana-indicator-sound-d1a4d4e51d74192975dd2aa1dda35581b1d23d73.zip
releasing version 0.6.3-0ubuntu1
Diffstat (limited to 'src/playlists-menu-item.vala')
-rw-r--r--src/playlists-menu-item.vala19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index f4d7233..98d18f4 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -47,7 +47,11 @@ public class PlaylistsMenuitem : PlayerItem
Dbusmenu.Menuitem menuitem = new Menuitem();
menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
- menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path);
+ var result = this.parse_icon_path (detail.icon_path);
+ if (result != null) {
+ menuitem.property_set (MENUITEM_PROP_ICON_NAME, (string)result);
+ }
+
menuitem.property_set (MENUITEM_PATH, (string)detail.path);
menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true);
menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
@@ -77,12 +81,23 @@ public class PlaylistsMenuitem : PlayerItem
}
}
+ private string? parse_icon_path (string path)
+ {
+ if (path == "")return null;
+ var icon_file = File.new_for_path (path);
+ if (icon_file.get_path() == null)return null;
+ return icon_file.get_basename().split(".")[0];
+ }
+
public void update_individual_playlist (PlaylistDetails new_detail)
{
foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){
if (new_detail.path == item.property_get (MENUITEM_PATH)){
item.property_set (MENUITEM_PROP_LABEL, new_detail.name);
- item.property_set (MENUITEM_PROP_ICON_NAME, new_detail.icon_path);
+ var result = this.parse_icon_path (new_detail.icon_path);
+ if (result != null) {
+ item.property_set (MENUITEM_PROP_ICON_NAME, result);
+ }
}
}
// If its active make sure the name is updated on the root item.