summaryrefslogtreecommitdiff
path: root/src/fileselection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileselection.c')
-rw-r--r--src/fileselection.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fileselection.c b/src/fileselection.c
index 995ba03..fdd40fd 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -34,11 +34,22 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
GtkWidget *dialog;
gchar *dir;
gchar *basename;
+ GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
zen_data = data;
+ if (file_data->directory) {
+ if (file_data->save)
+ action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
+ else
+ action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+ } else {
+ if (file_data->save)
+ action = GTK_FILE_CHOOSER_ACTION_SAVE;
+ }
+
dialog = gtk_file_chooser_dialog_new (NULL, NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
+ action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);