diff options
author | Tom Schoonjans <Tom.Schoonjans@diamond.ac.uk> | 2017-07-03 12:54:39 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-18 13:30:44 -0400 |
commit | 44e90c4dd302790000489656837d470d9fae80da (patch) | |
tree | eb47bed68f96d610b24f7476b50cde787b7f93e6 /gtk/gtkfilechoosernativequartz.c | |
parent | ff2c5e3820d41a752ebdcd75457fad85b465b617 (diff) | |
download | gtk+-44e90c4dd302790000489656837d470d9fae80da.tar.gz |
GtkFileChooserNativeQuartz: add support for GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
Which is via NSOpenPanel, not NSSavePanel...
https://bugzilla.gnome.org/show_bug.cgi?id=784723
Diffstat (limited to 'gtk/gtkfilechoosernativequartz.c')
-rw-r--r-- | gtk/gtkfilechoosernativequartz.c | 90 |
1 files changed, 51 insertions, 39 deletions
diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c index c422d72cf2..f6f6daf04e 100644 --- a/gtk/gtkfilechoosernativequartz.c +++ b/gtk/gtkfilechoosernativequartz.c @@ -174,55 +174,67 @@ filechooser_quartz_launch (FileChooserQuartzData *data) // GTK_FILE_CHOOSER_ACTION_SAVE and GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER if (data->save) - { - NSSavePanel *panel = [[NSSavePanel savePanel] retain]; - - /*if ([panel respondsToSelector:@selector(setShowsTagField:)]) { - [(id<CanSetShowsTagField>)panel setShowsTagField:NO]; - } - */ - if (!data->folder && !data->create_folders) - { - [panel setCanCreateDirectories:NO]; - } - else - { - [panel setCanCreateDirectories:YES]; - } - - data->panel = panel; - } - // GTK_FILE_CHOOSER_ACTION_OPEN and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - else - { - NSOpenPanel *panel = [[NSOpenPanel openPanel] retain]; + /*if ([panel respondsToSelector:@selector(setShowsTagField:)]) + { + [(id<CanSetShowsTagField>)panel setShowsTagField:NO]; + } + */ - if (data->select_multiple) - { - [panel setAllowsMultipleSelection:YES]; - } - if (data->folder) - { - [panel setCanChooseDirectories:YES]; - [panel setCanChooseFiles:NO]; + // GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER + if (data->folder) + { + NSOpenPanel *panel = [[NSOpenPanel openPanel] retain]; + [panel setCanChooseDirectories:YES]; + [panel setCanChooseFiles:NO]; + [panel setCanCreateDirectories:YES]; + data->panel = panel; + } + // GTK_FILE_CHOOSER_ACTION_SAVE + else + { + NSSavePanel *panel = [[NSSavePanel savePanel] retain]; + if (data->create_folders) + { + [panel setCanCreateDirectories:YES]; + } + else + { + [panel setCanCreateDirectories:NO]; + } + data->panel = panel; + } } - else + // GTK_FILE_CHOOSER_ACTION_OPEN and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + else { - [panel setCanChooseDirectories:NO]; - [panel setCanChooseFiles:YES]; - } + NSOpenPanel *panel = [[NSOpenPanel openPanel] retain]; - data->panel = panel; + if (data->select_multiple) + { + [panel setAllowsMultipleSelection:YES]; + } + if (data->folder) + { + [panel setCanChooseDirectories:YES]; + [panel setCanChooseFiles:NO]; + } + else + { + [panel setCanChooseDirectories:NO]; + [panel setCanChooseFiles:YES]; + } + + data->panel = panel; } [data->panel setReleasedWhenClosed:YES]; if (data->show_hidden) - { - [data->panel setShowsHiddenFiles:YES]; - } + { + [data->panel setShowsHiddenFiles:YES]; + } if (data->accept_label) [data->panel setPrompt:[NSString stringWithUTF8String:data->accept_label]]; @@ -298,7 +310,7 @@ filechooser_quartz_launch (FileChooserQuartzData *data) { [data->panel setLevel:NSModalPanelWindowLevel]; [data->panel beginWithCompletionHandler:handler]; - } + } return TRUE; } |