[vlc-commits] macosx: unify to a single notification in case the preferences were updated

Felix Paul Kühne git at videolan.org
Sat Jun 1 14:35:01 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Jun  1 12:36:40 2019 +0200| [bf29748e452efa0e3a018f550ee68be71a1bb9be] | committer: Felix Paul Kühne

macosx: unify to a single notification in case the preferences were updated

Performance and logically wise, there is no need to differentiate between the settings as users rarely change settings repeatedly.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf29748e452efa0e3a018f550ee68be71a1bb9be
---

 modules/gui/macosx/extensions/NSFont+VLCAdditions.h       | 2 --
 modules/gui/macosx/extensions/NSFont+VLCAdditions.m       | 2 --
 modules/gui/macosx/library/VLCLibraryCollectionViewItem.m | 2 +-
 modules/gui/macosx/library/VLCLibraryWindow.m             | 2 +-
 modules/gui/macosx/os-integration/VLCClickerManager.h     | 2 --
 modules/gui/macosx/os-integration/VLCClickerManager.m     | 4 +---
 modules/gui/macosx/playlist/VLCPlaylistTableCellView.m    | 3 ++-
 modules/gui/macosx/preferences/VLCSimplePrefsController.m | 6 +-----
 modules/gui/macosx/preferences/prefs.m                    | 7 +------
 9 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
index bb23598fb0..bd191ef836 100644
--- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
+++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h
@@ -24,8 +24,6 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-extern NSString *VLCMacOSXInterfaceLargeTextSettingChanged;
-
 @interface NSFont (VLCAdditions)
 
 + (instancetype)VLClibrarySectionHeaderFont;
diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
index 98692a08a5..97bce61bcd 100644
--- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
+++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m
@@ -22,8 +22,6 @@
 
 #import "NSFont+VLCAdditions.h"
 
-NSString *VLCMacOSXInterfaceLargeTextSettingChanged = @"VLCMacOSXInterfaceLargeTextSettingChanged";
-
 @implementation NSFont (VLCAdditions)
 
 + (instancetype)VLClibrarySectionHeaderFont
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
index 293ad84ff9..a35a9ff405 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
@@ -59,7 +59,7 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
                                  object:nil];
         [notificationCenter addObserver:self
                                selector:@selector(updateFontBasedOnSetting:)
-                                   name:VLCMacOSXInterfaceLargeTextSettingChanged
+                                   name:VLCConfigurationChangedNotification
                                  object:nil];
     }
     return self;
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index ddcf11708d..1b9409d179 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -124,7 +124,7 @@ const CGFloat VLCLibraryWindowDefaultPlaylistWidth = 340.;
                              object:nil];
     [notificationCenter addObserver:self
                            selector:@selector(updateViewCellDimensionsBasedOnSetting:)
-                               name:VLCMacOSXInterfaceLargeTextSettingChanged
+                               name:VLCConfigurationChangedNotification
                              object:nil];
 
     if (@available(macOS 10_14, *)) {
diff --git a/modules/gui/macosx/os-integration/VLCClickerManager.h b/modules/gui/macosx/os-integration/VLCClickerManager.h
index e3bf7dfd2b..13f09de528 100644
--- a/modules/gui/macosx/os-integration/VLCClickerManager.h
+++ b/modules/gui/macosx/os-integration/VLCClickerManager.h
@@ -22,8 +22,6 @@
 
 #import <Foundation/Foundation.h>
 
-extern NSString *VLCMediaKeySupportSettingChangedNotification;
-
 @interface VLCClickerManager : NSObject
 
 @end
diff --git a/modules/gui/macosx/os-integration/VLCClickerManager.m b/modules/gui/macosx/os-integration/VLCClickerManager.m
index 6762b2368f..cefd370507 100644
--- a/modules/gui/macosx/os-integration/VLCClickerManager.m
+++ b/modules/gui/macosx/os-integration/VLCClickerManager.m
@@ -30,8 +30,6 @@
 #import "playlist/VLCPlaylistModel.h"
 #import "playlist/VLCPlayerController.h"
 
-NSString *VLCMediaKeySupportSettingChangedNotification = @"VLCMediaKeySupportSettingChangedNotification";
-
 @interface VLCClickerManager()
 {
     VLCPlaylistController *_playlistController;
@@ -65,7 +63,7 @@ NSString *VLCMediaKeySupportSettingChangedNotification = @"VLCMediaKeySupportSet
         }
         [notificationCenter addObserver:self
                                selector:@selector(coreChangedMediaKeySupportSetting:)
-                                   name:VLCMediaKeySupportSettingChangedNotification
+                                   name:VLCConfigurationChangedNotification
                                  object:nil];
         [notificationCenter addObserver:self
                                selector:@selector(playlistUpdated:)
diff --git a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
index b136aa4576..196c0bffae 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
@@ -25,6 +25,7 @@
 #import "extensions/NSFont+VLCAdditions.h"
 #import "playlist/VLCPlaylistItem.h"
 #import "views/VLCImageView.h"
+#import "main/VLCMain.h"
 
 @interface VLCPlaylistTableCellView ()
 {
@@ -40,7 +41,7 @@
     [self updateFontsBasedOnSetting:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self
                                              selector:@selector(updateFontsBasedOnSetting:)
-                                                 name:VLCMacOSXInterfaceLargeTextSettingChanged
+                                                 name:VLCConfigurationChangedNotification
                                                object:nil];
 }
 
diff --git a/modules/gui/macosx/preferences/VLCSimplePrefsController.m b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
index be4ae46b60..fa9584b885 100644
--- a/modules/gui/macosx/preferences/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
@@ -1105,11 +1105,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
 
     /* okay, let's save our changes to vlcrc */
     config_SaveConfigFile(p_intf);
-
-    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-    [notificationCenter postNotificationName:VLCMediaKeySupportSettingChangedNotification object:nil];
-    [notificationCenter postNotificationName:VLCMacOSXInterfaceLargeTextSettingChanged object:nil];
-    [notificationCenter postNotificationName:VLCConfigurationChangedNotification object:nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:VLCConfigurationChangedNotification object:nil];
 }
 
 - (void)showSettingsForCategory:(NSView *)categoryView
diff --git a/modules/gui/macosx/preferences/prefs.m b/modules/gui/macosx/preferences/prefs.m
index d186e55550..f62a3bc02c 100644
--- a/modules/gui/macosx/preferences/prefs.m
+++ b/modules/gui/macosx/preferences/prefs.m
@@ -61,8 +61,6 @@
 #import "preferences/prefs.h"
 #import "preferences/VLCSimplePrefsController.h"
 #import "preferences/prefs_widgets.h"
-#import "extensions/NSFont+VLCAdditions.h"
-#import "os-integration/VLCClickerManager.h"
 
 #define LEFTMARGIN  18
 #define RIGHTMARGIN 18
@@ -218,10 +216,7 @@
     [_rootTreeItem applyChanges];
     fixIntfSettings();
     config_SaveConfigFile(getIntf());
-    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-    [notificationCenter postNotificationName:VLCMediaKeySupportSettingChangedNotification object:nil];
-    [notificationCenter postNotificationName:VLCMacOSXInterfaceLargeTextSettingChanged object:nil];
-    [notificationCenter postNotificationName:VLCConfigurationChangedNotification object:nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:VLCConfigurationChangedNotification object:nil];
     [self.window orderOut:self];
 }
 



More information about the vlc-commits mailing list