[vlc-commits] macosx/prefs_widgets: 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:13:36 2012 +0200| [012fa5d2e5fd847cdc4139054eb7d32d1f9f364d] | committer: Felix Paul Kühne

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

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

 modules/gui/macosx/prefs_widgets.h |    1 -
 modules/gui/macosx/prefs_widgets.m |   26 +++++++-------------------
 2 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/modules/gui/macosx/prefs_widgets.h b/modules/gui/macosx/prefs_widgets.h
index c0b35a2..31853ef 100644
--- a/modules/gui/macosx/prefs_widgets.h
+++ b/modules/gui/macosx/prefs_widgets.h
@@ -89,7 +89,6 @@ static NSMenu   *o_keys_menu = nil;
            withView: (NSView *)o_parent_view;
 
 - (IBAction)openFileDialog: (id)sender;
-- (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void  *)o_context_info;
 
 @end
 
diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index ef3043c..a7d129f 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -1235,25 +1235,13 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];       \
     [o_open_panel setAllowsMultipleSelection: NO];
     [o_open_panel setCanChooseFiles: !b_directory];
     [o_open_panel setCanChooseDirectories: b_directory];
-    [o_open_panel beginSheetForDirectory:nil
-        file:nil
-        types:nil
-        modalForWindow:[sender window]
-        modalDelegate: self
-        didEndSelector: @selector(pathChosenInPanel:
-                        withReturn:
-                        contextInfo:)
-        contextInfo: nil];
-}
-
-- (void)pathChosenInPanel:(NSOpenPanel *)o_sheet
-    withReturn:(int)i_return_code contextInfo:(void  *)o_context_info
-{
-    if( i_return_code == NSOKButton )
-    {
-        NSString *o_path = [[[o_sheet URLs] objectAtIndex: 0] path];
-        [o_textfield setStringValue: o_path];
-    }
+    [o_open_panel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) {
+        if( returnCode == NSOKButton )
+        {
+            NSString *o_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+            [o_textfield setStringValue: o_path];
+        }        
+    }];
 }
 
 - (char *)stringValue



More information about the vlc-commits mailing list