+- (IBAction)addNode:(id)sender
+{
+ /* we have to create a new thread here because otherwise we would block the
+ * interface since the interaction-stuff and this code would run in the same
+ * thread */
+ [NSThread detachNewThreadSelector: @selector(addNodeThreadedly)
+ toTarget: self withObject:nil];
+ [self playlistUpdated];
+}
+
+- (void)addNodeThreadedly
+{
+ NSAutoreleasePool * ourPool = [[NSAutoreleasePool alloc] init];
+
+ /* simply adds a new node to the end of the playlist */
+ playlist_t * p_playlist = pl_Yield( VLCIntf );
+ vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
+
+ int ret_v;
+ char *psz_name = NULL;
+ playlist_item_t * p_item;
+ ret_v = intf_UserStringInput( p_playlist, _("New Node"),
+ _("Please enter a name for the new node."), &psz_name );
+
+ if( ret_v != DIALOG_CANCELLED && psz_name && *psz_name )
+ p_item = playlist_NodeCreate( p_playlist, psz_name,
+ p_playlist->p_local_category, 0, NULL );
+ else if(! config_GetInt( p_playlist, "interact" ) )
+ {
+ /* in case that the interaction is disabled, just give it a bogus name */
+ p_item = playlist_NodeCreate( p_playlist, _("Empty Folder"),
+ p_playlist->p_local_category, 0, NULL );
+ }
+
+ if(! p_item )
+ msg_Warn( VLCIntf, "node creation failed or cancelled by user" );
+
+ vlc_object_release( p_playlist );
+ [ourPool release];
+}
+