From da91c666d6b66163077ddb9e59bf556fb4d44953 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Jun 2010 08:59:06 +0100 Subject: --- src/player-controller.vala | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 86f0e0f..a92d8bf 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -7,7 +7,8 @@ public class PlayerController : GLib.Object private string name; private bool is_active; private ArrayList custom_items; - + + // TODO: pass in the appropriate position for the menu public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) { this.root_menu = root; @@ -24,21 +25,40 @@ public class PlayerController : GLib.Object } } - private void self_construct() + private bool self_construct() { - Dbusmenu.Menuitem client_item = new Dbusmenu.Menuitem(); - this.custom_items.add(client_item); - client_item.property_set(MENUITEM_PROP_LABEL, this.name.concat("")); - TransportMenuItem transport_item = new TransportMenuItem(); + // Separator item + Dbusmenu.Menuitem separator_item = new Dbusmenu.Menuitem(); + separator_item.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); + this.custom_items.add(separator_item); + + // Title item + Dbusmenu.Menuitem title_item = new Dbusmenu.Menuitem(); + title_item.property_set(MENUITEM_PROP_LABEL, this.name.concat("")); + title_item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); + this.custom_items.add(title_item); + + // Transport item + TransportMenuItem transport_item = new TransportMenuItem(); this.custom_items.add(transport_item); - root_menu.child_append(client_item); - root_menu.child_append(transport_item); - } + + int offset = 2; + foreach(Dbusmenu.Menuitem item in this.custom_items){ + root_menu.child_add_position(item, offset + this.custom_items.index_of(item)); + } + return true; + } +// if(!root_menu.child_add_position(client_item, 2) || +// !root_menu.child_add_position(transport_item, 3)){ +// //TODO raise here! +// return false; +// } +// return true; + private static string format_client_name(string client_name) { string formatted = client_name; - //debug("PlayerController->format_client_name"); if(formatted.len() > 1){ formatted = client_name.up(1).concat(client_name.slice(1, client_name.len())); debug("PlayerController->format_client_name - : %s", formatted); -- cgit v1.2.3