add --confirm-overwrite to file selection dialog to pop a confirmation

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.
This commit is contained in:
Lucas Rocha 2006-03-23 20:08:17 +00:00 committed by Lucas Almeida Rocha
parent e919741e64
commit 6645316bc9
4 changed files with 22 additions and 0 deletions

View File

@ -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> 2006-03-22 Lucas Rocha <lucasr@gnome.org>
Implement the "message" command on notification icon Implement the "message" command on notification icon

View File

@ -57,6 +57,9 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL); NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
file_data->confirm_overwrite);
g_signal_connect (G_OBJECT (dialog), "response", g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (zenity_fileselection_dialog_response), file_data); G_CALLBACK (zenity_fileselection_dialog_response), file_data);

View File

@ -63,6 +63,7 @@ static gboolean zenity_info_active;
static gboolean zenity_file_active; static gboolean zenity_file_active;
static gboolean zenity_file_directory; static gboolean zenity_file_directory;
static gboolean zenity_file_save; static gboolean zenity_file_save;
static gboolean zenity_file_confirm_overwrite;
/* List Dialog Options */ /* List Dialog Options */
static gboolean zenity_list_active; static gboolean zenity_list_active;
@ -370,6 +371,15 @@ static GOptionEntry file_selection_options[] = {
N_("Set output separator character"), N_("Set output separator character"),
N_("SEPARATOR") N_("SEPARATOR")
}, },
{
"confirm-overwrite",
'\0',
0,
G_OPTION_ARG_NONE,
&zenity_file_confirm_overwrite,
N_("Confirm file selection if filename already exists"),
NULL
},
{ {
NULL NULL
} }
@ -921,6 +931,7 @@ zenity_file_pre_callback (GOptionContext *context,
zenity_file_active = FALSE; zenity_file_active = FALSE;
zenity_file_directory = FALSE; zenity_file_directory = FALSE;
zenity_file_save = FALSE; zenity_file_save = FALSE;
zenity_file_confirm_overwrite = FALSE;
return TRUE; return TRUE;
} }
@ -1170,6 +1181,7 @@ zenity_file_post_callback (GOptionContext *context,
results->file_data->multi = zenity_general_multiple; results->file_data->multi = zenity_general_multiple;
results->file_data->directory = zenity_file_directory; results->file_data->directory = zenity_file_directory;
results->file_data->save = zenity_file_save; results->file_data->save = zenity_file_save;
results->file_data->confirm_overwrite = zenity_file_confirm_overwrite;
results->file_data->separator = zenity_general_separator; results->file_data->separator = zenity_general_separator;
} else { } else {
if (zenity_file_directory) if (zenity_file_directory)

View File

@ -75,6 +75,7 @@ typedef struct {
gboolean multi; gboolean multi;
gboolean directory; gboolean directory;
gboolean save; gboolean save;
gboolean confirm_overwrite;
gchar *separator; gchar *separator;
} ZenityFileData; } ZenityFileData;