aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/player-controller.vala')
-rw-r--r--src/player-controller.vala40
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);