[gtk+] Add an --initial-folder option to testfilechooser.c
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Add an --initial-folder option to testfilechooser.c
- Date: Fri, 12 Jun 2009 15:36:26 -0400 (EDT)
commit bb362f754af5a4de9ed4b723eebceacfe90dff5c
Author: Federico Mena Quintero <federico novell com>
Date: Fri Jun 12 14:09:47 2009 -0500
Add an --initial-folder option to testfilechooser.c
Signed-off-by: Federico Mena Quintero <federico novell com>
tests/testfilechooser.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 86b0d57..443f5c3 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]