Add a test for the confirm-overwrite signal.

2005-07-15  Federico Mena Quintero  <federico@ximian.com>

	* tests/testfilechooser.c (confirm_overwrite_cb): Add a test for
	the confirm-overwrite signal.
This commit is contained in:
Federico Mena Quintero 2005-07-15 06:07:13 +00:00 committed by Federico Mena Quintero
parent d747251b2e
commit 8e9e57b57c
4 changed files with 107 additions and 23 deletions

View File

@ -1,3 +1,14 @@
2005-07-15 Federico Mena Quintero <federico@ximian.com>
* tests/testfilechooser.c (confirm_overwrite_cb): Add a test for
the confirm-overwrite signal.
* gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Remove the
stub documentation for the "confirm-overwrite" signal.
(gtk_file_chooser_set_do_overwrite_confirmation): Add "Since: 2.8"
to the docs.
(gtk_file_chooser_get_do_overwrite_confirmation): Likewise.
2005-07-14 Federico Mena Quintero <federico@ximian.com>
Add overwrite confirmation for SAVE mode. Fixes bug #152850:

View File

@ -1,3 +1,14 @@
2005-07-15 Federico Mena Quintero <federico@ximian.com>
* tests/testfilechooser.c (confirm_overwrite_cb): Add a test for
the confirm-overwrite signal.
* gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Remove the
stub documentation for the "confirm-overwrite" signal.
(gtk_file_chooser_set_do_overwrite_confirmation): Add "Since: 2.8"
to the docs.
(gtk_file_chooser_get_do_overwrite_confirmation): Likewise.
2005-07-14 Federico Mena Quintero <federico@ximian.com>
Add overwrite confirmation for SAVE mode. Fixes bug #152850:

View File

@ -1,3 +1,14 @@
2005-07-15 Federico Mena Quintero <federico@ximian.com>
* tests/testfilechooser.c (confirm_overwrite_cb): Add a test for
the confirm-overwrite signal.
* gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Remove the
stub documentation for the "confirm-overwrite" signal.
(gtk_file_chooser_set_do_overwrite_confirmation): Add "Since: 2.8"
to the docs.
(gtk_file_chooser_get_do_overwrite_confirmation): Likewise.
2005-07-14 Federico Mena Quintero <federico@ximian.com>
Add overwrite confirmation for SAVE mode. Fixes bug #152850:

View File

@ -421,6 +421,55 @@ notify_multiple_cb (GtkWidget *dialog,
gtk_widget_set_sensitive (button, multiple);
}
static GtkFileChooserConfirmation
confirm_overwrite_cb (GtkFileChooser *chooser,
gpointer data)
{
GtkWidget *dialog;
GtkWidget *button;
int response;
GtkFileChooserConfirmation conf;
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (chooser))),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
"What do you want to do?");
button = gtk_button_new_with_label ("Use the stock confirmation dialog");
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 1);
button = gtk_button_new_with_label ("Type a new file name");
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 2);
button = gtk_button_new_with_label ("Accept the file name");
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 3);
response = gtk_dialog_run (GTK_DIALOG (dialog));
switch (response)
{
case 1:
conf = GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM;
break;
case 3:
conf = GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
break;
default:
conf = GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
break;
}
gtk_widget_destroy (dialog);
return conf;
}
int
main (int argc, char **argv)
{
@ -490,6 +539,8 @@ main (int argc, char **argv)
G_CALLBACK (print_current_folder), NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (response_cb), NULL);
g_signal_connect (dialog, "confirm-overwrite",
G_CALLBACK (confirm_overwrite_cb), NULL);
/* Filters */
filter = gtk_file_filter_new ();