diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-06-06 21:52:44 +0200 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-06-06 21:52:44 +0200 |
commit | 4fc554dc87e61f4fa7c605236da86d05781f7496 (patch) | |
tree | 9dc5bf393e5fd21da4ebaeecfb3655aa491516b4 /src | |
parent | 0681190881ea7e9cca176bd69ec00f2393c3ee56 (diff) | |
download | ayatana-indicator-sound-4fc554dc87e61f4fa7c605236da86d05781f7496.tar.gz ayatana-indicator-sound-4fc554dc87e61f4fa7c605236da86d05781f7496.tar.bz2 ayatana-indicator-sound-4fc554dc87e61f4fa7c605236da86d05781f7496.zip |
track specific items now appears when asked via the com.canonical.indicators.sound dbus interface
Diffstat (limited to 'src')
-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); } } |