From b55fd2bd64c8075c86a38054900f3c59dbf53957 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 27 Feb 2012 19:08:57 +0000 Subject: make sure we are dynamically sensitive to players being uninstalled whilst they still have an entry in the menu --- src/player-controller.vala | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 05996c6..8d3e6cc 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -30,8 +30,6 @@ public class PlayerController : GLib.Object TRANSPORT, PLAYLISTS } - - public enum state{ OFFLINE, -- cgit v1.2.3 From f0bcb96d0f2a62ba7497b387ca1cf290b39aea33 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 16 Mar 2012 17:30:21 +0000 Subject: set the player name on the transport item so as hud can identify the default player --- src/player-controller.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 8d3e6cc..80a48c3 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -174,7 +174,7 @@ public class PlayerController : GLib.Object if(this.current_state != state.CONNECTED){ metadata_menuitem.should_collapse (true); playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, - false ); + false); this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, this.app_info.get_id() == "rhythmbox.desktop"); return; -- cgit v1.2.3 From dcde0e28f8cd4d674ba744fad1779f6e9f91eb6e Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 21 Jun 2012 17:45:16 +0100 Subject: manually merge of lp:~victored/indicator-sound/lp-1014955 --- src/player-controller.vala | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/player-controller.vala') diff --git a/src/player-controller.vala b/src/player-controller.vala index 80a48c3..fd66a8a 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -40,7 +40,7 @@ public class PlayerController : GLib.Object } public int current_state = state.OFFLINE; - + public Dbusmenu.Menuitem root_menu; public string dbus_name { get; set;} public ArrayList custom_items; @@ -49,6 +49,7 @@ public class PlayerController : GLib.Object public int menu_offset { get; set;} public string icon_name { get; set; } public bool? use_playlists; + public bool is_preferred { get; private set; } private SpecificItemsManager track_specific_mgr; private SpecificItemsManager player_specific_mgr; @@ -58,7 +59,8 @@ public class PlayerController : GLib.Object string icon_name, int offset, bool? use_playlists, - state initial_state) + state initial_state, + bool is_preferred) { this.use_playlists = use_playlists; this.root_menu = root; @@ -68,6 +70,8 @@ public class PlayerController : GLib.Object this.custom_items = new ArrayList(); this.current_state = initial_state; this.menu_offset = offset; + this.is_preferred = is_preferred; + this.construct_widgets(); this.establish_mpris_connection(); this.update_layout(); @@ -156,6 +160,11 @@ public class PlayerController : GLib.Object } } + public void set_as_preferred (bool val) { + this.is_preferred = val; + this.update_layout(); + } + public void hibernate() { update_state(PlayerController.state.OFFLINE); @@ -175,12 +184,14 @@ public class PlayerController : GLib.Object metadata_menuitem.should_collapse (true); playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, - this.app_info.get_id() == "rhythmbox.desktop"); + this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, is_preferred); return; } - metadata_menuitem.should_collapse (!this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui()) ); - if (this.app_info.get_id() == "rhythmbox.desktop"){ + + bool should_collapse = !this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui()); + metadata_menuitem.should_collapse (should_collapse); + + if (is_preferred){ TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; transport.handle_cached_action(); } -- cgit v1.2.3