aboutsummaryrefslogtreecommitdiff
path: root/src/playlists-menu-item.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-12-10 15:36:44 +0000
committerConor Curran <conor.curran@canonical.com>2010-12-10 15:36:44 +0000
commit93190886959bfa16b835794a4a12a9a945e7777e (patch)
treecc78ef6d5f30e5b926ddf2b0006abc6f12718f57 /src/playlists-menu-item.vala
parentf3b321919e3390f3d3af2eea33ad71611616ce61 (diff)
downloadayatana-indicator-sound-93190886959bfa16b835794a4a12a9a945e7777e.tar.gz
ayatana-indicator-sound-93190886959bfa16b835794a4a12a9a945e7777e.tar.bz2
ayatana-indicator-sound-93190886959bfa16b835794a4a12a9a945e7777e.zip
proposed extension proven and observations gathered
Diffstat (limited to 'src/playlists-menu-item.vala')
-rw-r--r--src/playlists-menu-item.vala14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index 4b81e48..f9d681e 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -23,14 +23,14 @@ using Gee;
public class PlaylistsMenuitem : PlayerItem
{
-
+ private HashMap<int, PlaylistDetails?> current_playlists;
public Menuitem root_item;
public PlaylistsMenuitem ( PlayerController parent )
{
Object ( item_type: MENUITEM_TYPE, owner: parent );
}
construct{
- this.property_set ( MENUITEM_PROP_LABEL, "Choose Playlist");
+ this.current_playlists = new HashMap<int, PlaylistDetails?>();
this.root_item = new Menuitem();
this.root_item.property_set ( MENUITEM_PROP_LABEL, "Choose Playlist" );
}
@@ -43,17 +43,21 @@ public class PlaylistsMenuitem : PlayerItem
menuitem.property_set (MENUITEM_PROP_ICON_NAME, "source-smart-playlist");
menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true);
menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
-
+ this.current_playlists.set( menuitem.id, detail );
menuitem.item_activated.connect(() => {
submenu_item_activated (menuitem.id );});
-
this.root_item.child_append( menuitem );
}
}
private void submenu_item_activated (int menu_item_id)
{
- debug("item %i was activated", menu_item_id);
+ if(!this.current_playlists.has_key(menu_item_id)){
+ warning( "item %i was activated but we don't have a corresponding playlist",
+ menu_item_id );
+ return;
+ }
+ this.owner.mpris_bridge.activate_playlist ( this.current_playlists[menu_item_id].path );
}
public static HashSet<string> attributes_format()