diff options
author | Federico Mena Quintero <federico@novell.com> | 2009-06-12 14:09:47 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@novell.com> | 2009-06-12 14:09:47 -0500 |
commit | bb362f754af5a4de9ed4b723eebceacfe90dff5c (patch) | |
tree | a2f92f66f9096b7a9a2234002be7904d47aa7093 /tests/testfilechooser.c | |
parent | c98ebe316587732653734d8f92129f703b9415ba (diff) | |
download | gdk-pixbuf-bb362f754af5a4de9ed4b723eebceacfe90dff5c.tar.gz |
Add an --initial-folder option to testfilechooser.c
Signed-off-by: Federico Mena Quintero <federico@novell.com>
Diffstat (limited to 'tests/testfilechooser.c')
-rw-r--r-- | tests/testfilechooser.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index 86b0d57bf..443f5c38a 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -490,6 +490,7 @@ main (int argc, char **argv) char *action_arg = NULL; char *backend = NULL; char *initial_filename = NULL; + char *initial_folder = NULL; GError *error = NULL; GOptionEntry options[] = { { "action", 'a', 0, G_OPTION_ARG_STRING, &action_arg, "Filechooser action", "ACTION" }, @@ -497,6 +498,7 @@ main (int argc, char **argv) { "multiple", 'm', 0, G_OPTION_ARG_NONE, &multiple, "Select-multiple", NULL }, { "right-to-left", 'r', 0, G_OPTION_ARG_NONE, &force_rtl, "Force right-to-left layout.", NULL }, { "initial-filename", 'f', 0, G_OPTION_ARG_FILENAME, &initial_filename, "Initial filename to select", "FILENAME" }, + { "initial-folder", 'F', 0, G_OPTION_ARG_FILENAME, &initial_folder, "Initial folder to show", "FILENAME" }, { NULL } }; @@ -507,6 +509,12 @@ main (int argc, char **argv) return 1; } + if (initial_filename && initial_folder) + { + g_print ("Only one of --initial-filename and --initial-folder may be specified"); + return 1; + } + if (force_rtl) gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); @@ -627,11 +635,14 @@ main (int argc, char **argv) "file:///usr/share/pixmaps", NULL); - /* Initial filename */ + /* Initial filename or folder */ if (initial_filename) set_filename (GTK_FILE_CHOOSER (dialog), initial_filename); + if (initial_folder) + set_current_folder (GTK_FILE_CHOOSER (dialog), initial_folder); + /* show_all() to reveal bugs in composite widget handling */ gtk_widget_show_all (dialog); |