Commit 3c5a53bc authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaList.m: Fix a few warnings and use a Dictionary...

MacOSX/Framework/VLCMediaList.m: Fix a few warnings and use a Dictionary instead of an array for -mediaListItemAdded: argument.
parent cbe148f2
......@@ -33,15 +33,15 @@ extern NSString * VLCMediaListItemDeleted;
// TODO: Documentation
@protocol VLCMediaListDelegate
- (void)mediaList:(VLCMediaList *) mediaAdded:(VLCMedia *)media atIndex:(int)index;
- (void)mediaList:(VLCMediaList *) mediaRemovedAtIndex:(int)index;
- (void)mediaList:(VLCMediaList *)aMediaList mediaAdded:(VLCMedia *)media atIndex:(int)index;
- (void)mediaList:(VLCMediaList *)aMediaList mediaRemovedAtIndex:(int)index;
@end
// TODO: Documentation
@interface VLCMediaList : NSObject
{
void * p_mlist; //< Internal instance of media list
id delegate; //< Delegate object
id <VLCMediaListDelegate,NSObject> delegate; //< Delegate object
}
/* Properties */
......
......@@ -39,7 +39,7 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
- (void)initInternalMediaList;
/* Libvlc event bridges */
- (void)mediaListItemAdded:(NSArray *)args;
- (void)mediaListItemAdded:(NSDictionary *)args;
- (void)mediaListItemRemoved:(NSNumber *)index;
@end
......@@ -53,8 +53,10 @@ static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_dat
// been added
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:)
withArgumentAsObject:[NSArray arrayWithObjects:[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item],
[NSNumber numberWithInt:event->u.media_list_item_added.index], nil]];
withArgumentAsObject:[NSDictionary dictionaryWithObjectsAndKeys:
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
nil]];
}
static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * user_data)
......@@ -283,22 +285,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
quit_on_exception( &p_e );
}
- (void)mediaListItemAdded:(NSArray *)args
{
VLCMedia *media = [args objectAtIndex:0];
NSNumber *index = [args objectAtIndex:1];
- (void)mediaListItemAdded:(NSDictionary *)args
{
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemAdded
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
media, @"media",
index, @"index",
nil]];
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 intValue]];
[delegate mediaList:self mediaAdded:[args objectForKey:@"media"] atIndex:[[args objectForKey:@"index"] intValue]];
}
- (void)mediaListItemRemoved:(NSNumber *)index
......@@ -312,7 +308,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// Let the delegate know that the item is being removed
if (delegate && [delegate respondsToSelector:@selector(mediaList:mediaRemovedAtIndex:)])
[delegate mediaList:self mediaRemovedAtIndex:index];
[delegate mediaList:self mediaRemovedAtIndex:[index intValue]];
}
@end
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