Commit 876dc9a6 authored by David Fuhrmann's avatar David Fuhrmann

macosx: simplify more updaters

parent 91751dbd
...@@ -145,8 +145,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -145,8 +145,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (void)plItemUpdated; - (void)plItemUpdated;
- (void)playbackModeUpdated; - (void)playbackModeUpdated;
- (void)updateVolume;
- (void)showMainWindow;
- (void)showFullscreenController; - (void)showFullscreenController;
- (void)updateTogglePlaylistState; - (void)updateTogglePlaylistState;
......
...@@ -359,22 +359,21 @@ static int PlaybackModeUpdated(vlc_object_t *p_this, const char *psz_var, ...@@ -359,22 +359,21 @@ static int PlaybackModeUpdated(vlc_object_t *p_this, const char *psz_var,
static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var, static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param) vlc_value_t oldval, vlc_value_t new_val, void *param)
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; dispatch_async(dispatch_get_main_queue(), ^{
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateVolume) withObject:nil waitUntilDone:NO]; [[[VLCMain sharedInstance] mainWindow] updateVolumeSlider];
});
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int BossCallback(vlc_object_t *p_this, const char *psz_var, static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param) vlc_value_t oldval, vlc_value_t new_val, void *param)
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; dispatch_async(dispatch_get_main_queue(), ^{
[[VLCCoreInteraction sharedInstance] pause];
[[VLCCoreInteraction sharedInstance] performSelectorOnMainThread:@selector(pause) withObject:nil waitUntilDone:NO]; [[VLCApplication sharedApplication] hide:nil];
[[VLCApplication sharedApplication] hide:nil]; });
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -386,15 +385,21 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var, ...@@ -386,15 +385,21 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
static int ShowController(vlc_object_t *p_this, const char *psz_variable, static int ShowController(vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param) vlc_value_t old_val, vlc_value_t new_val, void *param)
{ {
intf_thread_t * p_intf = VLCIntf;
if (p_intf) { dispatch_async(dispatch_get_main_queue(), ^{
playlist_t * p_playlist = pl_Get(p_intf);
BOOL b_fullscreen = var_GetBool(p_playlist, "fullscreen"); intf_thread_t * p_intf = VLCIntf;
if (b_fullscreen) if (p_intf) {
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO]; playlist_t * p_playlist = pl_Get(p_intf);
else if (!strcmp(psz_variable, "intf-show")) BOOL b_fullscreen = var_GetBool(p_playlist, "fullscreen");
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(showMainWindow) withObject:nil waitUntilDone:NO]; if (b_fullscreen)
} [[VLCMain sharedInstance] showFullscreenController];
else if (!strcmp(psz_variable, "intf-show"))
[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
}
});
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1225,11 +1230,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1225,11 +1230,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_info updateMetadata]; [o_info updateMetadata];
} }
- (void)showMainWindow
{
[o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO];
}
- (void)showFullscreenController - (void)showFullscreenController
{ {
// defer selector here (possibly another time) to ensure that keyWindow is set properly // defer selector here (possibly another time) to ensure that keyWindow is set properly
...@@ -1237,11 +1237,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1237,11 +1237,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO]; [o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
} }
- (void)updateVolume
{
[o_mainwindow updateVolumeSlider];
}
- (void)playbackModeUpdated - (void)playbackModeUpdated
{ {
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t * p_playlist = pl_Get(VLCIntf);
...@@ -1263,9 +1258,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1263,9 +1258,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_mainmenu setShuffle]; [o_mainmenu setShuffle];
} }
#pragma mark -
#pragma mark Window updater
- (void)setActiveVideoPlayback:(BOOL)b_value - (void)setActiveVideoPlayback:(BOOL)b_value
{ {
assert([NSThread isMainThread]); assert([NSThread isMainThread]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment