forked from AuroraMiddleware/gtk
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>
This commit is contained in:
parent
2accf2fd21
commit
c98ebe3165
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user