Commit 90e5abe9 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* fixed the item addition and auto-playback of items when adding them to the OSX intf.

inserting at a certain position is not yet possible.

This part of the osx code could also use a tad of cleaning up.
parent ec60fe80
...@@ -522,13 +522,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -522,13 +522,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{ {
/* One item */ /* One item */
NSDictionary *o_one_item; NSDictionary *o_one_item;
int j, i_total_options = 0, i_new_id = -1; playlist_item_t *p_item;
int i_mode = PLAYLIST_INSERT; int i;
BOOL b_rem = FALSE, b_dir = FALSE; BOOL b_rem = FALSE, b_dir = FALSE;
NSString *o_uri, *o_name; NSString *o_uri, *o_name;
NSArray *o_options; NSArray *o_options;
NSURL *o_true_file; NSURL *o_true_file;
char **ppsz_options = NULL;
/* Get the item */ /* Get the item */
o_one_item = [o_array objectAtIndex: i_item]; o_one_item = [o_array objectAtIndex: i_item];
...@@ -582,26 +581,20 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -582,26 +581,20 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
o_uri = o_temp; o_uri = o_temp;
} }
if( o_options && [o_options count] > 0 ) p_item = playlist_ItemNew( p_intf, [o_uri fileSystemRepresentation], [o_name UTF8String] );
{ if( !p_item )
/* Count the input options */ continue;
i_total_options = [o_options count];
/* Allocate ppsz_options */ if( o_options )
for( j = 0; j < i_total_options; j++ )
{ {
if( !ppsz_options ) for( i = 0; i < (int)[o_options count]; i++ )
ppsz_options = (char **)malloc( sizeof(char *) * i_total_options ); {
playlist_ItemAddOption( p_item, strdup( [[o_options objectAtIndex:i] UTF8String] ) );
ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
} }
} }
/* Add the item */ /* Add the item */
i_new_id = playlist_AddExt( p_playlist, [o_uri fileSystemRepresentation], playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, i_position == -1 ? PLAYLIST_END : i_position + i_item );
[o_name UTF8String], i_mode,
i_position == -1 ? PLAYLIST_END : i_position + i_item,
0, (ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options );
/* Recent documents menu */ /* Recent documents menu */
o_true_file = [NSURL fileURLWithPath: o_uri]; o_true_file = [NSURL fileURLWithPath: o_uri];
...@@ -613,8 +606,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -613,8 +606,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
if( i_item == 0 && !b_enqueue ) if( i_item == 0 && !b_enqueue )
{ {
playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) ); playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
playlist_Play( p_playlist );
} }
} }
......
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