Skip to content

Commit

Permalink
macosx: Disconnect/reconnect current data source upon receiving video…
Browse files Browse the repository at this point in the history
… view notifications from library window

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
  • Loading branch information
claucambra authored and robUx4 committed Sep 16, 2024
1 parent 94ebff9 commit 5360293
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

#import "VLCLibraryAbstractSegmentViewController.h"

#import "VLCLibraryWindow.h"
#import "library/VLCLibraryDataSource.h"
#import "library/VLCLibraryWindow.h"

@implementation VLCLibraryAbstractSegmentViewController

Expand All @@ -36,6 +37,16 @@ - (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
_emptyLibraryView = libraryWindow.emptyLibraryView;
_placeholderImageView = libraryWindow.placeholderImageView;
_placeholderLabel = libraryWindow.placeholderLabel;

NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
[notificationCenter addObserver:self
selector:@selector(libraryWindowPresentedVideoView:)
name:VLCLibraryWindowEmbeddedVideoViewPresentedNotification
object:nil];
[notificationCenter addObserver:self
selector:@selector(libraryWindowDismissedVideoView:)
name:VLCLibraryWindowEmbeddedVideoViewDismissedNotification
object:nil];
}
return self;
}
Expand All @@ -46,4 +57,14 @@ - (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
return nil;
}

- (void)libraryWindowPresentedVideoView:(NSNotification *)notification
{
[self.currentDataSource disconnect];
}

- (void)libraryWindowDismissedVideoView:(NSNotification *)notification
{
[self.currentDataSource connect];
}

@end

0 comments on commit 5360293

Please sign in to comment.