macosx/playlist: add notifications when items are added or removed
authorFelix Paul Kühne <felix@feepk.net>
Tue, 16 Apr 2019 21:46:42 +0000 (23:46 +0200)
committerFelix Paul Kühne <felix@feepk.net>
Tue, 16 Apr 2019 21:46:42 +0000 (23:46 +0200)
modules/gui/macosx/playlist/VLCPlaylistController.h
modules/gui/macosx/playlist/VLCPlaylistController.m

index 79b8b9e..cc5b4ab 100644 (file)
@@ -35,6 +35,8 @@ extern NSString *VLCPlaybackRepeatChanged;
 extern NSString *VLCPlaybackHasPreviousChanged;
 extern NSString *VLCPlaybackHasNextChanged;
 extern NSString *VLCPlaylistCurrentItemChanged;
+extern NSString *VLCPlaylistItemsAdded;
+extern NSString *VLCPlaylistItemsRemoved;
 
 @interface VLCPlaylistController : NSObject
 
index 076bb6d..aea9cfe 100644 (file)
@@ -37,6 +37,8 @@ NSString *VLCPlaybackRepeatChanged = @"VLCPlaybackRepeatChanged";
 NSString *VLCPlaybackHasPreviousChanged = @"VLCPlaybackHasPreviousChanged";
 NSString *VLCPlaybackHasNextChanged = @"VLCPlaybackHasNextChanged";
 NSString *VLCPlaylistCurrentItemChanged = @"VLCPlaylistCurrentItemChanged";
+NSString *VLCPlaylistItemsAdded = @"VLCPlaylistItemsAdded";
+NSString *VLCPlaylistItemsRemoved = @"VLCPlaylistItemsRemoved";
 
 @interface VLCPlaylistController ()
 {
@@ -246,6 +248,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
     [_playlistModel addItems:items atIndex:insertionIndex count:numberOfItems];
 
     [_playlistDataSource playlistUpdated];
+    [_defaultNotificationCenter postNotificationName:VLCPlaylistItemsAdded object:self];
 }
 
 - (void)playlistRemovedItemsAtIndex:(size_t)index count:(size_t)numberOfItems
@@ -254,6 +257,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
     [_playlistModel removeItemsInRange:range];
 
     [_playlistDataSource playlistUpdated];
+    [_defaultNotificationCenter postNotificationName:VLCPlaylistItemsRemoved object:self];
 }
 
 - (void)playlistUpdatedForIndex:(size_t)firstUpdatedIndex items:(vlc_playlist_item_t *const *)items count:(size_t)numberOfItems