nautilus-cd-burner r2271 - in trunk: . src



Author: hadess
Date: Wed Dec 17 11:52:37 2008
New Revision: 2271
URL: http://svn.gnome.org/viewvc/nautilus-cd-burner?rev=2271&view=rev

Log:
2008-12-17  Bastien Nocera  <hadess hadess net>

	* src/nautilus-burn-drive.c (nautilus_burn_drive_can_eject):
	Simplify _can_eject by calling out to GIO instead of our
	Linux specific ioctl



Modified:
   trunk/ChangeLog
   trunk/src/nautilus-burn-drive.c

Modified: trunk/src/nautilus-burn-drive.c
==============================================================================
--- trunk/src/nautilus-burn-drive.c	(original)
+++ trunk/src/nautilus-burn-drive.c	Wed Dec 17 11:52:37 2008
@@ -1492,29 +1492,6 @@
                                                                G_PARAM_READWRITE));
 }
 
-static gboolean
-can_drive_eject (int fd)
-{
-        if (fd < 0) {
-                return FALSE;
-        }
-
-#ifdef __linux__
-        {
-                int status;
-
-                status = ioctl (fd, CDROM_GET_CAPABILITY, 0);
-                if (status < 0) {
-                        return FALSE;
-                }
-
-                return status & CDC_OPEN_TRAY;
-        }
-#else
-        return FALSE;
-#endif
-}
-
 /**
  * nautilus_burn_drive_can_eject:
  * @drive: #NautilusBurnDrive
@@ -1526,22 +1503,16 @@
 gboolean
 nautilus_burn_drive_can_eject (NautilusBurnDrive *drive)
 {
-        gpointer ioctl_handle;
-        int      fd;
-        gboolean ret;
+	GDrive *gdrive;
+	gboolean ret;
 
         g_return_val_if_fail (drive != NULL, FALSE);
 
-        ioctl_handle = open_ioctl_handle (drive->priv->device);
-        if (ioctl_handle == INVALID_HANDLE) {
-                return FALSE;
-        }
-
-        fd = get_ioctl_handle_fd (ioctl_handle);
-
-        ret = can_drive_eject (fd);
-
-        close_ioctl_handle (ioctl_handle);
+	gdrive = nautilus_burn_drive_get_drive_for_node (drive);
+	if (gdrive == NULL)
+		return FALSE;
+	ret = g_drive_can_eject (gdrive);
+	g_object_unref (gdrive);
 
         return ret;
 }



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