[gtk+/multiroot-filechooser: 8/15] Prevent access to old locations when using a non-existant root URI.



commit 89c278b5f4156fa9c4556c7f7a0fcb9c233e2b30
Author: Christian Hammond <chipx86 chipx86 com>
Date:   Sat Feb 13 14:45:38 2010 -0800

    Prevent access to old locations when using a non-existant root URI.

 gtk/gtkfilechooserdefault.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 2643ed1..72b55f9 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -7493,6 +7493,19 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
       return FALSE;
     }
 
+  if (!_gtk_file_chooser_is_file_in_root (GTK_FILE_CHOOSER (impl), file))
+    {
+      g_set_error_literal (error,
+                           GTK_FILE_CHOOSER_ERROR,
+                           GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
+                           _("Cannot change to folder because it is not "
+                             "accessible from this file chooser"));
+
+      g_object_unref (file);
+      profile_end ("end - not accessible within root URI", NULL);
+      return FALSE;
+    }
+
   if (impl->update_current_folder_cancellable)
     g_cancellable_cancel (impl->update_current_folder_cancellable);
 



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