[vlc-devel] commit: macosx: implemented on-the-fly activation of the Media Key support ( Felix Paul Kühne )

git version control git at videolan.org
Thu Jul 16 16:49:51 CEST 2009


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Jul 16 16:49:46 2009 +0200| [c8962190b30ad45fa69ee255ee734fa7e55bca6c] | committer: Felix Paul Kühne 

macosx: implemented on-the-fly activation of the Media Key support

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

 modules/gui/macosx/intf.h         |    2 +-
 modules/gui/macosx/intf.m         |   11 +++++++++--
 modules/gui/macosx/simple_prefs.m |    3 +++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index e974688..d5ca3d9 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -433,7 +433,7 @@ struct intf_sys_t
 	BOOL b_mediaKeySupport;
 }
 
-- (void)enableMediaKeySupport:(BOOL)b_value;
+- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
 - (void)sendEvent: (NSEvent*)event;
 - (void)resetJump;
 
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 6f489ea..25494bd 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -2863,11 +2863,18 @@ end:
 - (void)awakeFromNib
 {
 	b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
+    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
 }
 
-- (void)enableMediaKeySupport:(BOOL)b_value
+- (void)dealloc
 {
-	b_mediaKeySupport = b_value;
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+    [super dealloc];
+}
+
+- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
+{
+	b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
 }
 
 - (void)sendEvent: (NSEvent*)event
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 35a482d..701a4cd 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -748,6 +748,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
 			[[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]];
 		else
 			[[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]];
+        [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged" 
+                                                            object: nil 
+                                                          userInfo: nil];
 
         /* okay, let's save our changes to vlcrc */
         i = config_SaveConfigFile( p_intf, "main" );




More information about the vlc-devel mailing list