diff options
author | David Zeuthen <davidz@redhat.com> | 2012-01-06 13:27:14 -0500 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2012-01-06 13:27:14 -0500 |
commit | b4800b987b4a8423a52306c9aef35b3777464cc5 (patch) | |
tree | 09a92e33f08b0a4973e5edf53da1d005448d976c /monitor | |
parent | 0ba3edd76e0065f6a4229a3d4577698bbf252abf (diff) | |
download | gvfs-b4800b987b4a8423a52306c9aef35b3777464cc5.tar.gz |
Set should_automount and can_mount properties to make automounting work
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/udisks2/gvfsudisks2volume.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c index bc11868c..ea21d79d 100644 --- a/monitor/udisks2/gvfsudisks2volume.c +++ b/monitor/udisks2/gvfsudisks2volume.c @@ -311,6 +311,31 @@ update_volume (GVfsUDisks2Volume *volume) if (media_icon != NULL) g_object_unref (media_icon); + /* Only automount filesystems from drives of known types/interconnects: + * + * - USB + * - Firewire + * - sdio + * - optical discs + * + * The mantra here is "be careful" - we really don't want to + * automount filesystems from all devices in a SAN etc - We + * REALLY need to be CAREFUL here. + * + * Fortunately udisks provides a property just for this. + */ + if (udisks_drive_get_removable (udisks_drive)) + { + /* Also, if a volume (partition) appear _much later_ than when media was inserted it + * can only be because the media was repartitioned. We don't want to automount + * such volumes. So only mark volumes appearing just after their drive. + */ + if (g_get_real_time () - udisks_drive_get_time_media_detected (udisks_drive) < 5 * G_USEC_PER_SEC) + { + volume->should_automount = TRUE; + } + } + g_object_unref (udisks_drive); } @@ -371,6 +396,9 @@ update_volume (GVfsUDisks2Volume *volume) volume->icon = gvfs_udisks2_utils_icon_from_fs_type (g_unix_mount_point_get_fs_type (volume->mount_point)); } + if (volume->mount == NULL) + volume->can_mount = TRUE; + /* ---------------------------------------------------------------------------------------------------- */ /* fallbacks */ |