Index: nautilus//libnautilus-private/nautilus-volume-monitor.c
===================================================================
RCS file: /export/cvs/gnome-2.0/nautilus/libnautilus-private/nautilus-volume-monitor.c,v
retrieving revision 1.135
diff -p -u -5 -r1.135 nautilus-volume-monitor.c
--- nautilus//libnautilus-private/nautilus-volume-monitor.c	2002/08/29 10:56:02	1.135
+++ nautilus//libnautilus-private/nautilus-volume-monitor.c	2002/10/05 06:45:25
@@ -158,11 +158,10 @@ struct NautilusVolume {
 	NautilusFileSystemType *file_system_type;
 	
 	char *device_path;
 	char *mount_path;
 	char *volume_name;
-	dev_t device;
 	
 	gboolean is_read_only;
 	gboolean is_removable;
 	gboolean is_audio_cd;
 };
@@ -467,26 +466,31 @@ nautilus_volume_monitor_get_volume_for_p
 					     const char            *path)
 {
 	struct stat statbuf;
 	dev_t device;
 	GList *p;
-	NautilusVolume *volume;
+	NautilusVolume *volume = NULL;
+	size_t chars_matched = 0;
+	NautilusVolume *tmp_volume = NULL;
 
 	if (stat (path, &statbuf) != 0)
 		return NULL;
 
 	device = statbuf.st_dev;
 
 	for (p = monitor->details->mounts; p != NULL; p = p->next) {
-		volume = (NautilusVolume *) p->data;
+		tmp_volume = (NautilusVolume *) p->data;
 
-		if (volume->device == device) {
-			return volume;
+		if (strstr (path, tmp_volume->mount_path)) {
+			if (strlen (tmp_volume->mount_path) > chars_matched) {
+				volume = tmp_volume;
+				chars_matched = strlen (tmp_volume->mount_path);
+			}
 		}
 	}
 
-	return NULL;
+	return volume;
 }
 
 #if defined (HAVE_GETMNTINFO) || defined (HAVE_MNTENT_H) || defined (SOLARIS_MNT)
 
 static gboolean
@@ -1716,11 +1720,10 @@ nautilus_volume_copy (const NautilusVolu
 	new_volume->file_system_type = volume->file_system_type;
 
 	new_volume->device_path = g_strdup (volume->device_path);
 	new_volume->mount_path = g_strdup (volume->mount_path);
 	new_volume->volume_name = g_strdup (volume->volume_name);
-	new_volume->device = volume->device;
 	
 	new_volume->is_read_only = volume->is_read_only;
 	new_volume->is_removable = volume->is_removable;
 	new_volume->is_audio_cd = volume->is_audio_cd;
 
@@ -1782,15 +1785,10 @@ static gboolean
 finish_creating_volume (NautilusVolumeMonitor *monitor, NautilusVolume *volume,
 			const char *file_system_type_name)
 {
 	gboolean ok;
 	const char *name;
-	struct stat statbuf;
-
-	if (stat (volume->mount_path, &statbuf) == 0) {
-		volume->device = statbuf.st_dev;
-	}
 
 	volume->file_system_type = g_hash_table_lookup
 		(monitor->details->file_system_table, file_system_type_name);
 
 	if (strcmp (file_system_type_name, "auto") == 0) {
