@end
-
/*****************************************************************************
* VLCPlaylistCommon implementation
*
int i_return = 0;
playlist_item_t *p_item = NULL;
playlist_t * p_playlist = pl_Yield( VLCIntf );
- if( outlineView != o_outline_view )
- {
- vlc_object_release( p_playlist );
- return 0;
- }
+ NSAssert( outlineView != o_outline_view )
- if( item == nil )
- {
- /* root object */
+ if( !item )
p_item = p_playlist->p_root_category;
- }
else
- {
p_item = (playlist_item_t *)[item pointerValue];
- }
+
if( p_item )
i_return = p_item->i_children;
- vlc_object_release( p_playlist );
+
+ pl_Release( VLCIntf );
return i_return > 0 ? i_return : 0;
}
else
{
char *psz_name = input_item_GetName( p_item->p_input );
- if( psz_name != NULL )
+ if( !EMPTY_STR( psz_name ) )
{
o_value = [NSString stringWithUTF8String: psz_name];
}
@"VLCPlaylistItemPboardType", nil]];
[o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
- /* This uses private Apple API which works fine until 10.4.
+ /* This uses private Apple API which works fine until 10.5.
* We need to keep checking in the future!
* These methods are being added artificially to NSOutlineView's interface above */
o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
for( i = 0; ppsz_services[i]; i++ )
{
- vlc_bool_t b_enabled;
+ bool b_enabled;
char *objectname;
NSMenuItem *o_lmi;
- (void)playlistUpdated
{
- unsigned int i;
-
/* Clear indications of any existing column sorting */
- for( i = 0 ; i < [[o_outline_view tableColumns] count] ; i++ )
+ for( unsigned int i = 0 ; i < [[o_outline_view tableColumns] count] ; i++ )
{
[o_outline_view setIndicatorImage:nil inTableColumn:
[[o_outline_view tableColumns] objectAtIndex:i]];
- (void)playModeUpdated
{
playlist_t *p_playlist = pl_Yield( VLCIntf );
- vlc_value_t val, val2;
- var_Get( p_playlist, "loop", &val2 );
- var_Get( p_playlist, "repeat", &val );
- if( val.b_bool == VLC_TRUE )
- {
+ bool loop = var_GetBool( p_playlist, "loop" );
+ bool repeat = var_GetBool( p_playlist, "repeat" );
+ if( repeat )
[[[VLCMain sharedInstance] getControls] repeatOne];
- }
- else if( val2.b_bool == VLC_TRUE )
- {
+ else if( loop )
[[[VLCMain sharedInstance] getControls] repeatAll];
- }
else
- {
[[[VLCMain sharedInstance] getControls] repeatOff];
- }
[[[VLCMain sharedInstance] getControls] shuffle];
if ( p_temp_item )
{
int i;
- vlc_mutex_lock( &p_playlist->object_lock );
+ PL_LOCK;
if( b_check )
{
else if ( i == p_playlist->all_items.i_size - 1 )
{
vlc_object_release( p_playlist );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
return NO;
}
}
p_temp_item = p_temp_item->p_parent;
if( p_temp_item == p_node )
{
- vlc_mutex_unlock( &p_playlist->object_lock );
- vlc_object_release( p_playlist );
- return YES;
+ PL_UNLOCK;
+ vlc_object_release( p_playlist );
+ return YES;
}
}
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
vlc_object_release( p_playlist );
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 );
}
// if current item is in selected node and is playing then stop playlist
playlist_Stop( p_playlist );
- playlist_NodeDelete( p_playlist, p_item, VLC_TRUE, VLC_FALSE );
+ playlist_NodeDelete( p_playlist, p_item, true, false );
}
else
- playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, VLC_TRUE );
+ playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, true );
}
PL_UNLOCK;
if( p_item->i_children > -1 ) // the item is a node
{
- vlc_mutex_lock( &p_playlist->object_lock );
+ PL_LOCK;
playlist_RecursiveNodeSort( p_playlist, p_item, i_mode, ORDER_NORMAL );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
else
{
- vlc_mutex_lock( &p_playlist->object_lock );
+ PL_LOCK;
playlist_RecursiveNodeSort( p_playlist,
p_item->p_parent, i_mode, ORDER_NORMAL );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
vlc_object_release( p_playlist );
[self playlistUpdated];
/* 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 );
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 );
char *psz_temp;
NSString *o_current_name, *o_current_author;
- vlc_mutex_lock( &p_playlist->object_lock );
+ PL_LOCK;
o_current_name = [NSString stringWithUTF8String:
p_item->pp_children[i_current]->p_input->psz_name];
psz_temp = input_ItemGetInfo( p_item->p_input ,
_("Meta-information"),_("Artist") );
o_current_author = [NSString stringWithUTF8String: psz_temp];
free( psz_temp);
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
if( p_selected_item == p_item->pp_children[i_current] &&
b_selected_item_met == NO )
}
else if( b_selected_item_met == YES &&
( [o_current_name rangeOfString:[o_search_field
- stringValue] options:NSCaseInsensitiveSearch ].length ||
+ stringValue] options:NSCaseInsensitiveSearch].length ||
[o_current_author rangeOfString:[o_search_field
- stringValue] options:NSCaseInsensitiveSearch ].length ) )
+ stringValue] options:NSCaseInsensitiveSearch].length ) )
{
vlc_object_release( p_playlist );
/*Adds the parent items in the result array as well, so that we can
- (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 )
ret_v = intf_UserStringInput( p_playlist, _("New Node"),
_("Please enter a name for the new node."), &psz_name );
- if( psz_name != NULL && 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" ) )
}
}
- vlc_mutex_lock( &p_playlist->object_lock );
- // Acually detach the item from the old position
+ PL_LOCK;
+ // Actually detach the item from the old position
if( playlist_NodeRemoveItem( p_playlist, p_item, p_old_parent ) ==
VLC_SUCCESS )
{
// Reattach the item to the new position
playlist_NodeInsert( p_playlist, p_item, p_new_parent, i_new_index );
}
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
[self playlistUpdated];
i_row = [o_outline_view rowForItem:[o_outline_dict