gvfs/gvfs-1.13.0-multiseat-dont-automount-if-shared.patch
Tomas Bzatek c5063823ee Update to 1.12.2
- Backport multiseat patches from master
2012-04-27 12:04:45 +02:00

116 lines
4.4 KiB
Diff

From 495bf23f972cb14aa55d15b7c9fe53bd610a0590 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Mon, 23 Apr 2012 15:46:31 -0400
Subject: [PATCH 5/9] udisks2: don't automount if drive is shared across all seats
If we automount media in a drive assigned to all seats, then all
sessions on all seats will be notified of the new media... which is
definitely going to be annoying. Instead, just disable automounting on
such drives so the user manually have to mount it.
Of course, this depends on the shell doing the right thing. Which is:
only notifying the user when successfully auto-mounting in response to
a hotplug event. This is not currently the case, see
https://bugzilla.gnome.org/show_bug.cgi?id=660595#c19
for details about this bug.
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
monitor/udisks2/gvfsudisks2utils.c | 7 ++++++-
monitor/udisks2/gvfsudisks2utils.h | 3 ++-
monitor/udisks2/gvfsudisks2volume.c | 8 ++++++--
monitor/udisks2/gvfsudisks2volumemonitor.c | 2 +-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/monitor/udisks2/gvfsudisks2utils.c b/monitor/udisks2/gvfsudisks2utils.c
index 43d583a..d747a63 100644
--- a/monitor/udisks2/gvfsudisks2utils.c
+++ b/monitor/udisks2/gvfsudisks2utils.c
@@ -547,9 +547,11 @@ get_seat (void)
#endif
gboolean
-gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive)
+gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive,
+ gboolean *out_shared)
{
gboolean ret = FALSE;
+ gboolean shared = FALSE;
const gchar *seat;
const gchar *drive_seat = NULL;
@@ -584,6 +586,7 @@ gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive)
if (g_strcmp0 (drive_seat, "all") == 0)
{
ret = TRUE;
+ shared = TRUE;
goto out;
}
@@ -592,5 +595,7 @@ gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive)
ret = TRUE;
out:
+ if (out_shared != NULL)
+ *out_shared = shared;
return ret;
}
diff --git a/monitor/udisks2/gvfsudisks2utils.h b/monitor/udisks2/gvfsudisks2utils.h
index 1965883..41ce875 100644
--- a/monitor/udisks2/gvfsudisks2utils.h
+++ b/monitor/udisks2/gvfsudisks2utils.h
@@ -50,7 +50,8 @@ gboolean gvfs_udisks2_utils_spawn_finish (GAsyncResult *res,
gchar **out_standard_error,
GError **error);
-gboolean gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive);
+gboolean gvfs_udisks2_utils_is_drive_on_our_seat (UDisksDrive *drive,
+ gboolean *out_shared);
G_END_DECLS
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index a1c7fa4..3ef5895 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -269,6 +269,8 @@ update_volume (GVfsUDisks2Volume *volume)
GIcon *drive_icon;
gchar *media_desc;
GIcon *media_icon;
+ gboolean shared;
+
udisks_client_get_drive_info (gvfs_udisks2_volume_monitor_get_udisks_client (volume->monitor),
udisks_drive,
NULL, /* drive_name */
@@ -314,8 +316,10 @@ update_volume (GVfsUDisks2Volume *volume)
if (media_icon != NULL)
g_object_unref (media_icon);
- /* Only automount drives attached to the same seat as we're running on */
- if (gvfs_udisks2_utils_is_drive_on_our_seat (udisks_drive))
+ /* Only automount drives attached to the same seat as we're running on
+ * and if the drive is NOT shared across all seats
+ */
+ if (gvfs_udisks2_utils_is_drive_on_our_seat (udisks_drive, &shared) && !shared)
{
/* Only automount filesystems from drives of known types/interconnects:
*
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index 2826164..002ab3c 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -906,7 +906,7 @@ should_include_drive (GVfsUDisks2VolumeMonitor *monitor,
gboolean ret = TRUE;
/* Don't include drives on other seats */
- if (!gvfs_udisks2_utils_is_drive_on_our_seat (drive))
+ if (!gvfs_udisks2_utils_is_drive_on_our_seat (drive, NULL))
{
ret = FALSE;
goto out;
--
1.7.3.4