Mount the enclosing volume if the folder we're switching to is not

* 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
This commit is contained in:
Matthias Clasen 2008-12-14 03:33:41 +00:00
parent 50329fa7c0
commit 083967b3b8
2 changed files with 62 additions and 0 deletions

View File

@ -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

View 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);