char ** ppsz_name;
char ** ppsz_services = services_discovery_GetServicesNames( p_playlist, &ppsz_name );
+ if( !ppsz_services )
+ {
+ vlc_object_release( p_playlist );
+ return;
+ }
for( i = 0; ppsz_services[i]; i++ )
{
- vlc_bool_t b_enabled;
+ bool b_enabled;
char *objectname;
NSMenuItem *o_lmi;
var_Get( p_playlist, "loop", &val2 );
var_Get( p_playlist, "repeat", &val );
- if( val.b_bool == VLC_TRUE )
+ if( val.b_bool == true )
{
[[[VLCMain sharedInstance] getControls] repeatOne];
}
- else if( val2.b_bool == VLC_TRUE )
+ else if( val2.b_bool == true )
{
[[[VLCMain sharedInstance] getControls] repeatAll];
}
p_item = NULL;
}
}
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_node, p_item );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_node, p_item );
}
vlc_object_release( p_playlist );
}
- (IBAction)deleteItem:(id)sender
{
- int i, i_count, i_row;
+ int i_count, i_row;
NSMutableArray *o_to_delete;
NSNumber *o_number;
playlist_t * p_playlist;
intf_thread_t * p_intf = VLCIntf;
- p_playlist = pl_Yield( p_intf );
-
o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_delete count];
- for( i = 0; i < i_count; i++ )
+ p_playlist = pl_Yield( p_intf );
+
+ PL_LOCK;
+ for( int i = 0; i < i_count; i++ )
{
o_number = [o_to_delete lastObject];
i_row = [o_number intValue];
id o_item = [o_outline_view itemAtRow: i_row];
playlist_item_t *p_item = [o_item pointerValue];
+#ifndef NDEBUG
+ msg_Dbg( p_intf, "deleting item %i (of %i) with id \"%i\", pointerValue \"%p\" and %i children", i+1, i_count,
+ p_item->p_input->i_id, [o_item pointerValue], p_item->i_children +1 );
+#endif
[o_to_delete removeObject: o_number];
[o_outline_view deselectRow: i_row];
- if( [[o_outline_view dataSource] outlineView:o_outline_view
- numberOfChildrenOfItem: o_item] > 0 )
+ if( p_item->i_children != -1 )
//is a node and not an item
{
if( p_playlist->status.i_status != PLAYLIST_STOPPED &&
[self isItem: p_playlist->status.p_item inNode:
((playlist_item_t *)[o_item pointerValue])
checkItemExistence: NO] == YES )
- {
// if current item is in selected node and is playing then stop playlist
playlist_Stop( p_playlist );
- }
- vlc_mutex_lock( &p_playlist->object_lock );
- playlist_NodeDelete( p_playlist, p_item, VLC_TRUE, VLC_FALSE );
- vlc_mutex_unlock( &p_playlist->object_lock );
+
+ playlist_NodeDelete( p_playlist, p_item, true, false );
}
else
- {
- playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, VLC_FALSE );
- }
+ playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, true );
}
+ PL_UNLOCK;
+
[self playlistUpdated];
vlc_object_release( p_playlist );
}
o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
- /* Find the name for a disc entry ( i know, can you believe the trouble?) */
+ /* Find the name for a disc entry (i know, can you believe the trouble?) */
if( ( !o_name || [o_name isEqualToString:@""] ) && [o_uri rangeOfString: @"/dev/"].location != NSNotFound )
{
int i_count, i_index;
}
/* Add the item */
+ /* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
- i_position == -1 ? PLAYLIST_END : i_position + i_item, VLC_TRUE,
- VLC_FALSE );
+ i_position == -1 ? PLAYLIST_END : i_position + i_item, true,
+ false );
if( i_item == 0 && !b_enqueue )
{
playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, VLC_TRUE );
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, NULL, p_item );
+ p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
}
else
{
playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, VLC_TRUE );
- playlist_Control( p_playlist, PLAYLIST_SKIP, VLC_TRUE, p_item );
+ p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
+ playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
}
+ vlc_gc_decref( p_input );
}
[self playlistUpdated];
vlc_object_release( p_playlist );
}
/* Add the item */
+ /* FIXME: playlist_NodeAddInput() can fail */
playlist_NodeAddInput( p_playlist, p_input, p_node,
PLAYLIST_INSERT,
i_position == -1 ?
- PLAYLIST_END : i_position + i_item, VLC_FALSE );
+ PLAYLIST_END : i_position + i_item, false );
if( i_item == 0 && !b_enqueue )
{
playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, VLC_TRUE );
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, NULL, p_item );
+ p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
}
else
{
playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, VLC_TRUE );
- playlist_Control( p_playlist, PLAYLIST_SKIP, VLC_TRUE, p_item );
+ p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
+ playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
}
+ vlc_gc_decref( p_input );
}
[self playlistUpdated];
vlc_object_release( p_playlist );
- (NSMenu *)menuForEvent:(NSEvent *)o_event
{
NSPoint pt;
- vlc_bool_t b_rows;
- vlc_bool_t b_item_sel;
+ bool b_rows;
+ bool b_item_sel;
pt = [o_outline_view convertPoint: [o_event locationInWindow]
fromView: nil];
}
else
{
- b_isSortDescending = VLC_FALSE;
+ b_isSortDescending = false;
}
if( o_tc == o_tc_name )
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]];
-#ifdef DEBUG
+#ifndef NDEBUG
msg_Dbg( VLCIntf, "adding item %p", [o_value pointerValue] );
#endif
return o_value;