Commit b03db9b5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

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

parent ffbdd5c7
...@@ -1626,18 +1626,10 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1626,18 +1626,10 @@ static VLCWizard *_o_sharedInstance = nil;
{ {
NSOpenPanel * openPanel = [NSOpenPanel openPanel]; NSOpenPanel * openPanel = [NSOpenPanel openPanel];
SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:); SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
[openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow: [openPanel beginSheetModalForWindow: o_wizard_window completionHandler: ^(NSInteger returnCode) {
o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
}
- (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet
returnCode: (int)returnCode
contextInfo: (void *)contextInfo
{
if (returnCode == NSOKButton) if (returnCode == NSOKButton)
{ [o_t2_fld_pathToNewStrm setStringValue: [[openPanel URL] absoluteString]];
[o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]]; }];
}
} }
- (IBAction)t2_chooseStreamOrPlst:(id)sender - (IBAction)t2_chooseStreamOrPlst:(id)sender
...@@ -1830,8 +1822,6 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1830,8 +1822,6 @@ static VLCWizard *_o_sharedInstance = nil;
* his/her new file. We take a modified NSOpenPanel to select a folder * his/her new file. We take a modified NSOpenPanel to select a folder
* and a plain NSSavePanel to save a single file. */ * and a plain NSSavePanel to save a single file. */
SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 ) if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
{ {
NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init]; NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
...@@ -1840,8 +1830,11 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1840,8 +1830,11 @@ static VLCWizard *_o_sharedInstance = nil;
[saveFolderPanel setCanChooseFiles: NO]; [saveFolderPanel setCanChooseFiles: NO];
[saveFolderPanel setCanSelectHiddenExtension: NO]; [saveFolderPanel setCanSelectHiddenExtension: NO];
[saveFolderPanel setCanCreateDirectories: YES]; [saveFolderPanel setCanCreateDirectories: YES];
[saveFolderPanel beginSheetForDirectory:nil file:nil modalForWindow: [saveFolderPanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil]; if (returnCode == NSOKButton)
[o_t7_fld_filePath setStringValue: [NSString stringWithFormat: @"%@/", [[saveFolderPanel URL] path]]];
}];
[saveFolderPanel release];
} }
else else
{ {
...@@ -1860,25 +1853,12 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1860,25 +1853,12 @@ static VLCWizard *_o_sharedInstance = nil;
[saveFilePanel setCanSelectHiddenExtension: YES]; [saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES]; [saveFilePanel setCanCreateDirectories: YES];
[saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow: [saveFilePanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
}
}
- (void)t7_getTrnscdDestFile: (NSOpenPanel *)sheet returnCode:
(int)returnCode contextInfo: (void *)contextInfo
{
if (returnCode == NSOKButton) if (returnCode == NSOKButton)
{ [o_t7_fld_filePath setStringValue:[[saveFilePanel URL] path]];
/* output returned path to text-field, add a / to the end if the user }];
* selected a folder */ [saveFilePanel release];
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]];
} }
[sheet release];
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment