]> Pileus Git - ~andy/gtk/commitdiff
Mount the enclosing volume if the folder we're switching to is not
authorMatthias Clasen <matthiasc@src.gnome.org>
Sun, 14 Dec 2008 03:33:41 +0000 (03:33 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 14 Dec 2008 03:33:41 +0000 (03:33 +0000)
        * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
        Mount the enclosing volume if the folder we're switching to is not
        mounted. Patch by Tomas Bzatek, based on work by Carlos Garnacho

svn path=/trunk/; revision=21899

ChangeLog
gtk/gtkfilechooserdefault.c

index 5b5c93e45dc394fd2421eac215ec1f365d91d431..d1317be76323bee2e029b32ba83035d3ea4ce784 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-13  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
+       Mount the enclosing volume if the folder we're switching to is not
+       mounted. Patch by Tomas Bzatek, based on work by Carlos Garnacho
+
 2008-12-13  Matthias Clasen  <mclasen@redhat.com>
 
        Bug 561494 – FileChooser network browsing and authentication support
index 99a278ba5031b2de4eff2ada87f92649f869f5ae..e7910ad08fd7fe427a6e23be75dcf19721ee71fc 100644 (file)
@@ -6869,6 +6869,41 @@ struct UpdateCurrentFolderData
   GError *original_error;
 };
 
+static void
+update_current_folder_mount_enclosing_volume_cb (GCancellable        *cancellable,
+                                                 GtkFileSystemVolume *volume,
+                                                 const GError        *error,
+                                                 gpointer             user_data)
+{
+  gboolean cancelled = g_cancellable_is_cancelled (cancellable);
+  struct UpdateCurrentFolderData *data = user_data;
+  GtkFileChooserDefault *impl = data->impl;
+
+  if (cancellable != impl->update_current_folder_cancellable)
+    goto out;
+
+  impl->update_current_folder_cancellable = NULL;
+  set_busy_cursor (impl, FALSE);
+
+  if (cancelled)
+    goto out;
+
+  if (error)
+    {
+      error_changing_folder_dialog (data->impl, data->file, g_error_copy (error));
+      impl->reload_state = RELOAD_EMPTY;
+      goto out;
+    }
+
+  change_folder_and_display_error (impl, data->file, data->clear_entry);
+
+out:
+  g_object_unref (data->file);
+  g_free (data);
+
+  g_object_unref (cancellable);
+}
+
 static void
 update_current_folder_get_info_cb (GCancellable *cancellable,
                                   GFileInfo    *info,
@@ -6894,6 +6929,27 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
     {
       GFile *parent_file;
 
+      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED))
+        {
+          GMountOperation *mount_operation;
+          GtkWidget *toplevel;
+
+          g_object_unref (cancellable);
+          toplevel = gtk_widget_get_toplevel (GTK_WIDGET (impl));
+
+          mount_operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
+
+          set_busy_cursor (impl, TRUE);
+
+          impl->update_current_folder_cancellable =
+            _gtk_file_system_mount_enclosing_volume (impl->file_system, data->file,
+                                                     mount_operation,
+                                                     update_current_folder_mount_enclosing_volume_cb,
+                                                     data);
+
+          return;
+        }
+
       if (!data->original_file)
         {
          data->original_file = g_object_ref (data->file);