summaryrefslogtreecommitdiff
path: root/tests/testfilechooser.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2009-06-12 14:02:37 -0500
committerFederico Mena Quintero <federico@novell.com>2009-06-12 14:02:37 -0500
commitc98ebe316587732653734d8f92129f703b9415ba (patch)
tree477a97cafb0b81ff6f991708c02087f653fe5bed /tests/testfilechooser.c
parent2accf2fd21508c3420ad7c8c3bbaecf0aa03676b (diff)
downloadgtk+-c98ebe316587732653734d8f92129f703b9415ba.tar.gz
Add an --initial-filename option to testfilechooser.c
We can use this to test bugs that happen when setting a filename before the file chooser is shown, as in bgo#161670 Signed-off-by: Federico Mena Quintero <federico@novell.com>
Diffstat (limited to 'tests/testfilechooser.c')
-rw-r--r--tests/testfilechooser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 7c008055ee..86b0d57bff 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -489,12 +489,14 @@ main (int argc, char **argv)
gboolean multiple = FALSE;
char *action_arg = NULL;
char *backend = NULL;
+ char *initial_filename = NULL;
GError *error = NULL;
GOptionEntry options[] = {
{ "action", 'a', 0, G_OPTION_ARG_STRING, &action_arg, "Filechooser action", "ACTION" },
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, "Filechooser backend (default: gtk+)", "BACKEND" },
{ "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" },
{ NULL }
};
@@ -625,6 +627,11 @@ main (int argc, char **argv)
"file:///usr/share/pixmaps",
NULL);
+ /* Initial filename */
+
+ if (initial_filename)
+ set_filename (GTK_FILE_CHOOSER (dialog), initial_filename);
+
/* show_all() to reveal bugs in composite widget handling */
gtk_widget_show_all (dialog);