diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 22:07:48 +0200 |
---|---|---|
committer | Package Import Robot <package-import@ubuntu.com> | 2012-07-12 22:07:48 +0200 |
commit | 2560f7de361ca34b7b8482e30513adad21fe225b (patch) | |
tree | 03ced96344802a4e338eb53d35d1c677f8354460 /src/player-controller.vala | |
parent | 01d561bf282f03825ca22533f66d72ba44fd85a9 (diff) | |
parent | 612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (diff) | |
download | ayatana-indicator-sound-2560f7de361ca34b7b8482e30513adad21fe225b.tar.gz ayatana-indicator-sound-2560f7de361ca34b7b8482e30513adad21fe225b.tar.bz2 ayatana-indicator-sound-2560f7de361ca34b7b8482e30513adad21fe225b.zip |
Import upstream version 12.10.0
Diffstat (limited to 'src/player-controller.vala')
-rw-r--r-- | src/player-controller.vala | 23 |
1 files changed, 17 insertions, 6 deletions
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<PlayerItem> 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<PlayerItem>(); 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(); } |