From b18a63a5609ede8801f05385b12552fb801bebee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net> Date: Tue, 29 Jan 2019 23:23:23 +0100 Subject: [PATCH] macosx: minor cleanup --- modules/gui/macosx/VLCExtensionsManager.h | 6 ------ modules/gui/macosx/VLCExtensionsManager.m | 5 +---- modules/gui/macosx/VLCMain+OldPrefs.m | 7 ++++--- modules/gui/macosx/VLCMain.m | 9 +++------ modules/gui/macosx/VLCStatusBarIcon.m | 21 ++++++++++----------- po/POTFILES.in | 10 ++++++++-- 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/modules/gui/macosx/VLCExtensionsManager.h b/modules/gui/macosx/VLCExtensionsManager.h index 45052c1f3374..0f14e8267609 100644 --- a/modules/gui/macosx/VLCExtensionsManager.h +++ b/modules/gui/macosx/VLCExtensionsManager.h @@ -27,12 +27,6 @@ #import "VLCExtensionsDialogProvider.h" #import "VLCMain.h" -#import <vlc_extensions.h> - -#import <Cocoa/Cocoa.h> - -@class VLCExtensionsDialogProvider; - @interface VLCExtensionsManager : NSObject - (void)buildMenu:(NSMenu *)extMenu; diff --git a/modules/gui/macosx/VLCExtensionsManager.m b/modules/gui/macosx/VLCExtensionsManager.m index 4c98affc9dce..8d806bc5bc01 100644 --- a/modules/gui/macosx/VLCExtensionsManager.m +++ b/modules/gui/macosx/VLCExtensionsManager.m @@ -26,6 +26,7 @@ #import "VLCExtensionsDialogProvider.h" #import <vlc_modules.h> +#import <vlc_extensions.h> #import "assert.h" #define MENU_MAP(a,e) ((uint32_t)((((uint16_t)a) << 16) | ((uint16_t)e))) @@ -37,8 +38,6 @@ extensions_manager_t *p_extensions_manager; VLCExtensionsDialogProvider *_extensionDialogProvider; - NSMutableDictionary *p_extDict; - BOOL b_failed; ///< Flag set to true if we could not load the module } @end @@ -53,8 +52,6 @@ p_extensions_manager = NULL; _extensionDialogProvider = [[VLCExtensionsDialogProvider alloc] init]; - p_extDict = [[NSMutableDictionary alloc] init]; - _isUnloading = false; b_failed = false; } diff --git a/modules/gui/macosx/VLCMain+OldPrefs.m b/modules/gui/macosx/VLCMain+OldPrefs.m index c382d10ff98f..8a5b83666f30 100644 --- a/modules/gui/macosx/VLCMain+OldPrefs.m +++ b/modules/gui/macosx/VLCMain+OldPrefs.m @@ -46,14 +46,15 @@ static const int kCurrentPreferencesVersion = 4; - (void)resetAndReinitializeUserDefaults { + NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults]; // note that [NSUserDefaults resetStandardUserDefaults] will NOT correctly reset to the defaults NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier]; - [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain]; + [standardUserDefaults removePersistentDomainForName:appDomain]; // set correct version to avoid question about outdated config - [[NSUserDefaults standardUserDefaults] setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion]; - [[NSUserDefaults standardUserDefaults] synchronize]; + [standardUserDefaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion]; + [standardUserDefaults synchronize]; } - (void)migrateOldPreferences diff --git a/modules/gui/macosx/VLCMain.m b/modules/gui/macosx/VLCMain.m index 631239d25c87..a8d052167ec5 100644 --- a/modules/gui/macosx/VLCMain.m +++ b/modules/gui/macosx/VLCMain.m @@ -169,7 +169,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, VLCOpenWindowController *_open; VLCCoreDialogProvider *_coredialogs; VLCBookmarksWindowController *_bookmarks; - VLCCoreInteraction *_coreinteraction; VLCResumeDialogController *_resume_dialog; VLCInputManager *_input_manager; VLCPlaylist *_playlist; @@ -274,8 +273,6 @@ static VLCMain *sharedInstance = nil; - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { - _coreinteraction = [VLCCoreInteraction sharedInstance]; - #ifdef HAVE_SPARKLE [[SUUpdater sharedUpdater] setDelegate:self]; #endif @@ -288,7 +285,7 @@ static VLCMain *sharedInstance = nil; if (!p_intf) return; - [_coreinteraction updateCurrentlyUsedHotkeys]; + [[VLCCoreInteraction sharedInstance] updateCurrentlyUsedHotkeys]; [self migrateOldPreferences]; @@ -363,7 +360,7 @@ static VLCMain *sharedInstance = nil; - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update { [NSApp activateIgnoringOtherApps:YES]; - [_coreinteraction stop]; + [[VLCCoreInteraction sharedInstance] stop]; } /* don't be enthusiastic about an update if we currently play a video */ @@ -382,7 +379,7 @@ static VLCMain *sharedInstance = nil; /* Triggered when the computer goes to sleep */ - (void)computerWillSleep: (NSNotification *)notification { - [_coreinteraction pause]; + [[VLCCoreInteraction sharedInstance] pause]; } #pragma mark - diff --git a/modules/gui/macosx/VLCStatusBarIcon.m b/modules/gui/macosx/VLCStatusBarIcon.m index 00edd6ac528f..fcc77026af9f 100644 --- a/modules/gui/macosx/VLCStatusBarIcon.m +++ b/modules/gui/macosx/VLCStatusBarIcon.m @@ -74,7 +74,6 @@ #pragma mark - #pragma mark Init - - (instancetype)init { self = [super init]; @@ -114,15 +113,16 @@ [_vlcStatusBarIconMenu setDelegate:self]; // Register notifications - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(updateNowPlayingInfo) - name:VLCInputChangedNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(configurationChanged:) - name:VLCConfigurationChangedNotification - object:nil]; + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter addObserver:self + selector:@selector(updateNowPlayingInfo) + name:VLCInputChangedNotification + object:nil]; + + [notificationCenter addObserver:self + selector:@selector(configurationChanged:) + name:VLCConfigurationChangedNotification + object:nil]; } - (void)observeValueForKeyPath:(NSString *)keyPath @@ -168,7 +168,6 @@ // Attach pull-down menu [self.statusItem setMenu:_vlcStatusBarIconMenu]; - if (@available(macOS 10.12, *)) { [self.statusItem setBehavior:NSStatusItemBehaviorRemovalAllowed]; [self.statusItem setAutosaveName:@"statusBarItem"]; diff --git a/po/POTFILES.in b/po/POTFILES.in index 96eb497c4ff7..1f15f8097e71 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -465,6 +465,8 @@ modules/gui/macosx/VLCBookmarksWindowController.h modules/gui/macosx/VLCBookmarksWindowController.m modules/gui/macosx/VLCBottomBarView.h modules/gui/macosx/VLCBottomBarView.m +modules/gui/macosx/VLCClickerManager.h +modules/gui/macosx/VLCClickerManager.m modules/gui/macosx/VLCControlsBarCommon.h modules/gui/macosx/VLCControlsBarCommon.m modules/gui/macosx/VLCConvertAndSaveWindowController.h @@ -477,6 +479,8 @@ modules/gui/macosx/VLCDefaultValueSlider.h modules/gui/macosx/VLCDefaultValueSlider.m modules/gui/macosx/VLCDefaultValueSliderCell.h modules/gui/macosx/VLCDefaultValueSliderCell.m +modules/gui/macosx/VLCDetachedVideoWindow.h +modules/gui/macosx/VLCDetachedVideoWindow.m modules/gui/macosx/VLCDocumentController.h modules/gui/macosx/VLCDocumentController.m modules/gui/macosx/VLCErrorWindowController.h @@ -551,6 +555,10 @@ modules/gui/macosx/VLCUIWidgets.h modules/gui/macosx/VLCUIWidgets.m modules/gui/macosx/VLCVideoEffectsWindowController.h modules/gui/macosx/VLCVideoEffectsWindowController.m +modules/gui/macosx/VLCVideoFilterHelper.h +modules/gui/macosx/VLCVideoFilterHelper.m +modules/gui/macosx/VLCVideoOutputProvider.h +modules/gui/macosx/VLCVideoOutputProvider.m modules/gui/macosx/VLCVideoWindowCommon.h modules/gui/macosx/VLCVideoWindowCommon.m modules/gui/macosx/VLCVolumeSlider.h @@ -559,8 +567,6 @@ modules/gui/macosx/VLCVolumeSliderCell.h modules/gui/macosx/VLCVolumeSliderCell.m modules/gui/macosx/VLCVoutView.h modules/gui/macosx/VLCVoutView.m -modules/gui/macosx/VLCVideoOutputProvider.h -modules/gui/macosx/VLCVideoOutputProvider.m modules/gui/macosx/VLCWindow.h modules/gui/macosx/VLCWindow.m modules/gui/macosx/VLCWrappableTextField.h -- GitLab