aboutsummaryrefslogtreecommitdiff
path: root/src/playlists-menu-item.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-12-21 14:53:56 +0000
committerConor Curran <conor.curran@canonical.com>2010-12-21 14:53:56 +0000
commit4843ae15f1ce4111c03b0fc24f5a8989d0619697 (patch)
tree55c320b02c23bedfc750ea25702d461402205520 /src/playlists-menu-item.vala
parentc8c7681e7b9e2995d29fa58c931aa09e451c4fee (diff)
downloadayatana-indicator-sound-4843ae15f1ce4111c03b0fc24f5a8989d0619697.tar.gz
ayatana-indicator-sound-4843ae15f1ce4111c03b0fc24f5a8989d0619697.tar.bz2
ayatana-indicator-sound-4843ae15f1ce4111c03b0fc24f5a8989d0619697.zip
playlists ready to go into trunk
Diffstat (limited to 'src/playlists-menu-item.vala')
-rw-r--r--src/playlists-menu-item.vala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index 30ffdc7..024839c 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -38,6 +38,7 @@ public class PlaylistsMenuitem : PlayerItem
public new void update (PlaylistDetails[] playlists)
{
foreach ( PlaylistDetails detail in playlists ){
+ if (this.already_observed(detail)) continue;
Dbusmenu.Menuitem menuitem = new Menuitem();
menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
menuitem.property_set (MENUITEM_PROP_ICON_NAME, "source-smart-playlist");
@@ -50,9 +51,19 @@ public class PlaylistsMenuitem : PlayerItem
}
}
+ private bool already_observed (PlaylistDetails new_detail)
+ {
+ foreach ( PlaylistDetails detail in this.current_playlists.values ){
+ if (new_detail.path == detail.path) return true;
+ }
+ return false;
+ }
+
public void update_active_playlist(PlaylistDetails detail)
{
- this.root_item.property_set ( MENUITEM_PROP_LABEL, detail.name );
+ var update = detail.name;
+ if ( update == "" ) update = "Choose Playlist";
+ this.root_item.property_set ( MENUITEM_PROP_LABEL, update );
}
private void submenu_item_activated (int menu_item_id)