diff options
author | Federico Mena Quintero <federico@ximian.com> | 2004-03-02 20:05:08 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2004-03-02 20:05:08 +0000 |
commit | 9133c58b8d91b6e58d81e7d285c310202ef91ab7 (patch) | |
tree | 13f133c73d9809fe68c04f7f92184892d81a54fb /tests/testfilechooser.c | |
parent | 596cbff96027a31232f85dbfc1ec25c82163636b (diff) | |
download | gtk+-9133c58b8d91b6e58d81e7d285c310202ef91ab7.tar.gz |
Don't update the save folder combo if we are already switching folders;
2004-03-02 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_set_current_folder): Don't update the
save folder combo if we are already switching folders; based on a
patch by Jonathan Blandford.
* gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
Handle failure to insert the path. Based on a patch by Morten
Welinder attached to bug #135380.
* tests/testfilechooser.c (extra_widget_create): Add a bunch of
buttons to test various things.
Diffstat (limited to 'tests/testfilechooser.c')
-rw-r--r-- | tests/testfilechooser.c | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index 0beb08cad9..3cccdc6779 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -296,6 +296,66 @@ update_preview_cb (GtkFileChooser *chooser) gtk_file_chooser_set_preview_widget_active (chooser, have_preview); } +static void +set_folder_nonexistent_cb (GtkButton *button, + GtkFileChooser *chooser) +{ + gtk_file_chooser_set_current_folder (chooser, "/nonexistent"); +} + +static void +set_folder_existing_nonexistent_cb (GtkButton *button, + GtkFileChooser *chooser) +{ + gtk_file_chooser_set_current_folder (chooser, "/usr/nonexistent"); +} + +static void +set_filename_nonexistent_cb (GtkButton *button, + GtkFileChooser *chooser) +{ + gtk_file_chooser_set_filename (chooser, "/nonexistent"); +} + +static void +set_filename_existing_nonexistent_cb (GtkButton *button, + GtkFileChooser *chooser) +{ + gtk_file_chooser_set_filename (chooser, "/usr/nonexistent"); +} + +static GtkWidget * +extra_widget_create (GtkFileChooser *chooser) +{ + GtkWidget *box; + GtkWidget *widget; + + box = gtk_vbox_new (FALSE, 6); + + widget = gtk_button_new_with_label ("set_current_folder (\"/nonexistent\")"); + g_signal_connect (widget, "clicked", + G_CALLBACK (set_folder_nonexistent_cb), chooser); + gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); + + widget = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\""); + g_signal_connect (widget, "clicked", + G_CALLBACK (set_folder_existing_nonexistent_cb), chooser); + gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); + + widget = gtk_button_new_with_label ("set_filename (\"/nonexistent\""); + g_signal_connect (widget, "clicked", + G_CALLBACK (set_filename_nonexistent_cb), chooser); + gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); + + widget = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\""); + g_signal_connect (widget, "clicked", + G_CALLBACK (set_filename_existing_nonexistent_cb), chooser); + gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); + + gtk_widget_show_all (box); + return box; +} + int main (int argc, char **argv) { @@ -306,7 +366,6 @@ main (int argc, char **argv) GtkWidget *prop_editor; GtkFileFilter *filter; GtkWidget *preview_vbox; - GtkWidget *extra; int i; gtk_init (&argc, &argv); @@ -397,9 +456,8 @@ main (int argc, char **argv) G_CALLBACK (update_preview_cb), NULL); /* Extra widget */ - extra = gtk_check_button_new_with_mnemonic ("Lar_t whoever asks about this button"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra), TRUE); - // gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra); + + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra_widget_create (GTK_FILE_CHOOSER (dialog))); /* Shortcuts */ |