summaryrefslogtreecommitdiff
path: root/recipes/nautilus/nautilus-cd-burner/eject2.diff
blob: d097077efe54d85e96f4c11ea2f980b95150365f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From 0a997551806573b6e495353bf9b5766a558c44f9 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 17 Dec 2008 11:52:37 +0000
Subject: Simplify _can_eject by calling out to GIO instead of our Linux specific

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


svn path=/trunk/; revision=2271
---
diff --git a/src/nautilus-burn-drive.c b/src/nautilus-burn-drive.c
index 2322937..541d6f2 100644
--- a/src/nautilus-burn-drive.c
+++ b/src/nautilus-burn-drive.c
@@ -1492,29 +1492,6 @@ nautilus_burn_drive_class_init (NautilusBurnDriveClass *klass)
                                                                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 @@ can_drive_eject (int fd)
 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;
 }
--
cgit v0.8.3.1