summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileselection.c3
-rw-r--r--src/option.c12
-rw-r--r--src/zenity.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/fileselection.c b/src/fileselection.c
index 53859229..3f355bab 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -57,6 +57,9 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
+ file_data->confirm_overwrite);
+
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (zenity_fileselection_dialog_response), file_data);
diff --git a/src/option.c b/src/option.c
index dcc1da04..7917c91e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -63,6 +63,7 @@ static gboolean zenity_info_active;
static gboolean zenity_file_active;
static gboolean zenity_file_directory;
static gboolean zenity_file_save;
+static gboolean zenity_file_confirm_overwrite;
/* List Dialog Options */
static gboolean zenity_list_active;
@@ -370,6 +371,15 @@ static GOptionEntry file_selection_options[] = {
N_("Set output separator character"),
N_("SEPARATOR")
},
+ {
+ "confirm-overwrite",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_file_confirm_overwrite,
+ N_("Confirm file selection if filename already exists"),
+ NULL
+ },
{
NULL
}
@@ -921,6 +931,7 @@ zenity_file_pre_callback (GOptionContext *context,
zenity_file_active = FALSE;
zenity_file_directory = FALSE;
zenity_file_save = FALSE;
+ zenity_file_confirm_overwrite = FALSE;
return TRUE;
}
@@ -1170,6 +1181,7 @@ zenity_file_post_callback (GOptionContext *context,
results->file_data->multi = zenity_general_multiple;
results->file_data->directory = zenity_file_directory;
results->file_data->save = zenity_file_save;
+ results->file_data->confirm_overwrite = zenity_file_confirm_overwrite;
results->file_data->separator = zenity_general_separator;
} else {
if (zenity_file_directory)
diff --git a/src/zenity.h b/src/zenity.h
index 6fb2b4c2..05e628f4 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -75,6 +75,7 @@ typedef struct {
gboolean multi;
gboolean directory;
gboolean save;
+ gboolean confirm_overwrite;
gchar *separator;
} ZenityFileData;
bgstack15