diff options
Diffstat (limited to 'src/playlists-menu-item.vala')
-rw-r--r-- | src/playlists-menu-item.vala | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 8106600..4b81e48 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -23,18 +23,39 @@ using Gee; public class PlaylistsMenuitem : PlayerItem { + + 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.root_item = new Menuitem(); + this.root_item.property_set ( MENUITEM_PROP_LABEL, "Choose Playlist" ); + } - public void update (PlaylistDetails[] playlists) + public new void update (PlaylistDetails[] playlists) { - foreach ( PlaylistDetail detail in playlists ){ - + foreach ( PlaylistDetails detail in playlists ){ + Dbusmenu.Menuitem menuitem = new Menuitem(); + menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); + 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); + + 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); + } + public static HashSet<string> attributes_format() { HashSet<string> attrs = new HashSet<string>(); |