Dear nautilus maintainers, You will find attached a patch, backported from the upstream SVN. It should be applied on current nautilus source package available in experimental.
I have tested this on my machine and it works fine. As it isn't too intrusive, I think it is worth applying it now, without waiting for nautilus 2.26 to be out. Cheers, Julien -- Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org Rejoignez maintenant plus de 4 000 personnes, associations, entreprises et collectivités qui soutiennent notre action
diff -urN nautilus-2.24.2.orig/debian/changelog nautilus-2.24.2/debian/changelog --- nautilus-2.24.2.orig/debian/changelog 2009-03-08 13:37:32.000000000 +0100 +++ nautilus-2.24.2/debian/changelog 2009-03-08 12:40:10.000000000 +0100 @@ -1,3 +1,11 @@ +nautilus (2.24.2-2.1) experimental; urgency=low + + * Non-maintainer upload. + * Applied patch from upstream SVN to inhibit automounting on non- + active sessions (Closes: #512824) + + -- Julien Valroff <[email protected]> Sun, 08 Mar 2009 12:40:08 +0100 + nautilus (2.24.2-2) experimental; urgency=low * Add a Breaks with g-v-m << 2.24 to avoid double actions on device diff -urN nautilus-2.24.2.orig/debian/patches/50_automount-only-on-active-session.patch nautilus-2.24.2/debian/patches/50_automount-only-on-active-session.patch --- nautilus-2.24.2.orig/debian/patches/50_automount-only-on-active-session.patch 1970-01-01 01:00:00.000000000 +0100 +++ nautilus-2.24.2/debian/patches/50_automount-only-on-active-session.patch 2009-03-08 13:23:55.000000000 +0100 @@ -0,0 +1,183 @@ +--- nautilus-2.24.2.orig/src/nautilus-application.h ++++ nautilus-2.24.2/src/nautilus-application.h +@@ -29,6 +29,7 @@ + + #include <gdk/gdk.h> + #include <gio/gio.h> ++#include <dbus/dbus-glib.h> + #include <bonobo/bonobo-generic-factory.h> + #include <libnautilus-private/nautilus-undo-manager.h> + +@@ -59,6 +60,8 @@ + gboolean shell_registered; + GVolumeMonitor *volume_monitor; + unsigned int automount_idle_id; ++ DBusGProxy *ck_session_proxy; ++ gboolean session_is_active; + } NautilusApplication; + + typedef struct { +--- nautilus-2.24.2.orig/src/nautilus-application.c ++++ nautilus-2.24.2/src/nautilus-application.c +@@ -62,6 +62,7 @@ + #include <glib/gstdio.h> + #include <glib/gi18n.h> + #include <gio/gio.h> ++#include <dbus/dbus-glib.h> + #include <bonobo/bonobo-main.h> + #include <bonobo/bonobo-object.h> + #include <eel/eel-gtk-extensions.h> +@@ -126,6 +127,9 @@ + static void update_session (gpointer callback_data); + static void init_session (void); + static gboolean is_kdesktop_present (void); ++static void ck_session_active_changed_cb (DBusGProxy *proxy, ++ gboolean is_active, ++ void *user_data); + + BONOBO_CLASS_BOILERPLATE (NautilusApplication, nautilus_application, + BonoboGenericFactory, BONOBO_TYPE_GENERIC_FACTORY) +@@ -207,6 +211,98 @@ + + } + ++#define CK_NAME "org.freedesktop.ConsoleKit" ++#define CK_PATH "/org/freedesktop/ConsoleKit" ++ ++static void ++ck_session_active_changed_cb (DBusGProxy *proxy, ++ gboolean is_active, ++ void *user_data) ++{ ++ NautilusApplication *application = user_data; ++ ++ application->session_is_active = is_active; ++} ++ ++static void ++ck_call_is_active_cb (DBusGProxy *proxy, ++ DBusGProxyCall *call_id, ++ void *user_data) ++{ ++ gboolean res, is_active; ++ NautilusApplication *application; ++ ++ application = user_data; ++ ++ res = dbus_g_proxy_end_call (proxy, call_id, NULL, ++ G_TYPE_BOOLEAN, &is_active, ++ G_TYPE_INVALID); ++ if (!res) { ++ g_object_unref (proxy); ++ ++ application->session_is_active = TRUE; ++ return; ++ } ++ ++ application->session_is_active = is_active; ++ ++ dbus_g_proxy_add_signal (proxy, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); ++ dbus_g_proxy_connect_signal (proxy, "ActiveChanged", ++ G_CALLBACK (ck_session_active_changed_cb), application, ++ NULL); ++} ++ ++static void ++ck_get_current_session_cb (DBusGProxy *proxy, ++ DBusGProxyCall *call_id, ++ void *user_data) ++{ ++ gboolean res; ++ char *session_id; ++ NautilusApplication *application; ++ application = user_data; ++ ++ res = dbus_g_proxy_end_call (proxy, call_id, NULL, ++ DBUS_TYPE_G_OBJECT_PATH, &session_id, G_TYPE_INVALID); ++ if (!res) { ++ g_object_unref (proxy); ++ ++ application->session_is_active = TRUE; ++ return; ++ } ++ ++ application->ck_session_proxy = dbus_g_proxy_new_from_proxy (proxy, CK_NAME ".Session", ++ session_id); ++ dbus_g_proxy_begin_call (application->ck_session_proxy, "IsActive", ck_call_is_active_cb, ++ application, NULL, G_TYPE_INVALID); ++ ++ g_object_unref (proxy); ++} ++ ++ ++static void ++do_initialize_consolekit (NautilusApplication *application) ++{ ++ DBusGConnection *conn; ++ DBusGProxy *proxy; ++ GError *error = NULL; ++ ++ conn = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); ++ if (error) { ++ g_error_free (error); ++ ++ application->session_is_active = TRUE; ++ ++ return; ++ } ++ ++ proxy = dbus_g_proxy_new_for_name (conn, CK_NAME, CK_PATH "/Manager", ++ CK_NAME ".Manager"); ++ dbus_g_proxy_begin_call (proxy, "GetCurrentSession", ++ ck_get_current_session_cb, application, ++ NULL, G_TYPE_INVALID); ++} ++ + static void + nautilus_application_instance_init (NautilusApplication *application) + { +@@ -276,6 +372,13 @@ + application->automount_idle_id = 0; + } + ++ if (application->ck_session_proxy != NULL) { ++ dbus_g_proxy_disconnect_signal (application->ck_session_proxy, "ActiveChanged", ++ G_CALLBACK (ck_session_active_changed_cb), NULL); ++ g_object_unref (application->ck_session_proxy); ++ application->ck_session_proxy = NULL; ++ } ++ + EEL_CALL_PARENT (BONOBO_OBJECT_CLASS, destroy, (object)); + } + +@@ -429,6 +532,9 @@ + /* Initialize the desktop link monitor singleton */ + nautilus_desktop_link_monitor_get (); + ++ /* Initialize the ConsoleKit listener for active session */ ++ do_initialize_consolekit (application); ++ + /* Watch for mounts so we can restore open windows This used + * to be for showing new window on mount, but is not used + * anymore */ +@@ -514,7 +620,6 @@ + g_free (desktop_dir); + } + +- + static Bonobo_RegistrationResult + nautilus_bonobo_activation_register_for_display (const char *iid, + Bonobo_Unknown ref) +@@ -1436,7 +1541,11 @@ + { + NautilusDirectory *directory; + GFile *root; +- ++ ++ if (!application->session_is_active) { ++ return; ++ } ++ + root = g_mount_get_root (mount); + directory = nautilus_directory_get_existing (root); + g_object_unref (root); diff -urN nautilus-2.24.2.orig/debian/patches/series nautilus-2.24.2/debian/patches/series --- nautilus-2.24.2.orig/debian/patches/series 2009-03-08 13:37:32.000000000 +0100 +++ nautilus-2.24.2/debian/patches/series 2009-03-08 12:38:43.000000000 +0100 @@ -4,4 +4,5 @@ 12_list-view_expand.patch 14_sidebar_network-protocol.patch 20_open-with_install.patch +50_automount-only-on-active-session.patch 99_ltmain_as-needed.patch

