diff options
-rw-r--r-- | src/player-controller.vala | 20 | ||||
-rw-r--r-- | src/playlists-menu-item.vala | 2 | ||||
-rw-r--r-- | src/track-specific-menu-item.vala | 10 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/player-controller.vala b/src/player-controller.vala index 4689a42..8a7bda5 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -109,10 +109,10 @@ public class PlayerController : GLib.Object public void enable_track_specific_items() { - this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_VISIBLE, - true); - this.custom_items[widget_order.TRACK_SPECIFIC].property_set_bool (MENUITEM_PROP_ENABLED, - true); + debug ("enable_track_specific_items"); + TrackSpecificMenuitem menuitem = this.custom_items[widget_order.TRACK_SPECIFIC] as TrackSpecificMenuitem; + menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, true); + menuitem.root_item.property_set_bool (MENUITEM_PROP_ENABLED, true); } private void establish_mpris_connection() @@ -202,12 +202,16 @@ 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) != 5) { - root_menu.child_add_position(item, this.menu_offset + this.custom_items.index_of(item)); + if (this.custom_items.index_of(item) == 5) { + PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; + root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } + else if (this.custom_items.index_of(item) == 4) { + TrackSpecificMenuitem trackspecific_menuitem = item as TrackSpecificMenuitem; + root_menu.child_add_position(trackspecific_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); + } else{ - PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; - root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); + root_menu.child_add_position(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 58c3875..452a586 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -37,10 +37,8 @@ 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, "" ); - } public new void update (PlaylistDetails[] playlists) diff --git a/src/track-specific-menu-item.vala b/src/track-specific-menu-item.vala index 7bc390e..718a564 100644 --- a/src/track-specific-menu-item.vala +++ b/src/track-specific-menu-item.vala @@ -20,17 +20,21 @@ with this program. If not, see <http://www.gnu.org/licenses/>. using Dbusmenu; using Gee; using DbusmenuTrackSpecific; +using Dbusmenu; public class TrackSpecificMenuitem : PlayerItem { + public Menuitem root_item{get; construct;} + public TrackSpecificMenuitem (PlayerController parent) { Object(item_type: MENUITEM_TYPE, owner: parent); } construct { - this.property_set_bool (MENUITEM_PROP_VISIBLE, false); - this.property_set_bool (MENUITEM_PROP_ENABLED, false); - this.property_set (MENUITEM_PROP_LABEL, "Like This"); + this.root_item = new Menuitem(); + this.root_item.property_set ( MENUITEM_PROP_LABEL, _("Like This") ); + this.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, false); + this.root_item.property_set_bool (MENUITEM_PROP_ENABLED, false); } } |