[oe-commits] Koen Kooi : nautilus-cd-burner: add 2.25. 3 + patches to remove runtime dep on 'eject' and 'gnome-mount'

git version control git at git.openembedded.org
Thu Apr 8 07:16:10 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 8775a28f83b9527002654064c7b929d9632d60c2
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=8775a28f83b9527002654064c7b929d9632d60c2

Author: Koen Kooi <koen at openembedded.org>
Date:   Thu Apr  8 09:15:14 2010 +0200

nautilus-cd-burner: add 2.25.3 + patches to remove runtime dep on 'eject' and 'gnome-mount'

---

 recipes/nautilus/nautilus-cd-burner/eject1.diff |  118 +++++++++++++++++++++++
 recipes/nautilus/nautilus-cd-burner/eject2.diff |   80 +++++++++++++++
 recipes/nautilus/nautilus-cd-burner_2.25.3.bb   |   25 +++++
 3 files changed, 223 insertions(+), 0 deletions(-)

diff --git a/recipes/nautilus/nautilus-cd-burner/eject1.diff b/recipes/nautilus/nautilus-cd-burner/eject1.diff
new file mode 100644
index 0000000..9aded68
--- /dev/null
+++ b/recipes/nautilus/nautilus-cd-burner/eject1.diff
@@ -0,0 +1,118 @@
+From 555f4ef2a64a79d7bb63421859eb8a554cfe104d Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess at hadess.net>
+Date: Wed, 17 Dec 2008 11:49:06 +0000
+Subject: Eject using GIO instead of calling out to eject, or gnome-mount (Closes:
+
+2008-12-17  Bastien Nocera  <hadess at hadess.net>
+
+	* src/nautilus-burn-drive.c
+	(nautilus_burn_drive_get_drive_for_node),
+	(nautilus_burn_drive_eject_cb), (nautilus_burn_drive_eject):
+	Eject using GIO instead of calling out to eject, or gnome-mount
+	(Closes: #504391)
+
+
+svn path=/trunk/; revision=2270
+---
+diff --git a/src/nautilus-burn-drive.c b/src/nautilus-burn-drive.c
+index b32078b..2322937 100644
+--- a/src/nautilus-burn-drive.c
++++ b/src/nautilus-burn-drive.c
+@@ -781,6 +781,48 @@ nautilus_burn_drive_is_mounted (NautilusBurnDrive *drive)
+         return drive->priv->media_is_mounted;
+ }
+ 
++static GDrive *
++nautilus_burn_drive_get_drive_for_node (NautilusBurnDrive *drive)
++{
++	GVolumeMonitor *monitor;
++	GList *drives, *l;
++	GDrive *ret;
++
++	ret = NULL;
++
++	monitor = g_volume_monitor_get ();
++	drives = g_volume_monitor_get_connected_drives (monitor);
++	g_object_unref (monitor);
++
++	for (l = drives; l != NULL && ret == NULL; l = l->next) {
++		GDrive *d = l->data;
++		char *id;
++
++		id = g_drive_get_identifier (d, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
++		if (g_strcmp0 (id, drive->priv->device) == 0)
++			ret = g_object_ref (d);
++	}
++	g_list_foreach (drives, (GFunc) g_object_unref, NULL);
++	g_list_free (drives);
++
++	return ret;
++}
++
++typedef struct _CdCacheCallbackData {
++	gboolean called;
++	gboolean result;
++} EjectCallbackData;
++
++static void
++nautilus_burn_drive_eject_cb (GObject *source_object,
++			      GAsyncResult *res,
++			      EjectCallbackData *data)
++{
++	data->result = g_drive_eject_finish (G_DRIVE (source_object),
++					     res, NULL);
++	data->called = TRUE;
++}
++
+ /**
+  * nautilus_burn_drive_eject:
+  * @drive: #NautilusBurnDrive
+@@ -794,8 +836,8 @@ nautilus_burn_drive_is_mounted (NautilusBurnDrive *drive)
+ gboolean
+ nautilus_burn_drive_eject (NautilusBurnDrive *drive)
+ {
+-        char    *cmd;
+-        gboolean res;
++	GDrive *gdrive;
++	EjectCallbackData data;
+ 
+         g_return_val_if_fail (drive != NULL, FALSE);
+ 
+@@ -803,19 +845,25 @@ nautilus_burn_drive_eject (NautilusBurnDrive *drive)
+                 return FALSE;
+         }
+ 
+-#ifdef USE_GNOME_MOUNT
+-        cmd = g_strdup_printf ("gnome-mount --block --eject --no-ui --device=%s", drive->priv->device);
+-#else
+-        cmd = g_strdup_printf ("eject %s", drive->priv->device);
+-#endif
++	gdrive = nautilus_burn_drive_get_drive_for_node (drive);
++	if (gdrive == NULL)
++		return FALSE;
++	if (g_drive_can_eject (gdrive) == FALSE) {
++		g_object_unref (gdrive);
++		return FALSE;
++	}
+ 
+-        res = g_spawn_command_line_sync (cmd, NULL, NULL, NULL, NULL);
+-        g_free (cmd);
++	memset (&data, 0, sizeof(data));
+ 
+-        /* delay a bit to make sure eject finishes */
+-        sleep (1);
++	g_drive_eject (gdrive, G_MOUNT_UNMOUNT_FORCE, NULL,
++		       (GAsyncReadyCallback) nautilus_burn_drive_eject_cb,
++		       &data);
++	while (!data.called)
++		g_main_context_iteration (NULL, TRUE);
+ 
+-        return res;
++	g_object_unref (gdrive);
++
++        return data.result;
+ }
+ 
+ /**
+--
+cgit v0.8.3.1
diff --git a/recipes/nautilus/nautilus-cd-burner/eject2.diff b/recipes/nautilus/nautilus-cd-burner/eject2.diff
new file mode 100644
index 0000000..d097077
--- /dev/null
+++ b/recipes/nautilus/nautilus-cd-burner/eject2.diff
@@ -0,0 +1,80 @@
+From 0a997551806573b6e495353bf9b5766a558c44f9 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess at 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 at 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
diff --git a/recipes/nautilus/nautilus-cd-burner_2.25.3.bb b/recipes/nautilus/nautilus-cd-burner_2.25.3.bb
new file mode 100644
index 0000000..3457bd4
--- /dev/null
+++ b/recipes/nautilus/nautilus-cd-burner_2.25.3.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "Easy To Use GNOME CD/DVD Burning Application"
+LICENSE = "LGPL GPL"
+SECTION = "x11/gnome"
+
+inherit gnome
+
+SRC_URI += " file://eject1.diff;patch=1 \
+             file://eject2.diff;patch=1 \
+"
+
+SRC_URI[archive.md5sum] = "02324246d8e4804e15e41ef7b62836a7"
+SRC_URI[archive.sha256sum] = "ac61757df5d0f8f75f05cf9921b0d5638b0a96b68507475b7034739b9afbc93e"
+
+DEPENDS="dbus-glib glib-2.0 gtk+ hal libglade libgnomeui nautilus"
+# FIXME: recipes are missing
+#RDEPENDS_${PN} = "genisoimage growisofs wodim"
+
+PACKAGES += "nautilus-extension-nautilus-cd-burner"
+FILES_nautilus-extension-nautilus-cd-burner = "${libdir}/nautilus"
+FILES_${PN}-dbg += "${libdir}/nautilus/extensions-*/.debug"
+
+do_install_append() {
+	rm ${D}${libdir}/nautilus/extensions-*/*.la
+}
+





More information about the Openembedded-commits mailing list