aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-09 19:36:20 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-09 19:36:20 +0000
commit8ded632700c7331b9e4e1f9f1b19ae9bade2eced (patch)
treeca34ff4d3446f33e71eb043f4a65f35f1c3f8c66 /src
parentbc33d0a5ef7a294804719273811cdd2878bddbe9 (diff)
downloadayatana-indicator-sound-8ded632700c7331b9e4e1f9f1b19ae9bade2eced.tar.gz
ayatana-indicator-sound-8ded632700c7331b9e4e1f9f1b19ae9bade2eced.tar.bz2
ayatana-indicator-sound-8ded632700c7331b9e4e1f9f1b19ae9bade2eced.zip
tidied
Diffstat (limited to 'src')
-rw-r--r--src/playlists-menu-item.vala26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index 78fb6dc..2b820e5 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -47,18 +47,13 @@ public class PlaylistsMenuitem : PlayerItem
Dbusmenu.Menuitem menuitem = new Menuitem();
menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
-
- var icon_file = File.new_for_path (detail.icon_path);
-
- if (icon_file.get_basename () != null) {
- debug ("icon name = %s", icon_file.get_basename().split(".")[0]);
- menuitem.property_set (MENUITEM_PROP_ICON_NAME,
- icon_file.get_basename().split(".")[0]);
+ var result = this.parse_icon_path (detail.icon_path);
+ if (result != null) {
+ menuitem.property_set (MENUITEM_PROP_ICON_NAME, result);
}
// TODO: Make sure to set a stock playlist image
else{
}
- menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path);
menuitem.property_set (MENUITEM_PATH, (string)detail.path);
menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true);
menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
@@ -88,12 +83,25 @@ public class PlaylistsMenuitem : PlayerItem
}
}
+ private string? parse_icon_path (string path)
+ {
+ var icon_file = File.new_for_path (path);
+
+ if (icon_file.get_basename() == null)return null;
+
+ debug ("icon name = %s", icon_file.get_basename().split(".")[0]);
+ 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.