diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
| commit | 612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (patch) | |
| tree | 03ced96344802a4e338eb53d35d1c677f8354460 /src/player-controller.vala | |
| parent | 31b5a5a6508535ed1af86919c79d75571f1a65ef (diff) | |
| parent | 2900797204c4446a7f46515364c6aa868a5f4fab (diff) | |
| download | ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.gz ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.bz2 ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.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(); } |
