From a1192a69cfdba207fa3e6ece69363649d8813dcf Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 6 Jun 2011 20:42:22 +0200 Subject: track specific items outline implemented --- src/player-controller.vala | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 20479d9..4689a42 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,13 +23,14 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 6; public static enum widget_order{ SEPARATOR, TITLE, METADATA, TRANSPORT, + TRACK_SPECIFIC, PLAYLISTS } @@ -105,16 +106,24 @@ public class PlayerController : GLib.Object error.message ); } } + + public void enable_track_specific_items() + { + this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_VISIBLE, + true); + this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_ENABLED, + true); + } private void establish_mpris_connection() { if(this.current_state != state.READY || this.dbus_name == null ){ debug("establish_mpris_connection - Not ready to connect"); return; - } + } debug ( " establish mpris connection - use playlists value = %s ", this.use_playlists.to_string() ); - + this.mpris_bridge = new Mpris2Controller(this); this.determine_state(); } @@ -183,13 +192,17 @@ public class PlayerController : GLib.Object // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); + + // Track Specific item + TrackSpecificMenuitem track_specific_item = new TrackSpecificMenuitem(this); + this.custom_items.add(track_specific_item); // Playlist item PlaylistsMenuitem playlist_menuitem = new PlaylistsMenuitem(this); this.custom_items.add(playlist_menuitem); foreach(PlayerItem item in this.custom_items){ - if (this.custom_items.index_of(item) != 4) { + if (this.custom_items.index_of(item) != 5) { root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); } else{ -- cgit v1.2.3 From 4fc554dc87e61f4fa7c605236da86d05781f7496 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 6 Jun 2011 21:52:44 +0200 Subject: track specific items now appears when asked via the com.canonical.indicators.sound dbus interface --- src/player-controller.vala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 4689a42..8a7bda5 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -109,10 +109,10 @@ public class PlayerController : GLib.Object public void enable_track_specific_items() { - this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_VISIBLE, - true); - this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_ENABLED, - true); + debug ("enable_track_specific_items"); + TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; + menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true); + menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true); } private void establish_mpris_connection() @@ -202,12 +202,16 @@ public class PlayerController : GLib.Object this.custom_items.add(playlist_menuitem); foreach(PlayerItem item in this.custom_items){ - if (this.custom_items.index_of(item) != 5) { - root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); + if (this.custom_items.index_of(item) == 5) { + PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; + root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } + else if (this.custom_items.index_of(item) == 4) { + TrackSpecificMenuitem trackspecific_menuitem = item as TrackSpecificMenuitem; + root_menu.child_add_position(trackspecific_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); + } else{ - PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; - root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); + root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); } } } -- cgit v1.2.3 From 01fc374f65b6c552891d3f0d2dad5c7eb8031596 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 22 Jun 2011 14:18:38 +0200 Subject: properly plug the track / player specific together --- src/player-controller.vala | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 52adb23..e988682 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -51,6 +51,7 @@ public class PlayerController : GLib.Object public int menu_offset { get; set;} public string icon_name { get; set; } public bool? use_playlists; + public Client track_specific_client; public PlayerController(Dbusmenu.Menuitem root, GLib.AppInfo app, @@ -107,12 +108,19 @@ public class PlayerController : GLib.Object } } - public void enable_track_specific_items() + public void enable_track_specific_items (string object_path) { debug ("enable_track_specific_items"); - TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; + track_specific_client = new Client (this.dbus_name, object_path); + track_specific_client.new_menuitem.connect (on_new_track_specific_menuitem); + /*TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true); - menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true); + menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true);*/ + } + + private void on_new_track_specific_menuitem (GLib.Object item) + { + debug ("New track specific item for %s", this.app_info.get_name()); } private void establish_mpris_connection() @@ -123,9 +131,8 @@ public class PlayerController : GLib.Object } debug ( " establish mpris connection - use playlists value = %s ", this.use_playlists.to_string() ); - - this.mpris_bridge = new Mpris2Controller(this); - this.determine_state(); + this.mpris_bridge = new Mpris2Controller (this); + this.determine_state (); } public void remove_from_menu() -- cgit v1.2.3 From e63dc6451177bc9d4c398849eda13ff880fc69c3 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 29 Jun 2011 10:24:23 +0200 Subject: new menu items manager - and removed the earlier attempt at a custom item for the same purpose --- src/player-controller.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index e988682..b1c0396 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -109,18 +109,18 @@ public class PlayerController : GLib.Object } public void enable_track_specific_items (string object_path) - { - debug ("enable_track_specific_items"); + { track_specific_client = new Client (this.dbus_name, object_path); - track_specific_client.new_menuitem.connect (on_new_track_specific_menuitem); + track_specific_client.root_changed.connect (on_new_track_specific_root_changed); /*TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true); menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true);*/ } - private void on_new_track_specific_menuitem (GLib.Object item) + private void on_new_track_specific_root_changed (GLib.Object item) { - debug ("New track specific item for %s", this.app_info.get_name()); + debug ("!!!!!!!!!!!!!!!!!! - Root changed for track specific item %s", + this.app_info.get_name()); } private void establish_mpris_connection() -- cgit v1.2.3 From 14bcbdbedbe248b4274ae36287f20c8dddf6276f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 29 Jun 2011 14:56:14 +0200 Subject: proxy items created --- src/player-controller.vala | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index b1c0396..ce1d8c8 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: @@ -23,13 +22,12 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 4; public static enum widget_order{ SEPARATOR, METADATA, TRANSPORT, - TRACK_SPECIFIC, PLAYLISTS } @@ -43,7 +41,7 @@ public class PlayerController : GLib.Object public int current_state = state.OFFLINE; - private Dbusmenu.Menuitem root_menu; + public Dbusmenu.Menuitem root_menu; public string dbus_name { get; set;} public ArrayList custom_items; public Mpris2Controller mpris_bridge; @@ -51,7 +49,8 @@ public class PlayerController : GLib.Object public int menu_offset { get; set;} public string icon_name { get; set; } public bool? use_playlists; - public Client track_specific_client; + private SpecificItemsManager track_specific_mgr; + private SpecificItemsManager player_specific_mgr; public PlayerController(Dbusmenu.Menuitem root, GLib.AppInfo app, @@ -110,19 +109,14 @@ public class PlayerController : GLib.Object public void enable_track_specific_items (string object_path) { - track_specific_client = new Client (this.dbus_name, object_path); - track_specific_client.root_changed.connect (on_new_track_specific_root_changed); - /*TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; - menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true); - menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true);*/ + track_specific_mgr = new SpecificItemsManager (this, object_path); } - private void on_new_track_specific_root_changed (GLib.Object item) - { - debug ("!!!!!!!!!!!!!!!!!! - Root changed for track specific item %s", - this.app_info.get_name()); + public void enable_player_specific_items (string object_path) + { + player_specific_mgr = new SpecificItemsManager (this, object_path); } - + private void establish_mpris_connection() { if(this.current_state != state.READY || this.dbus_name == null ){ @@ -196,10 +190,6 @@ public class PlayerController : GLib.Object // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); - - // Track Specific item - TrackSpecificMenuitem track_specific_item = new TrackSpecificMenuitem(this); - this.custom_items.add(track_specific_item); // Playlist item PlaylistsMenuitem playlist_menuitem = new PlaylistsMenuitem(this); @@ -210,10 +200,6 @@ public class PlayerController : GLib.Object PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } - else if (this.custom_items.index_of(item) == 3) { - TrackSpecificMenuitem trackspecific_menuitem = item as TrackSpecificMenuitem; - root_menu.child_add_position(trackspecific_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); - } else{ root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); } -- cgit v1.2.3 From 8594ebfd7953488650107625622cba9f343c051f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 9 Aug 2011 21:41:22 +0100 Subject: track specific almost in place --- src/player-controller.vala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index ce1d8c8..bd8b6ad 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -109,12 +109,16 @@ public class PlayerController : GLib.Object public void enable_track_specific_items (string object_path) { - track_specific_mgr = new SpecificItemsManager (this, object_path); + track_specific_mgr = new SpecificItemsManager (this, + object_path, + SpecificItemsManager.category.TRACK); } public void enable_player_specific_items (string object_path) { - player_specific_mgr = new SpecificItemsManager (this, object_path); + player_specific_mgr = new SpecificItemsManager (this, + object_path, + SpecificItemsManager.category.PLAYER); } private void establish_mpris_connection() @@ -201,7 +205,8 @@ public class PlayerController : GLib.Object root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } else{ - root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); + root_menu.child_add_position (item, + this.menu_offset + this.custom_items.index_of(item)); } } } -- cgit v1.2.3 From 023090260c73fad2f22c8937fad70215d56319d1 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 10 Aug 2011 13:41:08 +0100 Subject: track specific ordering correct, player specific under way --- src/player-controller.vala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index bd8b6ad..f46d36b 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -116,10 +116,19 @@ public class PlayerController : GLib.Object public void enable_player_specific_items (string object_path) { + debug ("Player specific item"); player_specific_mgr = new SpecificItemsManager (this, object_path, SpecificItemsManager.category.PLAYER); } + + public int track_specific_count () + { + if (this.track_specific_mgr == null) { + return 0; + } + return this.track_specific_mgr.proxy_items.size; + } private void establish_mpris_connection() { @@ -210,7 +219,7 @@ public class PlayerController : GLib.Object } } } - + private void determine_state() { if(this.mpris_bridge.connected() == true){ -- cgit v1.2.3 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/player-controller.vala | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/player-controller.vala') 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 () -- cgit v1.2.3