Skip to content
Snippets Groups Projects
Commit 7af2d21e authored by Claudio Cambra's avatar Claudio Cambra Committed by Thomas Guillem
Browse files

macosx: Move data source relevant setup stuff for collection view to data...

macosx: Move data source relevant setup stuff for collection view to data source in video table view data source

Signed-off-by: default avatarClaudio Cambra <developer@claudiocambra.com>
parent fa4e8295
No related branches found
No related tags found
1 merge request!4657macosx: Add "Home" entry to library window
......@@ -39,6 +39,7 @@ extern NSString * const VLCLibraryVideoTableViewDataSourceDisplayedCollectionCha
@property (readwrite, assign) NSTableView *groupSelectionTableView;
- (void)reloadData;
- (void)setupCollectionView:(NSCollectionView *)collectionView;
@end
......
......@@ -87,6 +87,24 @@ NSString * const VLCLibraryVideoTableViewDataSourceDisplayedCollectionChangedNot
return self;
}
- (void)setupCollectionView:(NSCollectionView *)collectionView
{
[collectionView registerClass:VLCLibraryCollectionViewItem.class
forItemWithIdentifier:VLCLibraryCellIdentifier];
[collectionView registerClass:VLCLibraryCollectionViewSupplementaryElementView.class
forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader
withIdentifier:VLCLibrarySupplementaryElementViewIdentifier];
NSNib * const mediaItemSupplementaryDetailView = [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryCollectionViewMediaItemSupplementaryDetailView.class) bundle:nil];
[collectionView registerNib:mediaItemSupplementaryDetailView
forSupplementaryViewOfKind:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind
withIdentifier:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier];
collectionView.dataSource = self;
[collectionView reloadData];
}
- (NSUInteger)indexOfMediaItem:(const NSUInteger)libraryId inArray:(NSArray const *)array
{
return [array indexOfObjectPassingTest:^BOOL(VLCMediaLibraryMediaItem * const findMediaItem, const NSUInteger idx, BOOL * const stop) {
......
......@@ -146,19 +146,7 @@
_collectionViewDelegate.staticItemSize = VLCLibraryCollectionViewItem.defaultVideoItemSize;
self.videoLibraryCollectionView.delegate = _collectionViewDelegate;
self.videoLibraryCollectionView.dataSource = self.libraryVideoDataSource;
[self.videoLibraryCollectionView registerClass:VLCLibraryCollectionViewItem.class
forItemWithIdentifier:VLCLibraryCellIdentifier];
[self.videoLibraryCollectionView registerClass:VLCLibraryCollectionViewSupplementaryElementView.class
forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader
withIdentifier:VLCLibrarySupplementaryElementViewIdentifier];
NSNib * const mediaItemSupplementaryDetailView = [[NSNib alloc] initWithNibNamed:@"VLCLibraryCollectionViewMediaItemSupplementaryDetailView" bundle:nil];
[self.videoLibraryCollectionView registerNib:mediaItemSupplementaryDetailView
forSupplementaryViewOfKind:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind
withIdentifier:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier];
[self.libraryVideoDataSource setupCollectionView:self.videoLibraryCollectionView];
}
- (void)setupTableViews
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment