[gtk+/filechooser-recent-folders-2-24] Allow resolving absolute paths even if there is no base_folder
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/filechooser-recent-folders-2-24] Allow resolving absolute paths even if there is no base_folder
- Date: Tue, 12 Jul 2011 23:43:43 +0000 (UTC)
commit 3449a4891a1cf9b5e78fe1277815837d490f9716
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jun 29 18:20:53 2011 -0500
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.
gtk/gtkfilechooserentry.c | 1 -
gtk/gtkfilesystem.c | 17 +++++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 57d8de3..27241c2 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -1559,7 +1559,6 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry,
error = NULL;
if (!chooser_entry->file_system ||
- !chooser_entry->base_folder ||
!_gtk_file_system_parse (chooser_entry->file_system,
chooser_entry->base_folder, text,
&folder_file, &file_part, &error))
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c
index 112c600..6e7be3c 100644
--- a/gtk/gtkfilesystem.c
+++ b/gtk/gtkfilesystem.c
@@ -720,9 +720,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 ../
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]