[gtk+] GtkFileChooserNativeQuartz: add support for GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkFileChooserNativeQuartz: add support for GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- Date: Tue, 18 Jul 2017 17:36:07 +0000 (UTC)
commit 44e90c4dd302790000489656837d470d9fae80da
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date: Mon Jul 3 12:54:39 2017 +0100
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
gtk/gtkfilechoosernativequartz.c | 90 +++++++++++++++++++++----------------
1 files changed, 51 insertions(+), 39 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c
index c422d72..f6f6daf 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]