Commit fd1e5a16 authored by Carola Nitz's avatar Carola Nitz Committed by Felix Paul Kühne

VLCMediaList: call the delegate when media was Added

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 25d23581
......@@ -36,6 +36,7 @@ extern NSString *const VLCMediaListItemDeleted;
* TODO: Documentation VLCMediaListDelegate
*/
@protocol VLCMediaListDelegate
@optional
/**
* TODO: Documentation - [VLCMediaListDelegate mediaList:mediaAdded:atIndex:]
*/
......
......@@ -261,6 +261,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
if (index && index > [cachedMedia count])
index = [cachedMedia count];
[cachedMedia insertObject:media atIndex:index];
index = [cachedMedia count] - 1;
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaAdded:atIndex:)])
[delegate mediaList:self mediaAdded:media atIndex:index];
}
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:range] forKey:@"media"];
......@@ -268,10 +271,6 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// [[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemAdded
// object:self
// userInfo:args];
// Let the delegate know that the item was added
// if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaAdded:atIndex:)])
// [delegate mediaList:self mediaAdded:media atIndex:index];
}
- (void)mediaListItemRemoved:(NSNumber *)index
......
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