[vlc-commits] macosx/open: replace deprecated API call with modern blocks-based counterpart

Felix Paul Kühne git at videolan.org
Thu Aug 23 12:17:35 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Aug 23 12:09:07 2012 +0200| [a549e879f806ea4229b28c36fea89177e1c19fa9] | committer: Felix Paul Kühne

macosx/open: replace deprecated API call with modern blocks-based counterpart

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

 modules/gui/macosx/open.h |    1 -
 modules/gui/macosx/open.m |   32 ++++++++++----------------------
 2 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/modules/gui/macosx/open.h b/modules/gui/macosx/open.h
index f1aa519..987707f 100644
--- a/modules/gui/macosx/open.h
+++ b/modules/gui/macosx/open.h
@@ -266,7 +266,6 @@
 - (void)openFileGeneric;
 - (void)openFilePathChanged:(NSNotification *)o_notification;
 - (IBAction)openFileBrowse:(id)sender;
-- (void)pathChosenInPanel: (NSOpenPanel *)sheet withReturn:(int)returnCode contextInfo:(void *)contextInfo;
 - (IBAction)openFileStreamChanged:(id)sender;
 
 - (void)openDisc;
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index ac053dd..546a21e 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -752,28 +752,16 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [o_open_panel setCanChooseDirectories: YES];
     [o_open_panel setTitle: _NS("Open File")];
     [o_open_panel setPrompt: _NS("Open")];
-
-    [o_open_panel beginSheetForDirectory:nil
-        file:nil
-        types:nil
-        modalForWindow:[sender window]
-        modalDelegate: self
-        didEndSelector: @selector(pathChosenInPanel:
-                        withReturn:
-                        contextInfo:)
-        contextInfo: nil];
-}
-
-- (void)pathChosenInPanel: (NSOpenPanel *) sheet withReturn:(int)returnCode contextInfo:(void  *)contextInfo
-{
-    if (returnCode == NSFileHandlingPanelOKButton)
-    {
-        if( o_file_path )
-            [o_file_path release];
-        o_file_path = [[[sheet URLs] objectAtIndex: 0] path];
-        [o_file_path retain];
-        [self openFilePathChanged: nil];
-    }
+    [o_open_panel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSFileHandlingPanelOKButton)
+        {
+            if( o_file_path )
+                [o_file_path release];
+            o_file_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+            [o_file_path retain];
+            [self openFilePathChanged: nil];
+        }
+    }];
 }
 
 - (IBAction)openFileStreamChanged:(id)sender



More information about the vlc-commits mailing list