nautilus r14034 - in trunk: . libnautilus-private src
- From: cneumair svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14034 - in trunk: . libnautilus-private src
- Date: Fri, 4 Apr 2008 15:53:07 +0100 (BST)
Author: cneumair
Date: Fri Apr 4 15:53:07 2008
New Revision: 14034
URL: http://svn.gnome.org/viewvc/nautilus?rev=14034&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-file-operations.c
trunk/libnautilus-private/nautilus-file-operations.h
trunk/libnautilus-private/nautilus-mime-actions.c
trunk/src/nautilus-application.c
trunk/src/nautilus-places-sidebar.c
trunk/src/nautilus-window-manage-views.c
Modified: trunk/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.c (original)
+++ trunk/libnautilus-private/nautilus-file-operations.c Fri Apr 4 15:53:07 2008
@@ -2017,6 +2017,9 @@
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 @@
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 @@
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);
}
Modified: trunk/libnautilus-private/nautilus-file-operations.h
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.h (original)
+++ trunk/libnautilus-private/nautilus-file-operations.h Fri Apr 4 15:53:07 2008
@@ -92,7 +92,8 @@
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,
Modified: trunk/libnautilus-private/nautilus-mime-actions.c
==============================================================================
--- trunk/libnautilus-private/nautilus-mime-actions.c (original)
+++ trunk/libnautilus-private/nautilus-mime-actions.c Fri Apr 4 15:53:07 2008
@@ -1235,6 +1235,7 @@
ActivateParameters *parameters = user_data;
GError *error;
NautilusFile *file;
+ GFile *location;
file = parameters->not_mounted->data;
@@ -1255,6 +1256,10 @@
}
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 @@
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);
Modified: trunk/src/nautilus-application.c
==============================================================================
--- trunk/src/nautilus-application.c (original)
+++ trunk/src/nautilus-application.c Fri Apr 4 15:53:07 2008
@@ -172,11 +172,8 @@
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 @@
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 @@
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);
}
}
Modified: trunk/src/nautilus-places-sidebar.c
==============================================================================
--- trunk/src/nautilus-places-sidebar.c (original)
+++ trunk/src/nautilus-places-sidebar.c Fri Apr 4 15:53:07 2008
@@ -1325,8 +1325,7 @@
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 @@
-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);
}
}
Modified: trunk/src/nautilus-window-manage-views.c
==============================================================================
--- trunk/src/nautilus-window-manage-views.c (original)
+++ trunk/src/nautilus-window-manage-views.c Fri Apr 4 15:53:07 2008
@@ -913,6 +913,7 @@
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 @@
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]