mirror of
https://github.com/transmission/transmission.git
synced 2026-04-28 04:34:02 +01:00
eliminate all warnings by switching NSOpenPanel/NSSavePanels to use completion handler blocks
This commit is contained in:
@@ -194,10 +194,25 @@
|
||||
[panel setCanChooseFiles: NO];
|
||||
[panel setCanChooseDirectories: YES];
|
||||
[panel setCanCreateDirectories: YES];
|
||||
|
||||
[panel beginSheetForDirectory: nil file: nil types: nil
|
||||
modalForWindow: [fCustomLocationPopUp window] modalDelegate: self didEndSelector:
|
||||
@selector(customDownloadLocationSheetClosed:returnCode:contextInfo:) contextInfo: nil];
|
||||
|
||||
[panel beginSheetModalForWindow: [fCustomLocationPopUp window] completionHandler: ^(NSInteger result) {
|
||||
const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
{
|
||||
NSString * path = [[[panel URLs] objectAtIndex: 0] path];
|
||||
[[GroupsController groups] setCustomDownloadLocation: path forIndex: index];
|
||||
[[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![[GroupsController groups] customDownloadLocationForIndex: index])
|
||||
[[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index];
|
||||
}
|
||||
|
||||
[self refreshCustomLocationWithSingleGroup];
|
||||
|
||||
[fCustomLocationPopUp selectItemAtIndex: 0];
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction) toggleUseCustomDownloadLocation: (id) sender
|
||||
@@ -216,26 +231,6 @@
|
||||
[fCustomLocationPopUp setEnabled: ([fCustomLocationEnableCheck state] == NSOnState)];
|
||||
}
|
||||
|
||||
- (void) customDownloadLocationSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info
|
||||
{
|
||||
NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
|
||||
if (code == NSOKButton)
|
||||
{
|
||||
NSString * path = [[[openPanel URLs] objectAtIndex: 0] path];
|
||||
[[GroupsController groups] setCustomDownloadLocation: path forIndex: index];
|
||||
[[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![[GroupsController groups] customDownloadLocationForIndex: index])
|
||||
[[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index];
|
||||
}
|
||||
|
||||
[self refreshCustomLocationWithSingleGroup];
|
||||
|
||||
[fCustomLocationPopUp selectItemAtIndex: 0];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Rule editor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user