Fix 'cancel' button when downloading

This commit is contained in:
anthony 2021-01-23 13:13:57 +00:00
parent 4a501b497a
commit dd95df6e07
2 changed files with 7 additions and 2 deletions

View File

@ -172,8 +172,11 @@ static NSMenuItem *menuItemForItem(id item) {
-(NSURL*)requestDownloadDestination {
NSSavePanel *savePanel = [NSOpenPanel savePanel];
[savePanel setDirectory: NSHomeDirectory()];
[savePanel runModal];
return [savePanel URL];
if ([savePanel runModal] == NSOKButton) {
return [savePanel URL];
} else {
return nil;
}
}
-(void)openWebsite: (Website*)aWebsite {

View File

@ -13,6 +13,8 @@
static struct gui_download_window *gnustep_download_create(struct download_context *ctx, struct gui_window *parent) {
NSLog(@"gnustep_download_create");
NSURL *url = [[NSApp delegate] requestDownloadDestination];
if (url == nil)
return NULL;
DownloadItem *download = [[DownloadManager defaultDownloadManager]
createDownloadForDestination: url withContext: ctx];
[[NSApp delegate] showDownloadsWindow: nil];