diff options
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 11 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.h | 3 | ||||
-rw-r--r-- | libnautilus-private/nautilus-mime-actions.c | 6 | ||||
-rw-r--r-- | src/nautilus-application.c | 11 | ||||
-rw-r--r-- | src/nautilus-places-sidebar.c | 6 | ||||
-rw-r--r-- | src/nautilus-window-manage-views.c | 2 |
7 files changed, 52 insertions, 16 deletions
@@ -1,3 +1,32 @@ +2008-04-04 Christian Neumair <cneumair@gnome.org> + + * libnautilus-private/nautilus-file-operations.c (volume_mount_cb), + (nautilus_file_operations_mount_volume): + * libnautilus-private/nautilus-file-operations.h: + * libnautilus-private/nautilus-mime-actions.c + (activation_mount_not_mounted_callback), + (activation_mount_not_mounted): + * src/nautilus-application.c (startup_volume_mount_cb), + (automount_all_volumes), (volume_added_callback): + * src/nautilus-places-sidebar.c (open_selected_bookmark), + (mount_shortcut_cb): + * src/nautilus-window-manage-views.c (mount_not_mounted_callback), + (got_file_info_for_view_selection_callback): + Inhibit autorun in mount callbacks after finishing mounts rather than + before mounting. + + It is neccessary because the mount may take a very long time (floppy, + password prompt), which may take longer than the inhibition timeout. + + This approach works because with the current HAL volume monitor + implementation, GVolumeMonitor signal emission is scheduled, while the + mount callbacks are invoked synchronously. + + This should also fix the not working inhibition on startup, which + could happen because parallel mounts in the background and the rest of + the startup process eat resources, so the mounts may also take longer + than the inhibition timeout. + 2008-04-03 Christian Neumair <cneumair@gnome.org> * libnautilus-private/nautilus-bookmark.c diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index b52256fa5..b0ed5d0c2 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -2017,6 +2017,9 @@ volume_mount_cb (GObject *source_object, GError *error; char *primary; char *name; + gboolean inhibit_autorun; + + inhibit_autorun = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mount_op), "inhibit-autorun")); error = NULL; if (!g_volume_mount_finish (G_VOLUME (source_object), res, &error)) { @@ -2030,6 +2033,10 @@ volume_mount_cb (GObject *source_object, g_free (primary); } g_error_free (error); + } else { + if (inhibit_autorun) { + nautilus_inhibit_autorun_for_volume (G_VOLUME (source_object)); + } } g_object_unref (mount_op); @@ -2038,11 +2045,13 @@ volume_mount_cb (GObject *source_object, void nautilus_file_operations_mount_volume (GtkWindow *parent_window, - GVolume *volume) + GVolume *volume, + gboolean inhibit_autorun) { GMountOperation *mount_op; mount_op = eel_mount_operation_new (parent_window); + g_object_set_data (G_OBJECT (mount_op), "inhibit-autorun", GINT_TO_POINTER (inhibit_autorun)); g_volume_mount (volume, 0, mount_op, NULL, volume_mount_cb, mount_op); } diff --git a/libnautilus-private/nautilus-file-operations.h b/libnautilus-private/nautilus-file-operations.h index 7abe6ec88..ee02ca131 100644 --- a/libnautilus-private/nautilus-file-operations.h +++ b/libnautilus-private/nautilus-file-operations.h @@ -92,7 +92,8 @@ void nautilus_file_operations_unmount_mount (GtkWindow *par gboolean eject, gboolean check_trash); void nautilus_file_operations_mount_volume (GtkWindow *parent_window, - GVolume *volume); + GVolume *volume, + gboolean inhibit_autorun); void nautilus_file_operations_copy (GList *files, diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c index 74f573a92..fb13c0d1c 100644 --- a/libnautilus-private/nautilus-mime-actions.c +++ b/libnautilus-private/nautilus-mime-actions.c @@ -1235,6 +1235,7 @@ activation_mount_not_mounted_callback (GObject *source_object, ActivateParameters *parameters = user_data; GError *error; NautilusFile *file; + GFile *location; file = parameters->not_mounted->data; @@ -1255,6 +1256,10 @@ activation_mount_not_mounted_callback (GObject *source_object, } g_error_free (error); + } else { + location = nautilus_file_get_location (file); + nautilus_inhibit_autorun_for_file (location); + g_object_unref (G_OBJECT (location)); } parameters->not_mounted = g_list_delete_link (parameters->not_mounted, @@ -1276,7 +1281,6 @@ activation_mount_not_mounted (ActivateParameters *parameters) mount_op = eel_mount_operation_new (parameters->parent_window); g_signal_connect (mount_op, "active_changed", (GCallback)activate_mount_op_active, parameters); location = nautilus_file_get_location (file); - nautilus_inhibit_autorun_for_file (location); g_file_mount_enclosing_volume (location, 0, mount_op, parameters->cancellable, activation_mount_not_mounted_callback, parameters); g_object_unref (location); diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 4911d26a7..246b93fe0 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -172,11 +172,8 @@ startup_volume_mount_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { - if (!g_volume_mount_finish (G_VOLUME (source_object), res, NULL)) { - /* There was an error mounting the volume, so we - clear the automount part. This is otherwise done - when the mount is added to the volume monitor */ - g_object_set_data (source_object, "nautilus-automounted", GINT_TO_POINTER (0)); + if (g_volume_mount_finish (G_VOLUME (source_object), res, NULL)) { + nautilus_inhibit_autorun_for_volume (G_VOLUME (source_object)); } } @@ -203,8 +200,6 @@ automount_all_volumes (NautilusApplication *application) g_object_unref (mount); continue; } - - nautilus_inhibit_autorun_for_volume (volume); /* pass NULL as GMountOperation to avoid user interaction */ g_volume_mount (volume, 0, NULL, NULL, startup_volume_mount_cb, NULL); @@ -1332,7 +1327,7 @@ volume_added_callback (GVolumeMonitor *monitor, if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT) && g_volume_should_automount (volume) && g_volume_can_mount (volume)) { - nautilus_file_operations_mount_volume (NULL, volume); + nautilus_file_operations_mount_volume (NULL, volume, FALSE); } } diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c index cd326457d..acb28dbfe 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -1325,8 +1325,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar, GVolume *volume; gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_VOLUME, &volume, -1); if (volume != NULL) { - nautilus_inhibit_autorun_for_volume (volume); - nautilus_file_operations_mount_volume (NULL, volume); + nautilus_file_operations_mount_volume (NULL, volume, TRUE); g_object_unref (volume); } } @@ -1441,8 +1440,7 @@ mount_shortcut_cb (GtkMenuItem *item, -1); if (volume != NULL) { - nautilus_inhibit_autorun_for_volume (volume); - nautilus_file_operations_mount_volume (NULL, volume); + nautilus_file_operations_mount_volume (NULL, volume, TRUE); g_object_unref (volume); } } diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index a16212f55..c1e0d1721 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -913,6 +913,7 @@ mount_not_mounted_callback (GObject *source_object, window->details->mount_error = NULL; g_error_free (error); } else { + nautilus_inhibit_autorun_for_file (G_FILE (source_object)); nautilus_file_invalidate_all_attributes (window->details->determine_view_file); nautilus_file_call_when_ready (window->details->determine_view_file, NAUTILUS_FILE_ATTRIBUTE_INFO | @@ -958,7 +959,6 @@ got_file_info_for_view_selection_callback (NautilusFile *file, data->cancellable = g_cancellable_new (); data->window = window; window->details->mount_cancellable = data->cancellable; - nautilus_inhibit_autorun_for_file (location); g_file_mount_enclosing_volume (location, 0, mount_op, window->details->mount_cancellable, mount_not_mounted_callback, data); g_object_unref (location); |