[gtk+] Add an --initial-filename option to testfilechooser.c



commit c98ebe316587732653734d8f92129f703b9415ba
Author: Federico Mena Quintero <federico novell com>
Date:   Fri Jun 12 14:02:37 2009 -0500

    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>

 tests/testfilechooser.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 7c00805..86b0d57 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]