[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Also scroll to visibile when using audio data source select indices

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Apr 6 16:06:54 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
ab50cb36 by Claudio Cambra at 2025-04-06T15:43:20+00:00
macosx: Also scroll to visibile when using audio data source select indices

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
097e5cc0 by Claudio Cambra at 2025-04-06T15:43:20+00:00
macosx: Use audio data source selection method in audio view controller for table view

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
34ed2bd4 by Claudio Cambra at 2025-04-06T15:43:20+00:00
macosx: Fix presenting item in current audio library segment

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


2 changed files:

- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m


Changes:

=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -701,11 +701,12 @@ NSString * const VLCLibraryAudioDataSourceDisplayedCollectionChangedNotification
         return;
     }
 
+    const NSInteger selectedRow = indices.firstIndex;
     if (tableView.selectedRowIndexes != indices) {
         [tableView selectRowIndexes:indices byExtendingSelection:NO];
+        [tableView scrollRowToVisible:selectedRow];
     }
 
-    const NSInteger selectedRow = indices.firstIndex;
     if (selectedRow >= self.displayedCollection.count) {
         return;
     }


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -429,8 +429,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
     const NSInteger rowForLibraryItem = [self.audioDataSource rowForLibraryItem:libraryItem];
     if (rowForLibraryItem != NSNotFound) {
         NSIndexSet * const indexSet = [NSIndexSet indexSetWithIndex:rowForLibraryItem];
-        [targetMainTableView selectRowIndexes:indexSet byExtendingSelection:NO];
-        [targetMainTableView scrollRowToVisible:rowForLibraryItem];
+        [self.audioDataSource tableView:targetMainTableView selectRowIndices:indexSet];
     }
 }
 
@@ -460,7 +459,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
     }
 }
 
-- (void)presentLibraryItemWaitForDataSourceFinished:(NSNotification *)aNotification
+- (void)presentLibraryItemWaitForDataSourceFinished:(nullable NSNotification *)aNotification
 {
     if (self.audioDataSource.displayedCollectionCount < self.audioDataSource.collectionToDisplayCount) {
         return;
@@ -503,12 +502,17 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
         segmentType = VLCLibrarySongsMusicSubSegmentType;
     }
 
+    VLCLibraryWindow * const libraryWindow = self.libraryWindow;
+    if (segmentType == libraryWindow.librarySegmentType) {
+        [self presentLibraryItemWaitForDataSourceFinished:nil];
+        return;
+    }
+
     [NSNotificationCenter.defaultCenter addObserver:self
                                            selector:@selector(presentLibraryItemWaitForDataSourceFinished:)
                                                name:VLCLibraryAudioDataSourceDisplayedCollectionChangedNotification
                                              object:self.audioDataSource];
 
-    VLCLibraryWindow * const libraryWindow = self.libraryWindow;
     libraryWindow.librarySegmentType = segmentType;
     [libraryWindow.splitViewController.navSidebarViewController selectSegment:segmentType];
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d2b02a761ed35ef6e9ca62a9c540632991faa3b4...34ed2bd42cb693ce8d34548fa92e05817c2549ca

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d2b02a761ed35ef6e9ca62a9c540632991faa3b4...34ed2bd42cb693ce8d34548fa92e05817c2549ca
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list