[vlc-commits] [Git][videolan/vlc][master] macosx: Add an internal function to VLCLibraryWindow to set current segment view

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Aug 12 11:01:03 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
663b4c0f by Claudio Cambra at 2022-08-12T10:42:27+00:00
macosx: Add an internal function to VLCLibraryWindow to set current segment view

Signed-off-by: Claudio Cambra <claudio.cambra at gmail.com>

- - - - -


2 changed files:

- modules/gui/macosx/library/VLCLibraryNavigationStack.m
- modules/gui/macosx/library/VLCLibraryWindow.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryNavigationStack.m
=====================================
@@ -76,14 +76,14 @@
 {
     NSUInteger numNavigationStates = _navigationStates.count;
 
-    return _currentPosition && 
+    return _currentPosition != nil && 
         _currentPosition.navigationStackIndex < numNavigationStates - 1 && 
         numNavigationStates > 1;
 }
 
 - (BOOL)backwardsAvailable
 {
-    return _currentPosition && 
+    return _currentPosition != nil && 
         _currentPosition.navigationStackIndex > 0 && 
         _navigationStates.count > 1;
 }


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -333,7 +333,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     _mainSplitView.delegate = self;
     _lastPlaylistWidthBeforeCollaps = VLCLibraryWindowDefaultPlaylistWidth;
 
-    [self segmentedControlAction:nil];
+    [self setViewForSelectedSegment];
     [self repeatStateUpdated:nil];
     [self shuffleStateUpdated:nil];
     
@@ -513,18 +513,11 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
 #pragma mark - misc. user interactions
 
-- (IBAction)segmentedControlAction:(id)sender
+- (void)setViewForSelectedSegment
 {
-    if (_segmentedTitleControl.selectedSegment == _currentSelectedSegment && 
-        _gridVsListSegmentedControl.selectedSegment == _currentSelectedViewModeSegment) {
-        return;
-    }
-
     _currentSelectedSegment = _segmentedTitleControl.selectedSegment;
     _currentSelectedViewModeSegment = _gridVsListSegmentedControl.selectedSegment;
 
-    [self invalidateRestorableState];
-
     switch (_segmentedTitleControl.selectedSegment) {
         case 0:
             [self showVideoLibrary];
@@ -538,6 +531,17 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
             [self showMediaSourceAppearance];
             break;
     }
+}
+
+- (IBAction)segmentedControlAction:(id)sender
+{
+    if (_segmentedTitleControl.selectedSegment == _currentSelectedSegment && 
+        _gridVsListSegmentedControl.selectedSegment == _currentSelectedViewModeSegment) {
+        return;
+    }
+
+    [self setViewForSelectedSegment];
+    [self invalidateRestorableState];
 
     if(sender != _navigationStack) {
         [self.navigationStack appendCurrentLibraryState];
@@ -879,7 +883,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     [self.librarySortButton setHidden:NO];
     [self.librarySearchField setEnabled:YES];
 
-    [self segmentedControlAction:nil];
+    [self setViewForSelectedSegment];
 
     if (self.nativeFullscreenMode) {
         [self showControlsBar];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/663b4c0f322e397d45f4662de739733568095531

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