eliminate all warnings by switching NSOpenPanel/NSSavePanels to use completion handler blocks

This commit is contained in:
Mitchell Livingston
2011-12-11 22:31:01 +00:00
parent d524deecb0
commit 30f7fae5a5
8 changed files with 176 additions and 246 deletions

View File

@@ -34,7 +34,6 @@
@interface CreatorWindowController (Private)
+ (NSString *) chooseFile;
- (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) info;
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo;
- (void) createReal;
@@ -209,9 +208,19 @@
[panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]];
[panel setCanSelectHiddenExtension: YES];
[panel beginSheetForDirectory: [fLocation stringByDeletingLastPathComponent] file: [fLocation lastPathComponent]
modalForWindow: [self window] modalDelegate: self didEndSelector: @selector(locationSheetClosed:returnCode:contextInfo:)
contextInfo: nil];
[panel setDirectoryURL: [NSURL fileURLWithPath: [fLocation stringByDeletingLastPathComponent]]];
[panel setNameFieldStringValue: [fLocation lastPathComponent]];
[panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton)
{
[fLocation release];
fLocation = [[[panel URL] path] retain];
[fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fLocation];
}
}];
}
- (void) create: (id) sender
@@ -407,18 +416,6 @@
return success ? [[[panel URLs] objectAtIndex: 0] path] : nil;
}
- (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (void *) info
{
if (code == NSOKButton)
{
[fLocation release];
fLocation = [[[panel URL] path] retain];
[fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fLocation];
}
}
- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo
{
if ([[alert suppressionButton] state] == NSOnState)