Index: libgnomevfs/gnome-vfs-volume-monitor.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor.c,v
retrieving revision 1.17
diff -u -p -r1.17 gnome-vfs-volume-monitor.c
--- libgnomevfs/gnome-vfs-volume-monitor.c	17 Feb 2006 13:33:52 -0000	1.17
+++ libgnomevfs/gnome-vfs-volume-monitor.c	3 Mar 2006 16:45:56 -0000
@@ -675,6 +675,84 @@ gnome_vfs_volume_monitor_emit_pre_unmoun
 	g_signal_emit (volume_monitor, volume_monitor_signals[VOLUME_PRE_UNMOUNT], 0, volume);
 }
 
+static int
+compare_volumes_by_display_name (GnomeVFSVolume *volume_a,
+				 GnomeVFSVolume *volume_b)
+{
+	char *a_name, *b_name;
+	int retval;
+
+	if (volume_a == volume_b)
+		return 0;
+
+	a_name = gnome_vfs_volume_get_display_name (volume_a);
+
+	b_name = gnome_vfs_volume_get_display_name (volume_a);
+
+	if (a_name == NULL && b_name == NULL)
+		return 0;
+
+	if (a_name == NULL)
+		retval = 1;
+	else if (b_name == NULL)
+		retval = -1;
+	else {
+		char *a_cmp, *b_cmp;
+
+		a_cmp = g_utf8_casefold (a_name, -1);
+		b_cmp = g_utf8_casefold (b_name, -1);
+
+		retval = strcmp (a_cmp, b_cmp);
+
+		g_free (a_cmp);
+		g_free (b_cmp);
+	}
+
+	g_free (a_name);
+	g_free (b_name);
+
+	return retval;
+}
+
+static int
+compare_drives_by_display_name (GnomeVFSDrive *drive_a,
+				GnomeVFSDrive *drive_b)
+{
+	char *a_name, *b_name;
+	int retval;
+
+	if (drive_a == drive_b)
+		return 0;
+
+	a_name = gnome_vfs_drive_get_display_name (drive_a);
+
+	b_name = gnome_vfs_drive_get_display_name (drive_a);
+
+	if (a_name == NULL && b_name == NULL)
+		return 0;
+
+	if (a_name == NULL)
+		retval = 1;
+	else if (b_name == NULL)
+		retval = -1;
+	else {
+		char *a_cmp, *b_cmp;
+
+		a_cmp = g_utf8_casefold (a_name, -1);
+		b_cmp = g_utf8_casefold (b_name, -1);
+
+		retval = strcmp (a_cmp, b_cmp);
+
+		g_free (a_cmp);
+		g_free (b_cmp);
+	}
+
+	g_free (a_name);
+	g_free (b_name);
+
+	return retval;
+}
+
 void
 _gnome_vfs_volume_monitor_mounted (GnomeVFSVolumeMonitor *volume_monitor,
 				   GnomeVFSVolume        *volume)
@@ -684,16 +762,16 @@ _gnome_vfs_volume_monitor_mounted (Gnome
 	g_mutex_lock (volume_monitor->priv->mutex);
 	switch (volume->priv->volume_type) {
 	case GNOME_VFS_VOLUME_TYPE_MOUNTPOINT:
-		volume_monitor->priv->mtab_volumes = g_list_prepend (volume_monitor->priv->mtab_volumes,
-								     volume);
+		volume_monitor->priv->mtab_volumes = g_list_insert_sorted (volume_monitor->priv->mtab_volumes, volume,
+									   (GCompareFunc) compare_volumes_by_display_name);
 		break;
 	case GNOME_VFS_VOLUME_TYPE_CONNECTED_SERVER:
-		volume_monitor->priv->server_volumes = g_list_prepend (volume_monitor->priv->server_volumes,
-								       volume);
+		volume_monitor->priv->server_volumes = g_list_insert_sorted (volume_monitor->priv->server_volumes, volume,
+									     (GCompareFunc) compare_volumes_by_display_name);
 		break;
 	case GNOME_VFS_VOLUME_TYPE_VFS_MOUNT:
-		volume_monitor->priv->vfs_volumes = g_list_prepend (volume_monitor->priv->vfs_volumes,
-								    volume);
+		volume_monitor->priv->vfs_volumes = g_list_insert_sorted (volume_monitor->priv->vfs_volumes, volume,
+									  (GCompareFunc) compare_volumes_by_display_name);
 		break;
 	default:
 		g_assert_not_reached ();
@@ -736,7 +814,9 @@ _gnome_vfs_volume_monitor_connected (Gno
 	gnome_vfs_drive_ref (drive);
 	
 	g_mutex_lock (volume_monitor->priv->mutex);
-	volume_monitor->priv->fstab_drives = g_list_prepend (volume_monitor->priv->fstab_drives, drive);
+	volume_monitor->priv->fstab_drives = g_list_insert_sorted (volume_monitor->priv->fstab_drives, drive,
+								   (GCompareFunc) compare_drives_by_display_name);
+
 	drive->priv->is_connected = 1;
 	g_mutex_unlock (volume_monitor->priv->mutex);
 	
