diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-06-11 08:59:06 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-06-11 08:59:06 +0100 |
commit | da91c666d6b66163077ddb9e59bf556fb4d44953 (patch) | |
tree | 69d854aa7ed83e14e6302c2085c748f2a4f86f63 /src/player-controller.vala | |
parent | 50497b6b375cb96b77ed1700f58b8b8991f4c1ae (diff) | |
download | ayatana-indicator-sound-da91c666d6b66163077ddb9e59bf556fb4d44953.tar.gz ayatana-indicator-sound-da91c666d6b66163077ddb9e59bf556fb4d44953.tar.bz2 ayatana-indicator-sound-da91c666d6b66163077ddb9e59bf556fb4d44953.zip |
Diffstat (limited to 'src/player-controller.vala')
-rw-r--r-- | src/player-controller.vala | 40 |
1 files changed, 30 insertions, 10 deletions
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<Dbusmenu.Menuitem> 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); |