The attached patch ensures that we use the new NautilusFileInfo API to determine whether a particular file refers to a CD. -- Christian Neumair <chris gnome-de org>
Index: burn-extension.c
===================================================================
RCS file: /cvs/gnome/nautilus-cd-burner/burn-extension.c,v
retrieving revision 1.18
diff -u -p -r1.18 burn-extension.c
--- burn-extension.c 13 Jun 2005 14:46:27 -0000 1.18
+++ burn-extension.c 6 Oct 2005 18:41:23 -0000
@@ -153,32 +153,6 @@ write_cue_activate_cb (NautilusMenuItem
g_free (image_name);
}
-static int
-desktop_uri_get_drive_id (const char *uri)
-{
- GnomeVFSResult result;
- int file_size;
- char *file_contents;
- GKeyFile *key_file;
- char * id;
- int drive_id = -1;
-
- key_file = g_key_file_new ();
- result = eel_read_entire_file (uri, &file_size, &file_contents);
- g_key_file_load_from_data (key_file, file_contents, file_size, G_KEY_FILE_NONE, NULL);
-
- id = g_key_file_get_string (key_file, "Desktop Entry", "X-Gnome-Drive", NULL);
- if (id) {
- drive_id = atol (id);
- }
-
- g_free (id);
- g_free (file_contents);
- g_key_file_free (key_file);
-
- return drive_id;
-}
-
static void
copy_disc_activate_cb (NautilusMenuItem *item,
gpointer user_data)
@@ -216,12 +190,13 @@ nautilus_burn_get_file_items (NautilusMe
NautilusMenuItem *item;
NautilusFileInfo *file;
GnomeVFSFileInfo *info;
+ GnomeVFSVolume *volume;
+ GnomeVFSDrive *drive;
+ char *device_path;
char *mime_type;
gboolean is_local;
gboolean is_iso;
gboolean is_cue;
- gboolean is_desktop_file;
- char *uri;
if (!selection || selection->next != NULL) {
return NULL;
@@ -249,7 +224,6 @@ nautilus_burn_get_file_items (NautilusMe
is_iso = (strcmp (mime_type, "application/x-iso-image") == 0)
|| (strcmp (mime_type, "application/x-cd-image") == 0);
- is_desktop_file = strcmp (mime_type, "application/x-desktop") == 0;
is_cue = strcmp (mime_type, "application/x-cue") == 0;
if (is_iso && is_local) {
@@ -274,43 +248,31 @@ nautilus_burn_get_file_items (NautilusMe
items = g_list_append (items, item);
}
- uri = nautilus_file_info_get_uri (file);
-
- if (is_desktop_file) {
- int drive_id;
-
- drive_id = desktop_uri_get_drive_id (uri);
-
- if (drive_id >= 0) {
- GnomeVFSVolumeMonitor *monitor;
- GnomeVFSDrive *drive;
- GnomeVFSDeviceType device_type;
-
- device_type = GNOME_VFS_DEVICE_TYPE_UNKNOWN;
-
- monitor = gnome_vfs_get_volume_monitor ();
- drive = gnome_vfs_volume_monitor_get_drive_by_id (monitor, drive_id);
- device_type = gnome_vfs_drive_get_device_type (drive);
+ drive = nautilus_file_info_get_drive (file);
+ if (drive == NULL) {
+ volume = nautilus_file_info_get_volume (file);
+ if (volume != NULL) {
+ drive = gnome_vfs_volume_get_drive (volume);
gnome_vfs_drive_unref (drive);
-
- if (device_type == GNOME_VFS_DEVICE_TYPE_CDROM) {
- char *device_path = gnome_vfs_drive_get_device_path (drive);
-
- item = nautilus_menu_item_new ("NautilusBurn::copy_disc",
- _("_Copy Disc..."),
- _("Create a copy of this CD or DVD disc"),
- "gnome-dev-cdrom");
- g_object_set_data (G_OBJECT (item), "file", file);
- g_object_set_data (G_OBJECT (item), "window", window);
- g_object_set_data_full (G_OBJECT (item), "drive_device_path", device_path, g_free);
- g_signal_connect (item, "activate",
- G_CALLBACK (copy_disc_activate_cb), NULL);
- items = g_list_append (items, item);
- }
}
}
- g_free (uri);
+ if (drive != NULL
+ && (gnome_vfs_drive_get_device_type (drive) == GNOME_VFS_DEVICE_TYPE_CDROM)) {
+ device_path = gnome_vfs_drive_get_device_path (drive);
+
+ item = nautilus_menu_item_new ("NautilusBurn::copy_disc",
+ _("_Copy Disc..."),
+ _("Create a copy of this CD or DVD disc"),
+ "gnome-dev-cdrom");
+ g_object_set_data (G_OBJECT (item), "file", file);
+ g_object_set_data (G_OBJECT (item), "window", window);
+ g_object_set_data_full (G_OBJECT (item), "drive_device_path", device_path, g_free);
+ g_signal_connect (item, "activate",
+ G_CALLBACK (copy_disc_activate_cb), NULL);
+ items = g_list_append (items, item);
+ }
+
g_free (mime_type);
return items;
Attachment:
signature.asc
Description: This is a digitally signed message part