[vlc-commits] [Git][videolan/vlc][master] macosx: Prevent collapsing of sidebar navigation section if a child is selected

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jun 15 17:26:44 UTC 2025



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


Commits:
310679ff by Claudio Cambra at 2025-06-15T17:10:12+00:00
macosx: Prevent collapsing of sidebar navigation section if a child is selected

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

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m
=====================================
@@ -403,4 +403,20 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
     return segment.segmentType == VLCLibraryHeaderSegmentType;
 }
 
+- (BOOL)outlineView:(nonnull NSOutlineView *)outlineView shouldCollapseItem:(nonnull id)item
+{
+    NSAssert(outlineView == _outlineView, @"VLCLibraryWindowNavigationSidebarController should only be a delegate for the libraryWindow nav sidebar outline view!");
+
+    // Don't allow collapsing the parent segment of the selected segment, if selection is a child
+    NSTreeNode * const treeNode = (NSTreeNode *)item;
+    VLCLibrarySegment * const segment = (VLCLibrarySegment *)treeNode.representedObject;
+    NSTreeNode * const selectedSegmentItem = (NSTreeNode *)[self.outlineView itemAtRow:self.outlineView.selectedRow];
+    VLCLibrarySegment * const selectedSegment = (VLCLibrarySegment *)selectedSegmentItem.representedObject;
+    const NSInteger childNodeIndex = [segment.childNodes indexOfObjectPassingTest:^BOOL(NSTreeNode * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+        VLCLibrarySegment * const childSegment = (VLCLibrarySegment *)obj;
+        return childSegment.segmentType == selectedSegment.segmentType;
+    }];
+    return childNodeIndex == NSNotFound;
+}
+
 @end



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/310679ffe75472ab8ebc76e1450f760304e38882

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/310679ffe75472ab8ebc76e1450f760304e38882
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