aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-08-10 16:18:51 +0100
committerConor Curran <conor.curran@canonical.com>2011-08-10 16:18:51 +0100
commitf6de74585f8b091f360debb65f2548cd8bc6ea01 (patch)
treef33cc4c446c415f013f8f5f6e082a660bab4abf8
parent023090260c73fad2f22c8937fad70215d56319d1 (diff)
downloadayatana-indicator-sound-f6de74585f8b091f360debb65f2548cd8bc6ea01.tar.gz
ayatana-indicator-sound-f6de74585f8b091f360debb65f2548cd8bc6ea01.tar.bz2
ayatana-indicator-sound-f6de74585f8b091f360debb65f2548cd8bc6ea01.zip
track specific and player specific fixed
-rw-r--r--src/music-player-bridge.vala7
-rw-r--r--src/player-controller.vala17
-rw-r--r--src/specific-items-manager.vala8
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<Dbusmenu.MenuitemProxy>();
return;
}
@@ -82,8 +82,6 @@ public class SpecificItemsManager : GLib.Object
// Fetch what children are there already.
GLib.List<weak void*> 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;