]> Pileus Git - ~andy/gtk/commitdiff
if setting the given folder failed, try setting the parent folder until we
authorKristian Rietveld <kris@imendio.com>
Mon, 4 Sep 2006 20:09:08 +0000 (20:09 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Mon, 4 Sep 2006 20:09:08 +0000 (20:09 +0000)
2006-09-04  Kristian Rietveld  <kris@imendio.com>

* gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
if setting the given folder failed, try setting the parent folder
until we succeed; display an error box at the end.

ChangeLog
gtk/gtkfilechooserdefault.c

index a2ba206e0d3837e5bbce516f7b57a1a5f0c909f0..f89ebee714596bb751f5feb666625b94d5103c64 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-04  Kristian Rietveld  <kris@imendio.com>
+
+       * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
+       if setting the given folder failed, try setting the parent folder
+       until we succeed; display an error box at the end.
+
 2006-09-04  Kristian Rietveld  <kris@imendio.com>
 
        * gtk/gtkpathbar.c (gtk_path_bar_dispose): don't cancel the
index 6c50ef3c0524d243b41a6f38bd6fd5ac79733d6e..74d2dc5439802e9771dbf0f24930374a25d1fe05 100644 (file)
@@ -6138,6 +6138,8 @@ struct UpdateCurrentFolderData
   GtkFileChooserDefault *impl;
   GtkFilePath *path;
   gboolean keep_trail;
+  GtkFilePath *original_path;
+  GError *original_error;
 };
 
 static void
@@ -6163,8 +6165,51 @@ update_current_folder_get_info_cb (GtkFileSystemHandle *handle,
 
   if (error)
     {
-      error_changing_folder_dialog (impl, data->path, g_error_copy (error));
-      goto out;
+      GtkFilePath *parent_path;
+
+      if (!data->original_path)
+        {
+         data->original_path = gtk_file_path_copy (data->path);
+         data->original_error = g_error_copy (error);
+       }
+
+      /* get parent path and try to change the folder to that */
+      if (gtk_file_system_get_parent (impl->file_system, data->path, &parent_path, NULL))
+        {
+         gtk_file_path_free (data->path);
+         data->path = parent_path;
+
+         g_object_unref (handle);
+
+         /* restart the update current folder operation */
+         impl->reload_state = RELOAD_HAS_FOLDER;
+
+         impl->update_current_folder_handle =
+           gtk_file_system_get_info (impl->file_system, data->path,
+                                     GTK_FILE_INFO_IS_FOLDER,
+                                     update_current_folder_get_info_cb,
+                                     data);
+
+         set_busy_cursor (impl, TRUE);
+
+         return;
+       }
+      else
+        {
+         /* error and bail out */
+         error_changing_folder_dialog (impl, data->original_path, data->original_error);
+
+         gtk_file_path_free (data->original_path);
+
+         goto out;
+       }
+    }
+
+  if (data->original_path)
+    {
+      error_changing_folder_dialog (impl, data->original_path, data->original_error);
+
+      gtk_file_path_free (data->original_path);
     }
 
   if (!gtk_file_info_get_is_folder (info))