+- (void)playlistsMenuAux:(NSMenu *)menu node:(PlaylistNode *)node tagPrefix:(int)p
+{
+ id <NSMenuItem> tempItem;
+ int i;
+
+ for (i = 0; i < [[node children] count]; i++) {
+ PlaylistNode *nextNode = [[node children] objectAtIndex:i];
+ if ([nextNode type] == ITMTFolderNode) {
+ NSMenu *submenu = [[NSMenu alloc] init];
+ tempItem = [menu addItemWithTitle:[nextNode name] action:@selector(performPlaylistMenuAction:) keyEquivalent:@""];
+ [tempItem setTag:p + [nextNode index] + 1];
+ [tempItem setTarget:self];
+ [tempItem setSubmenu:submenu];
+ [self playlistsMenuAux:[submenu autorelease] node:nextNode tagPrefix:p];
+ } else {
+ tempItem = [menu addItemWithTitle:[nextNode name] action:@selector(performPlaylistMenuAction:) keyEquivalent:@""];
+ [tempItem setTag:p + [nextNode index] + 1];
+ [tempItem setTarget:self];
+ }
+
+ PlaylistNode *root = node;
+ while ([root type] == ITMTPlaylistNode || [root type] == ITMTFolderNode) {
+ root = [root parent];
+ }
+
+ if ([root index] == [[[MainController sharedController] currentRemote] currentSourceIndex] && [nextNode index] == _currentPlaylist) {
+ [tempItem setState:NSOnState];
+ }
+ }
+}