Commit 9d3beebf authored by Benjamin Pracht's avatar Benjamin Pracht

* Fixes a silly bug in the filling of the NSMutableDictionary that stores the...

* Fixes a silly bug in the filling of the NSMutableDictionary that stores the p_item->node correspondance in the playlist
* A side effect of this fix seems to be that adding a directory, deleting it and adding a new playlist item doesn't seem to crash VLC anymore
* Make the currently playling item, as well as its parent items bold 

parent a180b7f4
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
[o_outline_view setDoubleAction: @selector(playItem:)]; [o_outline_view setDoubleAction: @selector(playItem:)];
[o_outline_view registerForDraggedTypes: [o_outline_view registerForDraggedTypes:
[NSArray arrayWithObjects: NSFilenamesPboardType, nil]]; [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
[o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)]; [o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
...@@ -275,7 +275,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -275,7 +275,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{ {
int i,i_row; int i,i_row;
unsigned int j; unsigned int j;
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
playlist_item_t *p_item, *p_temp_item; playlist_item_t *p_item, *p_temp_item;
...@@ -286,7 +286,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -286,7 +286,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
p_item = p_playlist->status.p_item; p_item = p_playlist->status.p_item;
if( p_item == NULL ) return; if( p_item == NULL ) return;
p_temp_item = p_item; p_temp_item = p_item;
while( p_temp_item->i_parents > 0 ) while( p_temp_item->i_parents > 0 )
{ {
...@@ -330,22 +330,25 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -330,22 +330,25 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
return NO; return NO;
} }
while( p_temp_item->i_parents > 0 ) if ( p_temp_item )
{ {
int i; while( p_temp_item->i_parents > 0 )
for( i = 0; i < p_temp_item->i_parents ; i++ )
{ {
if( p_temp_item->pp_parents[i]->i_view == i_current_view ) int i;
for( i = 0; i < p_temp_item->i_parents ; i++ )
{ {
if( p_temp_item->pp_parents[i]->p_parent == p_node ) if( p_temp_item->pp_parents[i]->i_view == i_current_view )
{
vlc_object_release( p_playlist );
return YES;
}
else
{ {
p_temp_item = p_temp_item->pp_parents[i]->p_parent; if( p_temp_item->pp_parents[i]->p_parent == p_node )
break; {
vlc_object_release( p_playlist );
return YES;
}
else
{
p_temp_item = p_temp_item->pp_parents[i]->p_parent;
break;
}
} }
} }
} }
...@@ -913,6 +916,31 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -913,6 +916,31 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
} }
} }
- (void)outlineView:(NSOutlineView *)outlineView
willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
if( !p_playlist ) return;
if( ( p_item == p_playlist->status.p_item ) ||
( p_item->i_children != 0 &&
[self isItem: p_playlist->status.p_item inNode: p_item] ) )
{
[cell setFont: [NSFont boldSystemFontOfSize: 0]];
}
else
{
[cell setFont: [NSFont systemFontOfSize: 0]];
}
vlc_object_release( p_playlist );
}
@end @end
@implementation VLCPlaylist (NSOutlineViewDataSource) @implementation VLCPlaylist (NSOutlineViewDataSource)
...@@ -994,14 +1022,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -994,14 +1022,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
o_value = [[NSValue valueWithPointer: p_return] retain]; o_value = [[NSValue valueWithPointer: p_return] retain];
if( [o_outline_dict objectForKey: [NSString stringWithFormat:@"%p", p_return]] == nil ) [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p", p_return]];
{
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p", p_return]];
}
return o_value; return o_value;
} }
......
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