From c98ebe316587732653734d8f92129f703b9415ba Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 Jun 2009 14:02:37 -0500 Subject: 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 --- tests/testfilechooser.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/testfilechooser.c') 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); -- cgit v1.2.1