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/AddWindowController.m

    r12943 r13108  
    4545- (void) setDestinationPath: (NSString *) destination;
    4646
    47 - (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo;
    48 
    4947- (void) setGroupsMenu;
    5048- (void) changeGroupValue: (id) sender;
     
    167165                        "Add -> select destination folder"), [fTorrent name]]];
    168166   
    169     [panel beginSheetForDirectory: nil file: nil types: nil modalForWindow: [self window] modalDelegate: self
    170             didEndSelector: @selector(folderChoiceClosed:returnCode:contextInfo:) contextInfo: nil];
     167    [panel beginSheetModalForWindow: [self window] completionHandler: ^(NSInteger result) {
     168        if (result == NSFileHandlingPanelOKButton)
     169        {
     170            fLockDestination = NO;
     171            [self setDestinationPath: [[[panel URLs] objectAtIndex: 0] path]];
     172        }
     173        else
     174        {
     175            if (!fDestination)
     176                [self performSelectorOnMainThread: @selector(cancelAdd:) withObject: nil waitUntilDone: NO];
     177        }
     178    }];
    171179}
    172180
     
    323331}
    324332
    325 - (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo
    326 {
    327     if (code == NSOKButton)
    328     {
    329         fLockDestination = NO;
    330         [self setDestinationPath: [[[openPanel URLs] objectAtIndex: 0] path]];
    331     }
    332     else
    333     {
    334         if (!fDestination)
    335             [self performSelectorOnMainThread: @selector(cancelAdd:) withObject: nil waitUntilDone: NO];
    336     }
    337 }
    338 
    339333- (void) setGroupsMenu
    340334{
Note: See TracChangeset for help on using the changeset viewer.