Commit 243e7bff authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

* ask for the name of the new node through the interaction framework (node...

* ask for the name of the new node through the interaction framework (node creation runs in a separate thread now to avoid interface blocking)
parent a8e743f7
......@@ -154,7 +154,16 @@
msg_Dbg( p_intf, "Description: %s", [o_description UTF8String] );
if( p_dialog->i_id == DIALOG_ERRORS )
{
msg_Err( p_intf, "Error: %s", p_dialog->psz_description );
//msg_Err( p_intf, "Error: %s", p_dialog->psz_description );
int myInt;
myInt = NSRunCriticalAlertPanel( _NS("Error"), o_description, _NS("OK"),
_NS("Report..."), nil );
if( myInt == NSCancelButton )
{
NSURL * o_url = [NSURL URLWithString:
@"http://www.videolan.org/support/bug-reporting.html"];
[[NSWorkspace sharedWorkspace] openURL: o_url];
}
}
else
{
......@@ -197,7 +206,7 @@
}
else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL )
{
msg_Dbg( p_intf, "requested flag: DIALOG_STRING_INPUT_OK" );
msg_Dbg( p_intf, "requested flag: DIALOG_PSZ_INPUT_OK_CANCEL" );
[o_input_title setStringValue: o_title];
[o_input_description setStringValue: o_description];
[o_input_fld setStringValue: @""];
......
......@@ -137,6 +137,7 @@
- (IBAction)recursiveExpandNode:(id)sender;
- (IBAction)addNode:(id)sender;
- (void)addNodeThreadedly;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue;
......
......@@ -50,6 +50,7 @@
#include "controls.h"
#include "vlc_osd.h"
#include "misc.h"
#import <vlc_interaction.h>
/*****************************************************************************
* VLCPlaylistView implementation
......@@ -1471,22 +1472,45 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
- (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 = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
if( !p_playlist )
{
return;
}
playlist_item_t * p_item = playlist_NodeCreate( p_playlist,
_("Empty Folder"), p_playlist->p_local_category );
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( psz_name != NULL && psz_name != "" )
p_item = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_local_category );
else
p_item = playlist_NodeCreate( p_playlist, _("Empty Folder"),
p_playlist->p_local_category );
if(! p_item )
msg_Warn( VLCIntf, "node creation failed" );
vlc_object_release( p_playlist );
[self playlistUpdated];
[ourPool release];
}
@end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment