summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/fileselection.c3
-rw-r--r--src/option.c12
-rw-r--r--src/zenity.h1
4 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0650826..082730a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-23 Lucas Rocha <lucasr@gnome.org>
+
+ * src/fileselection.c, zenity.h, option.c: add
+ --confirm-overwrite to file selection dialog to pop a
+ confirmation dialog when selecting an existing filename.
+
2006-03-22 Lucas Rocha <lucasr@gnome.org>
Implement the "message" command on notification icon
diff --git a/src/fileselection.c b/src/fileselection.c
index 5385922..3f355ba 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 dcc1da0..7917c91 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 6fb2b4c..05e628f 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;