@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;
- }
+ assert( 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++ )
{
bool b_enabled;
- char *objectname;
NSMenuItem *o_lmi;
char * name = ppsz_name[i] ? ppsz_name[i] : ppsz_services[i];
/* Check whether to enable these menuitems */
- b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, objectname );
+ b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, ppsz_services[i] );
/* Create the menu entries used in the playlist menu */
o_lmi = [[o_mi_services submenu] addItemWithTitle:
- (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 == 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 == 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 );
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];
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
i_type = ORDER_NORMAL;
}
- vlc_mutex_lock( &p_playlist->object_lock );
+ vlc_object_lock( p_playlist );
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ vlc_object_unlock( p_playlist );
vlc_object_release( p_playlist );
[self playlistUpdated];
}
}
- 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