summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesystem.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2011-06-29 18:20:53 -0500
committerFederico Mena Quintero <federico@gnome.org>2011-07-01 19:07:11 -0500
commitae42f286bb1e2f93aaf785b2289808dbd7b25e80 (patch)
tree0bfbe90b4dd398127bfc61db8121633a337bc7aa /gtk/gtkfilesystem.c
parent1af579b1a244b1fdde95eb7bc8804a6a7826f727 (diff)
downloadgtk+-ae42f286bb1e2f93aaf785b2289808dbd7b25e80.tar.gz
Allow resolving absolute paths even if there is no base_folder
This lets us do proper completion in GtkFileChooserEntry even when no base folder has been set. Completion for relative paths won't work, as usual, as expected.
Diffstat (limited to 'gtk/gtkfilesystem.c')
-rw-r--r--gtk/gtkfilesystem.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c
index 30ff484444..f3d8e823a0 100644
--- a/gtk/gtkfilesystem.c
+++ b/gtk/gtkfilesystem.c
@@ -708,9 +708,22 @@ _gtk_file_system_parse (GtkFileSystem *file_system,
if (str[0] == '~' || g_path_is_absolute (str) || is_uri)
file = g_file_parse_name (str);
else
- file = g_file_resolve_relative_path (base_file, str);
+ {
+ if (base_file)
+ file = g_file_resolve_relative_path (base_file, str);
+ else
+ {
+ *folder = NULL;
+ *file_part = NULL;
+ g_set_error (error,
+ GTK_FILE_CHOOSER_ERROR,
+ GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
+ _("Invalid path"));
+ return FALSE;
+ }
+ }
- if (g_file_equal (base_file, file))
+ if (base_file && g_file_equal (base_file, file))
{
/* this is when user types '.', could be the
* beginning of a hidden file, ./ or ../