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

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


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

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

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

 modules/gui/macosx/wizard.m |   48 +++++++++++++------------------------------
 1 file changed, 14 insertions(+), 34 deletions(-)

diff --git a/modules/gui/macosx/wizard.m b/modules/gui/macosx/wizard.m
index aea2f60..95d30c7 100644
--- a/modules/gui/macosx/wizard.m
+++ b/modules/gui/macosx/wizard.m
@@ -1626,18 +1626,10 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     NSOpenPanel * openPanel = [NSOpenPanel openPanel];
     SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
-    [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
-}
-
-- (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet
-                       returnCode: (int)returnCode
-                      contextInfo: (void *)contextInfo
-{
-    if (returnCode == NSOKButton)
-    {
-        [o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
-    }
+    [openPanel beginSheetModalForWindow: o_wizard_window completionHandler: ^(NSInteger returnCode) {
+        if (returnCode == NSOKButton)
+            [o_t2_fld_pathToNewStrm setStringValue: [[openPanel URL] absoluteString]];
+    }];
 }
 
 - (IBAction)t2_chooseStreamOrPlst:(id)sender
@@ -1830,8 +1822,6 @@ static VLCWizard *_o_sharedInstance = nil;
      * his/her new file. We take a modified NSOpenPanel to select a folder
      * and a plain NSSavePanel to save a single file. */
 
-    SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
-
     if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
     {
         NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
@@ -1840,8 +1830,11 @@ static VLCWizard *_o_sharedInstance = nil;
         [saveFolderPanel setCanChooseFiles: NO];
         [saveFolderPanel setCanSelectHiddenExtension: NO];
         [saveFolderPanel setCanCreateDirectories: YES];
-        [saveFolderPanel beginSheetForDirectory:nil file:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+        [saveFolderPanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
+            if (returnCode == NSOKButton)
+                [o_t7_fld_filePath setStringValue: [NSString stringWithFormat: @"%@/", [[saveFolderPanel URL] path]]];
+        }];
+        [saveFolderPanel release];
     }
     else
     {
@@ -1860,25 +1853,12 @@ static VLCWizard *_o_sharedInstance = nil;
 
         [saveFilePanel setCanSelectHiddenExtension: YES];
         [saveFilePanel setCanCreateDirectories: YES];
-        [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
-    }
-}
-
-- (void)t7_getTrnscdDestFile: (NSOpenPanel *)sheet returnCode:
-    (int)returnCode contextInfo: (void *)contextInfo
-{
-    if (returnCode == NSOKButton)
-    {
-        /* output returned path to text-field, add a / to the end if the user
-         * selected a folder */
-        if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
-            [o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
-                @"%@/", [[sheet URL] path]]];
-        else
-            [o_t7_fld_filePath setStringValue:[[sheet URL] path]];
+        [saveFilePanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
+            if (returnCode == NSOKButton)
+                [o_t7_fld_filePath setStringValue:[[saveFilePanel URL] path]];
+        }];
+        [saveFilePanel release];
     }
-    [sheet release];
 }
 
 @end



More information about the vlc-commits mailing list