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

@@ -39,8 +39,6 @@
- (void) setDestinationPath: (NSString *) destination;
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo;
- (void) setGroupsMenu;
- (void) changeGroupValue: (id) sender;
@@ -132,8 +130,15 @@
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the download folder for \"%@\"",
"Add -> select destination folder"), [fTorrent name]]];
[panel beginSheetForDirectory: nil file: nil types: nil modalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(folderChoiceClosed:returnCode:contextInfo:) contextInfo: nil];
[panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton)
[self setDestinationPath: [[[panel URLs] objectAtIndex: 0] path]];
else
{
if (!fDestination)
[self performSelectorOnMainThread: @selector(cancelAdd:) withObject: nil waitUntilDone: NO];
}
}];
}
- (void) add: (id) sender
@@ -227,17 +232,6 @@
[iconTransformer release];
}
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo
{
if (code == NSOKButton)
[self setDestinationPath: [[[openPanel URLs] objectAtIndex: 0] path]];
else
{
if (!fDestination)
[self performSelectorOnMainThread: @selector(cancelAdd:) withObject: nil waitUntilDone: NO];
}
}
- (void) setGroupsMenu
{
NSMenu * groupMenu = [[GroupsController groups] groupMenuWithTarget: self action: @selector(changeGroupValue:) isSmall: NO];