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:
parent
e919741e64
commit
6645316bc9
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
12
src/option.c
12
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)
|
||||
|
@ -75,6 +75,7 @@ typedef struct {
|
||||
gboolean multi;
|
||||
gboolean directory;
|
||||
gboolean save;
|
||||
gboolean confirm_overwrite;
|
||||
gchar *separator;
|
||||
} ZenityFileData;
|
||||
|
||||
|
Reference in New Issue
Block a user