Ignore:
Timestamp:
Dec 11, 2011, 10:31:01 PM (10 years ago)
Author:
livings124
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CreatorWindowController.m

    r13094 r13108  
    3535
    3636+ (NSString *) chooseFile;
    37 - (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) info;
    3837
    3938- (void) createBlankAddressAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo;
     
    210209    [panel setCanSelectHiddenExtension: YES];
    211210   
    212     [panel beginSheetForDirectory: [fLocation stringByDeletingLastPathComponent] file: [fLocation lastPathComponent]
    213             modalForWindow: [self window] modalDelegate: self didEndSelector: @selector(locationSheetClosed:returnCode:contextInfo:)
    214             contextInfo: nil];
     211    [panel setDirectoryURL: [NSURL fileURLWithPath: [fLocation stringByDeletingLastPathComponent]]];
     212    [panel setNameFieldStringValue: [fLocation lastPathComponent]];
     213   
     214    [panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
     215        if (result == NSFileHandlingPanelOKButton)
     216        {
     217            [fLocation release];
     218            fLocation = [[[panel URL] path] retain];
     219           
     220            [fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
     221            [fLocationField setToolTip: fLocation];
     222        }
     223    }];
    215224}
    216225
     
    406415    BOOL success = [panel runModal] == NSOKButton;
    407416    return success ? [[[panel URLs] objectAtIndex: 0] path] : nil;
    408 }
    409 
    410 - (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (void *) info
    411 {
    412     if (code == NSOKButton)
    413     {
    414         [fLocation release];
    415         fLocation = [[[panel URL] path] retain];
    416        
    417         [fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]];
    418         [fLocationField setToolTip: fLocation];
    419     }
    420417}
    421418
Note: See TracChangeset for help on using the changeset viewer.