[Utopia] Re: [patch] fstab-sync mount point names



On Tue, 2004-08-31 at 09:33, Frederic Crozat wrote:
> Well, if we can see the patch, maybe :)

I was pretty sure i attached it... Must have forgotten.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a suicidal alcoholic cyborg from the Mississippi delta. She's an 
enchanted mute femme fatale descended from a line of powerful witches. They 
fight crime! 
? gnome-vfs-fstab-sync-mounts-2.patch
? gnome-vfs-fstab-sync-mounts.patch
? imported/Makefile
? imported/Makefile.in
? imported/neon/Makefile.in
? libgnomevfs/s-enum-types-c
? libgnomevfs/s-enum-types-h
? test/test-dns-sd
? test/test-mime-info-cache
Index: libgnomevfs/gnome-vfs-volume-monitor-daemon.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor-daemon.c,v
retrieving revision 1.12
diff -u -p -r1.12 gnome-vfs-volume-monitor-daemon.c
--- libgnomevfs/gnome-vfs-volume-monitor-daemon.c	26 Aug 2004 13:36:58 -0000	1.12
+++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c	30 Aug 2004 17:22:00 -0000
@@ -292,9 +292,28 @@ get_device_type_from_device_and_mount (c
 			}
 	} else {
 		basename = g_path_get_basename (mount_path);
+
 		if (g_str_has_prefix (basename, "cdrom") ||
 		    g_str_has_prefix (basename, "cdwriter") ||
-		    g_str_has_prefix (basename, "burn")) {
+		    g_str_has_prefix (basename, "burn") ||
+		    g_str_has_prefix (basename, "cdr") ||
+		    g_str_has_prefix (basename, "cdrw") ||
+		    g_str_has_prefix (basename, "dvdrom") ||
+		    g_str_has_prefix (basename, "dvdram") ||
+		    g_str_has_prefix (basename, "dvdr") ||
+		    g_str_has_prefix (basename, "dvdrw") ||
+		    g_str_has_prefix (basename, "cdrom_dvdrom") ||
+		    g_str_has_prefix (basename, "cdrom_dvdram") ||
+		    g_str_has_prefix (basename, "cdrom_dvdr") ||
+		    g_str_has_prefix (basename, "cdrom_dvdrw") ||
+		    g_str_has_prefix (basename, "cdr_dvdrom") ||
+		    g_str_has_prefix (basename, "cdr_dvdram") ||
+		    g_str_has_prefix (basename, "cdr_dvdr") ||
+		    g_str_has_prefix (basename, "cdr_dvdrw") ||
+		    g_str_has_prefix (basename, "cdrw_dvdrom") ||
+		    g_str_has_prefix (basename, "cdrw_dvdram") ||
+		    g_str_has_prefix (basename, "cdrw_dvdr") ||
+		    g_str_has_prefix (basename, "cdrw_dvdrw")) {
 			g_free (basename);
 			return GNOME_VFS_DEVICE_TYPE_CDROM;
 		} else if (g_str_has_prefix (basename, "floppy")) {
@@ -310,6 +329,10 @@ get_device_type_from_device_and_mount (c
 			g_free (basename);
 			return GNOME_VFS_DEVICE_TYPE_CAMERA;
 		} else if (g_str_has_prefix (basename, "memstick") ||
+			   g_str_has_prefix (basename, "compact_flash") ||
+			   g_str_has_prefix (basename, "memory_stick") ||
+			   g_str_has_prefix (basename, "smart_media") ||
+			   g_str_has_prefix (basename, "sd_mmc") ||
 			   g_str_has_prefix (basename, "ram")) {
 			g_free (basename);
 			return GNOME_VFS_DEVICE_TYPE_MEMORY_STICK;
@@ -372,7 +395,7 @@ make_utf8 (const char *str)
 }
 
 static char *
-get_drive_icon_from_type (GnomeVFSDeviceType type)
+get_drive_icon_from_type (GnomeVFSDeviceType type, const char *mount_path)
 {
 	char *icon_name;
 
@@ -385,6 +408,22 @@ get_drive_icon_from_type (GnomeVFSDevice
 	case GNOME_VFS_DEVICE_TYPE_SMB:
 		icon_name = "gnome-fs-smb";
 		break;
+
+	case GNOME_VFS_DEVICE_TYPE_HARDDRIVE:
+		if (mount_path != NULL) {
+			char *basename;	
+			basename = g_path_get_basename (mount_path);
+			if (g_str_has_prefix (basename, 
+					      "usbdisk")) {
+				icon_name = "gnome-dev-removable-usb";
+			} else if (g_str_has_prefix (basename, 
+						     "ieee1394disk")) {
+				icon_name = "gnome-dev-removable-ieee1394";
+			}
+			g_free (basename);
+		}
+		break;
+
 	default:
 		break;
 	}
@@ -393,12 +432,31 @@ get_drive_icon_from_type (GnomeVFSDevice
 }
 
 static char *
-get_icon_from_type (GnomeVFSDeviceType type)
+get_icon_from_type (GnomeVFSDeviceType type, const char *mount_path)
 {
 	char *icon_name;
+	char *basename;	
+
+	if (mount_path != NULL) {
+		basename = g_path_get_basename (mount_path);
+	} else {
+		basename = NULL;
+	}
 
 	icon_name = "gnome-dev-harddisk";
 	switch (type) {
+	case GNOME_VFS_DEVICE_TYPE_HARDDRIVE:
+		if (basename != NULL) {
+			if (g_str_has_prefix (basename, 
+					      "usbdisk")) {
+				icon_name = "gnome-dev-harddisk-usb";
+			} else if (g_str_has_prefix (basename, 
+						     "ieee1394disk")) {
+				icon_name = "gnome-dev-harddisk-ieee1394";
+			}
+		}
+		break;
+
 	case GNOME_VFS_DEVICE_TYPE_AUDIO_CD:
 		icon_name = "gnome-dev-cdrom-audio";
 		break;
@@ -420,6 +478,21 @@ get_icon_from_type (GnomeVFSDeviceType t
 
 	case GNOME_VFS_DEVICE_TYPE_MEMORY_STICK:
 		icon_name = "gnome-dev-memory";
+		if (basename != NULL) {
+			if (g_str_has_prefix (basename, 
+					      "compact_flash")) {
+				icon_name = "gnome-dev-media-cf";
+			} else if (g_str_has_prefix (basename, 
+						     "memory_stick")) {
+				icon_name = "gnome-dev-media-ms";
+			} else if (g_str_has_prefix (basename, 
+						     "smart_media")) {
+				icon_name = "gnome-dev-media-sm";
+			} else if (g_str_has_prefix (basename, 
+						     "sd_mmc")) {
+				icon_name = "gnome-dev-media-sdmmc";
+			}
+		}
 		break;
 	
 	case GNOME_VFS_DEVICE_TYPE_NFS:
@@ -434,6 +507,10 @@ get_icon_from_type (GnomeVFSDeviceType t
 		break;
 	}
 
+	if (basename != NULL) {
+		g_free (basename);
+	}
+
 	return g_strdup (icon_name);
 }
 
@@ -591,7 +696,7 @@ create_drive_from_mount_point (GnomeVFSV
 		}
 	}
 
-	drive->priv->icon = get_drive_icon_from_type (drive->priv->device_type);
+	drive->priv->icon = get_drive_icon_from_type (drive->priv->device_type, mount->mount_path);
 
 	drive->priv->display_name = get_drive_name (volume_monitor, drive, mount);
 	
@@ -836,7 +941,7 @@ create_vol_from_mount (GnomeVFSVolumeMon
 	g_free (display_name);
 	g_free (utf8_name);
 	
-	vol->priv->icon = get_icon_from_type (vol->priv->device_type);
+	vol->priv->icon = get_icon_from_type (vol->priv->device_type, mount->mount_path);
 
 	vol->priv->is_user_visible = 0;
 	switch (vol->priv->device_type) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]