[vlc-commits] macosx/CAS: replace deprecated API calls with modern blocks-based counterparts

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


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Aug 23 12:30:43 2012 +0200| [41041ace1d524337072c7c387bead6f066ec574d] | committer: Felix Paul Kühne

macosx/CAS: replace deprecated API calls with modern blocks-based counterparts

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

 modules/gui/macosx/ConvertAndSave.m |   48 +++++++++++++++--------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m
index f01d9cd..6ac50e6 100644
--- a/modules/gui/macosx/ConvertAndSave.m
+++ b/modules/gui/macosx/ConvertAndSave.m
@@ -298,17 +298,14 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [openPanel setCanChooseDirectories:NO];
     [openPanel setResolvesAliases:YES];
     [openPanel setAllowsMultipleSelection:NO];
-    [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow: _window modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
-}
-
-- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode  contextInfo:(void  *)contextInfo
-{
-    if (returnCode == NSOKButton)
-    {
-        [self setMRL: [NSString stringWithUTF8String:vlc_path2uri([[[panel URL] path] UTF8String], NULL)]];
-        [self updateOKButton];
-        [self updateDropView];
-    }
+    [openPanel beginSheetModalForWindow:_window completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSOKButton)
+        {
+            [self setMRL: [NSString stringWithUTF8String:vlc_path2uri([[[openPanel URL] path] UTF8String], NULL)]];
+            [self updateOKButton];
+            [self updateDropView];
+        }
+    }];
 }
 
 - (IBAction)switchProfile:(id)sender
@@ -418,22 +415,19 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [saveFilePanel setCanCreateDirectories: YES];
     if ([[_customize_encap_matrix selectedCell] tag] != RAW) // there is no clever guess for this
         [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
-    [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:_window modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
-}
-
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
-    if (returnCode == NSOKButton) {
-        [self setOutputDestination:[[sheet URL] path]];
-        [_destination_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
-        [[_destination_filename_stub_lbl animator] setHidden: YES];
-        [[_destination_filename_lbl animator] setHidden: NO];
-    } else {
-        [self setOutputDestination:@""];
-        [[_destination_filename_lbl animator] setHidden: YES];
-        [[_destination_filename_stub_lbl animator] setHidden: NO];
-    }
-    [self updateOKButton];
+    [saveFilePanel beginSheetModalForWindow:_window completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSOKButton) {
+            [self setOutputDestination:[[saveFilePanel URL] path]];
+            [_destination_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
+            [[_destination_filename_stub_lbl animator] setHidden: YES];
+            [[_destination_filename_lbl animator] setHidden: NO];
+        } else {
+            [self setOutputDestination:@""];
+            [[_destination_filename_lbl animator] setHidden: YES];
+            [[_destination_filename_stub_lbl animator] setHidden: NO];
+        }
+        [self updateOKButton];        
+    }];
 }
 
 - (IBAction)showStreamPanel:(id)sender



More information about the vlc-commits mailing list