From f6de74585f8b091f360debb65f2548cd8bc6ea01 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 10 Aug 2011 16:18:51 +0100 Subject: track specific and player specific fixed --- src/music-player-bridge.vala | 7 ++++++- src/player-controller.vala | 17 ++++++++++------- src/specific-items-manager.vala | 8 +++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 727c36b..72c9bdb 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -161,7 +161,12 @@ public class MusicPlayerBridge : GLib.Object public void enable_player_specific_items_for_client (string object_path, string desktop_id) { - // TODO + var mpris_key = determine_key ( desktop_id ); + if (this.registered_clients.has_key (mpris_key) == false){ + warning ("we don't have a client with desktop id %s registered", desktop_id); + return; + } + this.registered_clients[mpris_key].enable_player_specific_items(object_path); } public void enable_track_specific_items_for_client (string object_path, diff --git a/src/player-controller.vala b/src/player-controller.vala index f46d36b..ced7d96 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -109,17 +109,20 @@ public class PlayerController : GLib.Object public void enable_track_specific_items (string object_path) { - track_specific_mgr = new SpecificItemsManager (this, - object_path, - SpecificItemsManager.category.TRACK); + if (this.track_specific_mgr == null){ + track_specific_mgr = new SpecificItemsManager (this, + object_path, + SpecificItemsManager.category.TRACK); + } } public void enable_player_specific_items (string object_path) { - debug ("Player specific item"); - player_specific_mgr = new SpecificItemsManager (this, - object_path, - SpecificItemsManager.category.PLAYER); + if (this.player_specific_mgr == null){ + player_specific_mgr = new SpecificItemsManager (this, + object_path, + SpecificItemsManager.category.PLAYER); + } } public int track_specific_count () diff --git a/src/specific-items-manager.vala b/src/specific-items-manager.vala index e3d17e5..d26199f 100644 --- a/src/specific-items-manager.vala +++ b/src/specific-items-manager.vala @@ -51,8 +51,7 @@ public class SpecificItemsManager : GLib.Object { int result = 0 ; if (this.of_type == category.TRACK){ - int specific_item_count = this.proxy_items.size; - result = this.owner.menu_offset + 4 + specific_item_count; + result = this.owner.menu_offset + 4 + this.proxy_items.size; } else if (this.of_type == category.PLAYER){ int pos = this.owner.menu_offset + 4 + this.owner.track_specific_count(); @@ -70,7 +69,8 @@ public class SpecificItemsManager : GLib.Object foreach(var p in proxy_items){ this.owner.root_menu.child_delete (p); } - this.proxy_items.clear();// = null; + this.proxy_items.clear(); + debug ("array list size is now %i", this.proxy_items.size); //this.proxy_items = new ArrayList(); return; } @@ -82,8 +82,6 @@ public class SpecificItemsManager : GLib.Object // Fetch what children are there already. GLib.List children = root.get_children().copy(); - debug ("on_root_changed - size of children list : %i", - (int)children.length()); foreach (void* child in children) { int pos = figure_out_positioning(); unowned Dbusmenu.Menuitem item = (Dbusmenu.Menuitem)child; -- cgit v1.2.3