diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/metadata-menu-item.vala | 24 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 11 | ||||
-rw-r--r-- | src/player-controller.vala | 4 | ||||
-rw-r--r-- | src/player-item.vala | 2 | ||||
-rw-r--r-- | src/playlists-menu-item.vala | 1 |
5 files changed, 23 insertions, 19 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 5f3ef8b..8d7b55d 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -183,19 +183,9 @@ public class MetadataMenuitem : PlayerItem this.property_set_bool (MENUITEM_PLAYER_RUNNING, update); } - public void collapse() + public void should_collapse(bool collapse) { - this.property_set_bool (MENUITEM_HIDE_TRACK_DETAILS, true); - } - - public void expand() - { - this.property_set_bool (MENUITEM_HIDE_TRACK_DETAILS, false); - } - - public void populated() - { - //this.property_get (MENUITEM_TITLE + this.property_set_bool (MENUITEM_HIDE_TRACK_DETAILS, collapse); } public static HashSet<string> attributes_format() @@ -210,4 +200,14 @@ public class MetadataMenuitem : PlayerItem attrs.add(MENUITEM_PLAYER_RUNNING); return attrs; } + + public static HashSet<string> relevant_attributes_for_ui() + { + HashSet<string> attrs = new HashSet<string>(); + attrs.add(MENUITEM_TITLE); + attrs.add(MENUITEM_ARTIST); + attrs.add(MENUITEM_ALBUM); + attrs.add(MENUITEM_ARTURL); + return attrs; + } } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index e0d13cf..7e128dd 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -84,12 +84,17 @@ public class Mpris2Controller : GLib.Object Variant? meta_v = changed_properties.lookup("Metadata"); if(meta_v != null){ GLib.HashTable<string, Variant?> changed_updates = clean_metadata(); + //MetadataMenuitem md = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; + //md.reset_track_details (); + PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA]; - metadata.reset ( MetadataMenuitem.attributes_format()); + metadata.reset (MetadataMenuitem.relevant_attributes_for_ui()); metadata.update ( changed_updates, MetadataMenuitem.attributes_format()); - metadata.property_set_bool ( MENUITEM_PROP_VISIBLE, - metadata.populated(MetadataMenuitem.attributes_format())); + /*metadata.property_set_bool ( MENUITEM_PROP_VISIBLE, + metadata.populated(MetadataMenuitem.relevant_attributes_for_ui()));*/ + debug ("metadata visibility = %s", + metadata.populated (MetadataMenuitem.relevant_attributes_for_ui()).to_string()); } Variant? playlist_v = changed_properties.lookup("ActivePlaylist"); if ( playlist_v != null && this.owner.use_playlists == true ){ diff --git a/src/player-controller.vala b/src/player-controller.vala index 3722fff..7e35d63 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -147,14 +147,14 @@ public class PlayerController : GLib.Object MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem; if(this.current_state != state.CONNECTED){ // TODO - metadata_menuitem.collapse (); + 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() == "banshee.desktop"); return; } - metadata_menuitem.expand (); + metadata_menuitem.should_collapse (false); /*this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE, this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));*/ if (this.app_info.get_id() == "banshee.desktop"){ diff --git a/src/player-item.vala b/src/player-item.vala index cb21115..f71b166 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -87,7 +87,7 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } - //this.property_set_bool(MENUITEM_PROP_VISIBLE, populated(attributes)); + this.property_set_bool(MENUITEM_PROP_VISIBLE, populated(attributes)); } public bool populated(HashSet<string> attrs) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 58c3875..7faa214 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -37,7 +37,6 @@ public class PlaylistsMenuitem : PlayerItem construct{ this.current_playlists = new HashMap<int, Dbusmenu.Menuitem>(); this.root_item = new Menuitem(); - this.root_item.property_set ( MENUITEM_PROP_LABEL, _("Choose Playlist") ); this.root_item.property_set ( MENUITEM_PATH, "" ); |