? libgnomevfs/s-enum-types-c
? libgnomevfs/s-enum-types-h
Index: libgnomevfs/gnome-vfs-volume-monitor.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor.c,v
retrieving revision 1.6
diff -u -r1.6 gnome-vfs-volume-monitor.c
--- libgnomevfs/gnome-vfs-volume-monitor.c	15 Jul 2004 13:21:15 -0000	1.6
+++ libgnomevfs/gnome-vfs-volume-monitor.c	18 Jul 2004 10:58:23 -0000
@@ -475,6 +475,44 @@
 	g_signal_emit (volume_monitor, volume_monitor_signals[VOLUME_PRE_UNMOUNT], 0, volume);
 }
 
+static gint
+insert_compare_func (GObject *a,
+		     GObject *b)
+{
+	gchar *aname, *acmp = NULL;
+	gchar *bname, *bcmp = NULL;
+	gint retval = 0;
+
+	if (GNOME_IS_VFS_VOLUME (a))
+		aname = gnome_vfs_volume_get_display_name (GNOME_VFS_VOLUME (a));
+	else /* GNOME_IS_VFS_DRIVE (a) */
+		aname = gnome_vfs_drive_get_display_name (GNOME_VFS_DRIVE (a));
+
+	if (GNOME_IS_VFS_VOLUME (b))
+		bname = gnome_vfs_volume_get_display_name (GNOME_VFS_VOLUME (b));
+	else /* GNOME_IS_VFS_DRIVE (b) */
+		bname = gnome_vfs_drive_get_display_name (GNOME_VFS_DRIVE (b));
+
+	if (aname)
+		acmp = g_utf8_casefold (aname, -1);
+	if (bname)
+		bcmp = g_utf8_casefold (bname, -1);
+
+	if (acmp && bcmp)
+		retval = g_utf8_collate (acmp, bcmp);
+
+	if (aname)
+		g_free (aname);
+	if (bname)
+		g_free (bname);
+	if (acmp)
+		g_free (acmp);
+	if (bcmp)
+		g_free (bcmp);
+
+	return retval;
+}
+
 void
 _gnome_vfs_volume_monitor_mounted (GnomeVFSVolumeMonitor *volume_monitor,
 				   GnomeVFSVolume        *volume)
@@ -484,16 +522,16 @@
 	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) insert_compare_func);
 		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) insert_compare_func);
 		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) insert_compare_func);
 		break;
 	default:
 		g_assert_not_reached ();
@@ -536,7 +574,8 @@
 	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) insert_compare_func);
 	drive->priv->is_connected = 1;
 	g_mutex_unlock (volume_monitor->priv->mutex);
 	
