From 945ce561d3f680c8fea5981211b8afd2a2dc255d Mon Sep 17 00:00:00 2001 From: culler Date: Sat, 25 Nov 2017 17:17:57 +0000 Subject: Pass nil for allowedFileTypes rather than an empty array to select all files. --- macosx/tkMacOSXDialog.c | 22 +++++++++++++++------- macosx/tkMacOSXInit.c | 3 --- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index b728393..97a282d 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -268,27 +268,35 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) { } - (void)selectFormat:(id)sender { - NSPopUpButton *button = (NSPopUpButton *)sender; - filterInfo.fileTypeIndex = [button indexOfSelectedItem]; + NSPopUpButton *button = (NSPopUpButton *)sender; + filterInfo.fileTypeIndex = [button indexOfSelectedItem]; #ifdef __clang__ NSMutableArray *allowedtypes = filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]; #else NSMutableArray *allowedtypes = nil; #endif - [openpanel setAllowedFileTypes:allowedtypes]; + if (allowedtypes && [allowedtypes count] > 0) { + [openpanel setAllowedFileTypes:allowedtypes]; + } else { + [openpanel setAllowedFileTypes:nil]; + } filterInfo.userHasSelectedFilter = true; - } - (void)saveFormat:(id)sender { - NSPopUpButton *button = (NSPopUpButton *)sender; - filterInfo.fileTypeIndex = [button indexOfSelectedItem]; + NSPopUpButton *button = (NSPopUpButton *)sender; + filterInfo.fileTypeIndex = [button indexOfSelectedItem]; #ifdef __clang__ NSMutableArray *allowedtypes = filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]; #else NSMutableArray *allowedtypes = nil; #endif - [savepanel setAllowedFileTypes:allowedtypes]; + if (allowedtypes && [allowedtypes count] > 0) { + [savepanel setAllowedFileTypes:allowedtypes]; + } else { + [savepanel setAllowedFileTypes:nil]; + } + filterInfo.userHasSelectedFilter = true; } @end diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 5c8c0b7..6eba796 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -264,9 +264,6 @@ TkpInit( */ if (!initialized) { - int bundledExecutable = 0; - CFBundleRef bundleRef; - CFURLRef bundleUrl = NULL; struct utsname name; struct stat st; -- cgit v0.12