diff options
author | Jonathan Blandford <jrb@redhat.com> | 2004-03-02 19:38:54 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2004-03-02 19:38:54 +0000 |
commit | fe8838bce28cceac06b271d2c349500cee1da151 (patch) | |
tree | 6b5a297ca096d112195b43302ede7aaffc5b5f84 | |
parent | c0778545828071a643afdcb08595410037155f8c (diff) | |
download | gdk-pixbuf-fe8838bce28cceac06b271d2c349500cee1da151.tar.gz |
improve tests a little.
Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com>
* tests/testfilechooser.c (main): improve tests a little.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 4 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 4 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 4 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 4 | ||||
-rw-r--r-- | tests/testfilechooser.c | 47 |
6 files changed, 59 insertions, 8 deletions
@@ -1,3 +1,7 @@ +Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com> + + * tests/testfilechooser.c (main): improve tests a little. + Tue Mar 2 11:45:50 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombobox.c: Always connect to the changed diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a4ba4b0f9..66c3835ee 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com> + + * tests/testfilechooser.c (main): improve tests a little. + Tue Mar 2 11:45:50 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombobox.c: Always connect to the changed diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a4ba4b0f9..66c3835ee 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com> + + * tests/testfilechooser.c (main): improve tests a little. + Tue Mar 2 11:45:50 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombobox.c: Always connect to the changed diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a4ba4b0f9..66c3835ee 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com> + + * tests/testfilechooser.c (main): improve tests a little. + Tue Mar 2 11:45:50 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombobox.c: Always connect to the changed diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a4ba4b0f9..66c3835ee 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +Tue Mar 2 14:38:10 2004 Jonathan Blandford <jrb@redhat.com> + + * tests/testfilechooser.c (main): improve tests a little. + Tue Mar 2 11:45:50 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombobox.c: Always connect to the changed diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index 9fbb27078..0beb08cad 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -25,6 +25,7 @@ static GtkWidget *preview_label; static GtkWidget *preview_image; +static GtkFileChooserAction action; static void print_current_folder (GtkFileChooser *chooser) @@ -306,18 +307,48 @@ main (int argc, char **argv) GtkFileFilter *filter; GtkWidget *preview_vbox; GtkWidget *extra; + int i; gtk_init (&argc, &argv); + action = GTK_FILE_CHOOSER_ACTION_OPEN; + + /* lame-o arg parsing */ + for (i = 1; i < argc; i++) + { + if (! strcmp ("--action=open", argv[i])) + action = GTK_FILE_CHOOSER_ACTION_OPEN; + else if (! strcmp ("--action=save", argv[i])) + action = GTK_FILE_CHOOSER_ACTION_SAVE; + else if (! strcmp ("--action=select_folder", argv[i])) + action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; + else if (! strcmp ("--action=create_folder", argv[i])) + action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER; + } + dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, - "action", GTK_FILE_CHOOSER_ACTION_OPEN, - "title", "Select a file", + "action", action, + "file-system-backend", "gnome-vfs", NULL); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_OK, - NULL); + switch (action) + { + case GTK_FILE_CHOOSER_ACTION_OPEN: + case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: + gtk_window_set_title (GTK_WINDOW (dialog), "Select a file"); + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, + NULL); + break; + case GTK_FILE_CHOOSER_ACTION_SAVE: + case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: + gtk_window_set_title (GTK_WINDOW (dialog), "Save a file"); + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_OK, + NULL); + break; + } gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); g_signal_connect (dialog, "selection-changed", @@ -368,7 +399,7 @@ main (int argc, char **argv) /* 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); /* Shortcuts */ |