Index: list_cddrives.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/list_cddrives.c,v
retrieving revision 1.33
diff -p -u -r1.33 list_cddrives.c
--- list_cddrives.c	10 Feb 2006 17:11:15 -0000	1.33
+++ list_cddrives.c	19 Apr 2006 17:08:22 -0000
@@ -52,14 +52,23 @@ list_drive_info (NautilusBurnDrive *driv
 	g_print ("  door:\t\t\t%s\n", door_is_open ? "open" : "closed");
 	g_print ("  type:\t\t\t%s\n", type_str);
 	g_print ("  is mounted:\t\t%s\n", is_mounted ? "TRUE" : "FALSE");
-	g_print ("  max read speed:\t%d\n", max_speed_read);
-	g_print ("  max write speed:\t%d\n", max_speed_write);
+	g_print ("  max read speed:\t%d KiB/s (CD %ix, DVD %ix)\n",
+		  max_speed_read,
+		  NAUTILUS_BURN_DRIVE_CD_SPEED (max_speed_read),
+		  NAUTILUS_BURN_DRIVE_DVD_SPEED (max_speed_read));
+	g_print ("  max write speed:\t%d KiB/s (CD %ix, DVD %ix)\n",
+		  max_speed_write,
+		  NAUTILUS_BURN_DRIVE_CD_SPEED (max_speed_write),
+		  NAUTILUS_BURN_DRIVE_DVD_SPEED (max_speed_write));
 
 	write_speeds = nautilus_burn_drive_get_write_speeds (drive);
 
 	g_print ("  write speeds:\t\t");
 	for (i = 0; write_speeds[i] > 0; i++) {
-		g_print ("%d ", write_speeds[i]);
+		g_print ("%d KiB/s (CD %ix, DVD %ix)\n\t\t\t",
+			  write_speeds[i],
+			  NAUTILUS_BURN_DRIVE_CD_SPEED (write_speeds[i]),
+			  NAUTILUS_BURN_DRIVE_DVD_SPEED (write_speeds[i]));
 	}
 	g_print ("\n");
 
Index: nautilus-burn-drive.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-burn-drive.c,v
retrieving revision 1.62
diff -p -u -r1.62 nautilus-burn-drive.c
--- nautilus-burn-drive.c	22 Mar 2006 17:11:38 -0000	1.62
+++ nautilus-burn-drive.c	19 Apr 2006 17:08:22 -0000
@@ -36,7 +36,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <math.h>
 
 #ifdef __linux__
 #include <linux/cdrom.h>
@@ -83,8 +82,6 @@ int    get_disc_status      (int fd, int
 #define INVALID_HANDLE (GINT_TO_POINTER(-1))
 #endif
 
-#define CD_ROM_SPEED 176
-
 #define CDS_NO_INFO		0	/* if not implemented */
 #define CDS_AUDIO		100
 #define CDS_DATA_1		101
@@ -254,11 +251,8 @@ get_device_max_write_speed (char *device
 {
 	gpointer ioctl_handle;
 	int      fd;
-	int      max_speed;
 	int      read_speed, write_speed;
 
-	max_speed = -1;
-
 	ioctl_handle = open_ioctl_handle (device);
 	if (ioctl_handle == INVALID_HANDLE) {
 		return -1;
@@ -267,9 +261,8 @@ get_device_max_write_speed (char *device
 	fd = get_ioctl_handle_fd (ioctl_handle);
 	get_read_write_speed (fd, &read_speed, &write_speed);
 	close_ioctl_handle (ioctl_handle);
-	max_speed = (int) floor (write_speed) / CD_ROM_SPEED;
 
-	return max_speed;
+	return write_speed;
 }
 
 /* Utility functions, be careful to have a match with what's use in the
@@ -281,11 +274,8 @@ get_device_max_read_speed (char *device)
 {
 	gpointer ioctl_handle;
 	int      fd;
-	int      max_speed;
 	int      read_speed, write_speed;
 
-	max_speed = -1;
-
 	ioctl_handle = open_ioctl_handle (device);
 	if (ioctl_handle == INVALID_HANDLE) {
 		return -1;
@@ -294,9 +284,8 @@ get_device_max_read_speed (char *device)
 	fd = get_ioctl_handle_fd (ioctl_handle);
 	get_read_write_speed (fd, &read_speed, &write_speed);
 	close_ioctl_handle (ioctl_handle);
-	max_speed = (int)floor (read_speed) / CD_ROM_SPEED;
 
-	return max_speed;
+	return read_speed;
 }
 
 static char *
@@ -926,7 +915,7 @@ nautilus_burn_drive_get_media_type_from_
  * nautilus_burn_drive_get_media_type:
  * @drive: #NautilusBurnDrive
  *
- * Get the type of the specified drive.
+ * Determine the type of the media in the drive @drive.
  *
  * Return value: See nautilus_burn_drive_get_media_type_from_path() for details.
  **/
@@ -1108,7 +1097,7 @@ nautilus_burn_drive_hal_get_media_type_f
  * @has_data: set to TRUE if media has data
  * @has_audio: set to TRUE if media has audio
  *
- * Get the type of the specified drive.
+ * Determine the type of the media in the drive @drive
  *
  * Return value: See nautilus_burn_drive_get_media_type_from_path() for details.
  **/
@@ -1936,8 +1925,6 @@ hal_parse_write_speeds (char **strlist)
 			g_free (write_speeds);
 			return NULL;
 		}
-
-		write_speeds[i] /= CD_ROM_SPEED;
 	}
 
 	return write_speeds;
@@ -1946,7 +1933,6 @@ hal_parse_write_speeds (char **strlist)
 #define LIBHAL_PROP_EXTRACT_BEGIN if (FALSE)
 #define LIBHAL_PROP_EXTRACT_END ;
 #define LIBHAL_PROP_EXTRACT_INT(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_INT32) _where_ = libhal_psi_get_int (&it)
-#define LIBHAL_PROP_EXTRACT_INT_DIV(_property_, _where_, _div_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_INT32) _where_ = libhal_psi_get_int (&it) / _div_
 #define LIBHAL_PROP_EXTRACT_STRING(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_STRING) _where_ = (libhal_psi_get_string (&it) != NULL && strlen (libhal_psi_get_string (&it)) > 0) ? strdup (libhal_psi_get_string (&it)) : NULL
 #define LIBHAL_PROP_EXTRACT_BOOL(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_BOOLEAN) _where_ = libhal_psi_get_bool (&it)
 #define LIBHAL_PROP_EXTRACT_BOOL_BITFIELD(_property_, _where_, _field_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_BOOLEAN) _where_ |= libhal_psi_get_bool (&it) ? _field_ : 0
@@ -1990,8 +1976,8 @@ hal_drive_from_udi (LibHalContext *ctx,
 		LIBHAL_PROP_EXTRACT_STRING  ("block.device",               drive->device);
 		LIBHAL_PROP_EXTRACT_STRING  ("storage.model",              drive->display_name);
 
-		LIBHAL_PROP_EXTRACT_INT_DIV ("storage.cdrom.read_speed",   drive->max_speed_read,  CD_ROM_SPEED);
-		LIBHAL_PROP_EXTRACT_INT_DIV ("storage.cdrom.write_speed",  drive->max_speed_write, CD_ROM_SPEED);
+		LIBHAL_PROP_EXTRACT_INT ("storage.cdrom.read_speed",   drive->max_speed_read);
+		LIBHAL_PROP_EXTRACT_INT ("storage.cdrom.write_speed",  drive->max_speed_write);
 		LIBHAL_PROP_EXTRACT_STRLIST ("storage.cdrom.write_speeds", write_speeds);
 
 		LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.cdr",        drive->type, NAUTILUS_BURN_DRIVE_TYPE_CD_RECORDER);
Index: nautilus-burn-drive.h
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-burn-drive.h,v
retrieving revision 1.20
diff -p -u -r1.20 nautilus-burn-drive.h
--- nautilus-burn-drive.h	10 Feb 2006 17:11:15 -0000	1.20
+++ nautilus-burn-drive.h	19 Apr 2006 17:08:23 -0000
@@ -30,6 +30,7 @@
 
 #include <glib-object.h>
 #include <glib.h>
+#include <math.h>
 
 #include "nautilus-burn-features.h"
 
@@ -102,6 +103,8 @@ struct NautilusBurnDriveClass {
 };
 
 #define NAUTILUS_BURN_DRIVE_SIZE_TO_TIME(size) (size > 0 ? (int) (((size / 1024 / 1024) - 1) * 48 / 7): 0)
+#define NAUTILUS_BURN_DRIVE_CD_SPEED(speed) ((int) floor (speed * 1024 / 153600))
+#define NAUTILUS_BURN_DRIVE_DVD_SPEED(speed) ((int) floor (speed * 1024 / 1385000))
 
 GType                 nautilus_burn_drive_get_type                 (void);
 
Index: nautilus-burn-recorder.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-burn-recorder.c,v
retrieving revision 1.44
diff -p -u -r1.44 nautilus-burn-recorder.c
--- nautilus-burn-recorder.c	22 Mar 2006 20:18:27 -0000	1.44
+++ nautilus-burn-recorder.c	19 Apr 2006 17:08:23 -0000
@@ -30,7 +30,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <math.h>
 #include <fcntl.h>
 #include <sys/wait.h>
 #include <sys/types.h>
@@ -1318,7 +1317,8 @@ nautilus_burn_recorder_write_growisofs (
 					GError                       **error)
 {
 	GPtrArray                 *argv;
-	char                      *speed_str, *dev_str;
+	char                      *speed_str = NULL;
+	char			  *dev_str;
 	NautilusBurnRecorderTrack *t;
 	int                        result;
 
@@ -1336,8 +1336,10 @@ nautilus_burn_recorder_write_growisofs (
 	argv = g_ptr_array_new ();
 
 	g_ptr_array_add (argv, "growisofs");
-	speed_str = g_strdup_printf ("-speed=%d", speed);
 	if (speed != 0) {
+		speed = NAUTILUS_BURN_DRIVE_DVD_SPEED (speed);
+
+		speed_str = g_strdup_printf ("-speed=%d", speed);
 		g_ptr_array_add (argv, speed_str);
 	}
 
@@ -1495,6 +1497,7 @@ nautilus_burn_recorder_write_cdrecord (N
 			return res;
 	}
 
+	speed = NAUTILUS_BURN_DRIVE_CD_SPEED (speed);
 
 	if (track->type ==  NAUTILUS_BURN_RECORDER_TRACK_TYPE_CUE) {
 		argv = g_ptr_array_new ();
Index: nautilus-cd-burner.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/nautilus-cd-burner.c,v
retrieving revision 1.187
diff -p -u -r1.187 nautilus-cd-burner.c
--- nautilus-cd-burner.c	19 Apr 2006 14:46:34 -0000	1.187
+++ nautilus-cd-burner.c	19 Apr 2006 17:08:23 -0000
@@ -1752,65 +1752,138 @@ get_speed_selection (GtkWidget *combobox
 }
 
 static void
-refresh_dialog (GladeXML *xml)
+update_speeds_combobox (NautilusBurnDrive *drive,
+			GtkWidget	  *combobox)
 {
-	GtkWidget               *combobox;
+	const int		*write_speeds;
+	int			 i;
+	GtkTreeModel		*model;
+	GtkTreeIter		 iter;
+	NautilusBurnMediaType	 type;
 	GConfClient             *gc;
-	char                    *name;
-	int                      i;
+	gboolean		 is_rewritable;
+	gboolean		 is_blank;
 	int                      default_speed;
-	int                      default_speed_index;
-	NautilusBurnDrive       *drive;
-	GtkTreeModel            *model;
-	GtkTreeIter              iter;
+	int                      default_speed_index = 0;
 
-	default_speed_index = 0;
-
-	/* Find active recorder: */
-	drive = lookup_current_recorder (xml);
-
-	/* add speed items: */
-	combobox = glade_xml_get_widget (xml, "speed_combobox");
-	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
-	gtk_list_store_clear (GTK_LIST_STORE (model));
 
 	gc = gconf_client_get_default ();
 	default_speed = gconf_client_get_int (gc, "/apps/nautilus-cd-burner/default_speed", NULL);
 	g_object_unref (G_OBJECT (gc));
 
+	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
+
+	gtk_list_store_clear (GTK_LIST_STORE (model));
+
 	gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
 			    0, _("Maximum possible"),
 			    1, 0,
 			    -1);
 
-	if (drive) {
-		const int *write_speeds;
+	write_speeds = nautilus_burn_drive_get_write_speeds (drive);
+	type = nautilus_burn_drive_get_media_type_full (drive,
+							&is_rewritable,
+							&is_blank,
+							NULL, NULL);
+
+	for (i = 0; write_speeds[i] > 0; i++) {
+		char *name;
 
-		write_speeds = nautilus_burn_drive_get_write_speeds (drive);
+		name = NULL;
 
-		for (i = 0; write_speeds[i] > 0; i++) {
+		if (write_speeds[i] == default_speed) {
+			default_speed_index = i + 1;
+		}
 
-			if (write_speeds[i] == default_speed) {
-				default_speed_index = i + 1;
+		if (is_rewritable || is_blank) {
+			switch (type) {
+			case NAUTILUS_BURN_MEDIA_TYPE_CDR:
+			case NAUTILUS_BURN_MEDIA_TYPE_CDRW:
+				name = g_strdup_printf ("%d\303\227",
+							NAUTILUS_BURN_DRIVE_CD_SPEED (write_speeds[i]));
+				break;
+			case NAUTILUS_BURN_MEDIA_TYPE_DVDR:
+			case NAUTILUS_BURN_MEDIA_TYPE_DVDRW:
+			case NAUTILUS_BURN_MEDIA_TYPE_DVD_RAM:
+			case NAUTILUS_BURN_MEDIA_TYPE_DVD_PLUS_R:
+			case NAUTILUS_BURN_MEDIA_TYPE_DVD_PLUS_RW:
+			case NAUTILUS_BURN_MEDIA_TYPE_DVD_PLUS_R_DL:
+				name = g_strdup_printf ("%d\303\227",
+							NAUTILUS_BURN_DRIVE_DVD_SPEED (write_speeds[i]));
+				break;
+			default:
+				break;
 			}
 
-			name = g_strdup_printf ("%d \303\227", write_speeds[i]);
-			gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-			gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-					    0, name,
-					    1, write_speeds [i],
-					    -1);
-			g_free (name);
+		} else {
+			name = g_strdup_printf ("CD %d\303\227, DVD %d\303\227",
+						NAUTILUS_BURN_DRIVE_CD_SPEED (write_speeds[i]),
+						NAUTILUS_BURN_DRIVE_DVD_SPEED (write_speeds[i]));
 		}
 
-		/* Disable speed if no items in list */
-		gtk_widget_set_sensitive (combobox, i > 0);
+		/* If we can't get the media type see if the drive is capable DVD */
+		if (name == NULL) {
+			gboolean is_dvd;
+
+			is_dvd = (drive->type & NAUTILUS_BURN_DRIVE_TYPE_DVD_RW_RECORDER)
+				|| (drive->type & NAUTILUS_BURN_DRIVE_TYPE_DVD_RAM_RECORDER);
+			if (is_dvd) {
+				name = g_strdup_printf ("CD %d\303\227, DVD %d\303\227",
+							NAUTILUS_BURN_DRIVE_CD_SPEED (write_speeds[i]),
+							NAUTILUS_BURN_DRIVE_DVD_SPEED (write_speeds[i]));
+			} else {
+				name = g_strdup_printf ("%d\303\227",
+							NAUTILUS_BURN_DRIVE_CD_SPEED (write_speeds[i]));
+			}
+		}
+
+		gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+		gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+				    0, name,
+				    1, write_speeds [i],
+				    -1);
+		g_free (name);
 	}
 
+	/* Disable speed if no items in list */
+	gtk_widget_set_sensitive (combobox, i > 0);
+
 	gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), default_speed_index);
+}
+
+static void
+dialog_media_added_cb (NautilusBurnDrive *drive,
+		       gpointer		  data)
+{
+	update_speeds_combobox (drive, GTK_WIDGET (data));
+}
+
+static void
+refresh_dialog (GladeXML *xml)
+{
+	GtkWidget               *combobox;
+	NautilusBurnDrive       *drive;
+	GtkTreeModel            *model;
+
+	/* Find active recorder: */
+	drive = lookup_current_recorder (xml);
+
+	/* add speed items: */
+	combobox = glade_xml_get_widget (xml, "speed_combobox");
+	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
+
+	g_object_set (drive, "enable-monitor", TRUE, NULL);
+	g_signal_connect (drive, "media-added", G_CALLBACK (dialog_media_added_cb), combobox);
 
 	if (drive) {
+		if (drive->type == NAUTILUS_BURN_DRIVE_TYPE_FILE) {
+			gtk_list_store_clear (GTK_LIST_STORE (model));
+			gtk_widget_set_sensitive (combobox, FALSE);
+		} else {
+			update_speeds_combobox (drive, combobox);
+		}
+
 		nautilus_burn_drive_unref (drive);
 	}
 }
