From b6fb30caf2354f05dbe496c1a2820acd37a1f2bf Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 9 Sep 2011 18:47:00 +0100 Subject: increased the max playlist count to 20, fixed a bug which was prohibiting the playlists being shown --- src/mpris2-controller.vala | 5 +++-- src/music-player-bridge.vala | 2 +- src/player-controller.vala | 6 ++++-- src/playlists-menu-item.vala | 1 + src/specific-items-manager.vala | 6 ++++-- 5 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 8eeac08..ce35a06 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -21,11 +21,12 @@ using Transport; public class Mpris2Controller : GLib.Object { + public const int MAX_PLAYLIST_COUNT = 20; + public MprisRoot mpris2_root {get; construct;} public MprisPlayer player {get; construct;} public MprisPlaylists playlists {get; construct;} public FreeDesktopProperties properties_interface {get; construct;} - public PlayerController owner {get; construct;} public Mpris2Controller(PlayerController ctrl) @@ -226,7 +227,7 @@ public class Mpris2Controller : GLib.Object try{ current_playlists = yield this.playlists.GetPlaylists (0, - 10, + MAX_PLAYLIST_COUNT, "Alphabetical", false); } diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 72c9bdb..0c9cb10 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -131,7 +131,7 @@ public class MusicPlayerBridge : GLib.Object this.registered_clients[mpris_key].use_playlists = use_playlists; this.registered_clients[mpris_key].update_state ( PlayerController.state.READY ); this.registered_clients[mpris_key].activate ( dbus_name ); - debug("Application has already registered - awaken the hibernation: %s \n", dbus_name ); + debug("Application has already registered - awaken the hibernation: %s with playlists %s \n", dbus_name, use_playlists.to_string() ); } } diff --git a/src/player-controller.vala b/src/player-controller.vala index 2f5569c..0fe7104 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -30,6 +30,8 @@ public class PlayerController : GLib.Object TRANSPORT, PLAYLISTS } + + public enum state{ OFFLINE, @@ -169,7 +171,6 @@ public class PlayerController : GLib.Object public void update_layout() { - debug ("a call to update layout"); PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem; MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem; if(this.current_state != state.CONNECTED){ @@ -190,6 +191,7 @@ public class PlayerController : GLib.Object this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, true); } + debug ("SETTING PLAYLISTS MENUITEM TO %s", this.use_playlists.to_string()); playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE, this.use_playlists ); } @@ -212,7 +214,7 @@ 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) == 4) { + if (this.custom_items.index_of(item) == WIDGET_QUANTITY-1) { PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 452a586..9cb7ac7 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -62,6 +62,7 @@ public class PlaylistsMenuitem : PlayerItem ); this.current_playlists.set( menuitem.id, menuitem ); this.root_item.child_append( menuitem ); + debug ("populating valid playlists %s", detail.name); } // Finally remove any that might have been deleted foreach (Dbusmenu.Menuitem item in this.current_playlists.values) { diff --git a/src/specific-items-manager.vala b/src/specific-items-manager.vala index 1bfe03e..923cf3f 100644 --- a/src/specific-items-manager.vala +++ b/src/specific-items-manager.vala @@ -51,10 +51,12 @@ public class SpecificItemsManager : GLib.Object { int result = 0 ; if (this.of_type == category.TRACK){ - result = this.owner.menu_offset + 4 + this.proxy_items.size; + result = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.proxy_items.size; } else if (this.of_type == category.PLAYER){ - int pos = this.owner.menu_offset + 4 + this.owner.track_specific_count(); + int pos = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.owner.track_specific_count(); + //Surely the playlists item is there whether its visible or not ? + //TODO test playlists and player specific item positioning. pos += this.owner.use_playlists == true ? 1 : 0; result = pos; } -- cgit v1.2.3