Index: mapping-method.c
===================================================================
--- mapping-method.c	(wersja 2107)
+++ mapping-method.c	(kopia robocza)
@@ -53,7 +53,11 @@
 #include "mapping-protocol.h"
 #include "mapping-method.h"
 
+#include "nautilus-burn-drive.h"
+#include "nautilus-burn-drive-monitor.h"
+
 MappingProtocolChannel *daemon_ioc = NULL;
+NautilusBurnDriveMonitor *drive_monitor = NULL;
 
 #define LAUNCH_DAEMON_TIMEOUT 2*1000
 
@@ -68,12 +72,25 @@
 	GnomeVFSFileInfoOptions options;
 } VirtualDirHandle;
 
+typedef enum {
+	VIRTUAL_FILE_TYPE_DEVICE,
+	VIRTUAL_FILE_TYPE_BACKING
+} VirtualFileHandleType;
+
 typedef struct {
-	GnomeVFSHandle *handle;
-	char           *backing_file;
-} VirtualFileHandle;
+	VirtualFileHandleType  type;
+	GnomeVFSHandle        *handle;
+	char                  *backing_file;
+} VirtualFileBackingHandle;
 
 typedef struct {
+	VirtualFileHandleType  type;
+	char                  *name;
+	char                  *content;
+	GnomeVFSFileSize       pos;
+} VirtualFileDeviceHandle;
+
+typedef struct {
 	GnomeVFSURI *uri;
 	gboolean     cancelled;
 } VirtualFileMonitorHandle;
@@ -125,6 +142,31 @@
 }
 #endif
 
+VirtualFileDeviceHandle *
+virtual_file_device_handle_new(const char *name) 
+{
+	VirtualFileDeviceHandle *vfd = g_new0(VirtualFileDeviceHandle, 1);
+	vfd->type = VIRTUAL_FILE_TYPE_DEVICE;
+	vfd->name = g_strdup(name);
+	vfd->content = g_strdup_printf("[Desktop Entry]\n"
+					"Encoding=UTF-8\n"
+					"Version=1.0\n"
+					"Type=Link\n"
+					"Icon=gnome-dev-cdrom\n"
+					"URL=burn://%s/\n"
+					"Name=%s\n",
+					name, name);
+	return vfd;
+}
+
+VirtualFileBackingHandle *
+virtual_file_backing_handle_new() 
+{
+	VirtualFileBackingHandle *vfd = g_new0(VirtualFileBackingHandle, 1);
+	vfd->type = VIRTUAL_FILE_TYPE_BACKING;
+	return vfd;
+}
+
 static char *
 get_path_from_uri (const GnomeVFSURI *uri)
 {
@@ -289,8 +331,8 @@
 	gboolean                res;
 	GnomeVFSURI            *file_uri = NULL;
 	GnomeVFSHandle         *file_handle;
-	VirtualFileHandle      *handle;
 	char                   *path;
+	const gchar            *device_str;
 	MappingProtocolMessage *reply;
 
 	DEBUG_PRINT ("do_open: %s", uri->text);
@@ -301,41 +343,50 @@
 		return GNOME_VFS_ERROR_INVALID_URI;
 	}
 
-	reply = NULL;
-	res = request_op (MAPPING_PROTOCOL_OP_GET_BACKING_FILE,
-			  uri->method_string,
-			  path,
-			  NULL,
-			  mode & GNOME_VFS_OPEN_WRITE,
-			  NULL,
-			  &reply);
-	g_free (path);
+ 	device_str = gnome_vfs_uri_get_host_name(uri);
+	if (device_str == NULL) {
+		VirtualFileDeviceHandle *handle = virtual_file_device_handle_new(path+1);
+		*method_handle = (GnomeVFSMethodHandle *)handle;
+		ret = GNOME_VFS_OK;
+	} else {
+		VirtualFileBackingHandle *handle;
 
-	if (! res) {
-		return GNOME_VFS_ERROR_IO;
-	}
+		reply = NULL;
+		res = request_op (MAPPING_PROTOCOL_OP_GET_BACKING_FILE,
+				g_strdup(device_str),
+				path,
+				NULL,
+				mode & GNOME_VFS_OPEN_WRITE,
+				NULL,
+				&reply);
+		g_free (path);
 
-	ret = MAPPING_PROTOCOL_REPLY (reply)->result;
+		if (! res) {
+			return GNOME_VFS_ERROR_IO;
+		}
 
-	if (ret == GNOME_VFS_OK) {
-		file_uri = get_uri (MAPPING_PROTOCOL_REPLY (reply)->path);
-		ret = gnome_vfs_open_uri_cancellable (&file_handle,
-						      file_uri, mode, context);
+		ret = MAPPING_PROTOCOL_REPLY (reply)->result;
 
 		if (ret == GNOME_VFS_OK) {
-			handle = g_new (VirtualFileHandle, 1);
-			handle->handle = file_handle;
-			handle->backing_file = g_strdup (MAPPING_PROTOCOL_REPLY (reply)->path);
-			*method_handle = (GnomeVFSMethodHandle *)handle;
+			file_uri = get_uri (MAPPING_PROTOCOL_REPLY (reply)->path);
+			ret = gnome_vfs_open_uri_cancellable (&file_handle,
+					file_uri, mode, context);
+
+			if (ret == GNOME_VFS_OK) {
+				handle = virtual_file_backing_handle_new ();
+				handle->handle = file_handle;
+				handle->backing_file = g_strdup (MAPPING_PROTOCOL_REPLY (reply)->path);
+				*method_handle = (GnomeVFSMethodHandle *)handle;
+			}
+
+			gnome_vfs_uri_unref (file_uri);
 		}
 
-		gnome_vfs_uri_unref (file_uri);
+		if (reply) {
+			mapping_protocol_message_unref (reply);
+		}
 	}
 
-	if (reply) {
-		mapping_protocol_message_unref (reply);
-	}
-
 	return ret;
 }
 
@@ -348,14 +399,14 @@
 	   guint                  perm,
 	   GnomeVFSContext       *context)
 {
-	GnomeVFSResult          ret;
-	gboolean                res;
-	GnomeVFSURI            *file_uri;
-	char                   *path;
-	MappingProtocolMessage *reply;
-	gboolean                newly_created;
-	GnomeVFSHandle         *file_handle;
-	VirtualFileHandle      *handle;
+	GnomeVFSResult            ret;
+	gboolean                  res;
+	GnomeVFSURI              *file_uri;
+	char                     *path;
+	MappingProtocolMessage   *reply;
+	gboolean                  newly_created;
+	GnomeVFSHandle           *file_handle;
+	VirtualFileBackingHandle *handle;
 
 	DEBUG_PRINT ("do_create: %s", uri->text);
 
@@ -388,7 +439,7 @@
 			 perm, context);
 		gnome_vfs_uri_unref (file_uri);
 		if (ret == GNOME_VFS_OK) {
-			handle = g_new (VirtualFileHandle, 1);
+			handle = virtual_file_backing_handle_new ();
 			handle->handle = file_handle;
 			handle->backing_file = g_strdup (MAPPING_PROTOCOL_REPLY (reply)->path);
 			*method_handle = (GnomeVFSMethodHandle *)handle;
@@ -413,18 +464,24 @@
 	  GnomeVFSContext      *context)
 
 {
-	VirtualFileHandle *vfh;
-	GnomeVFSHandle    *handle;
+	VirtualFileHandleType *type;
 
 	DEBUG_PRINT ("do_close: %p", method_handle);
 
-	vfh    = (VirtualFileHandle *)method_handle;
-	handle = vfh->handle;
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		VirtualFileBackingHandle *vfh = (VirtualFileBackingHandle *)method_handle;
+		GnomeVFSHandle           *handle = vfh->handle;
 
-	g_free (vfh->backing_file);
-	g_free (vfh);
-
-	return gnome_vfs_close_cancellable (handle, context);
+		g_free (vfh->backing_file);
+		g_free (vfh);
+		return gnome_vfs_close_cancellable (handle, context);
+	} else {
+		VirtualFileDeviceHandle *vfh = (VirtualFileDeviceHandle *)method_handle;
+		g_free(vfh->content);
+		g_free(vfh);
+		return GNOME_VFS_OK;
+	}
 }
 
 static GnomeVFSResult
@@ -435,12 +492,34 @@
 	 GnomeVFSFileSize    *bytes_read,
 	 GnomeVFSContext     *context)
 {
+	VirtualFileHandleType *type;
+
 	DEBUG_PRINT ("do_read: %p", method_handle);
-	return gnome_vfs_read_cancellable (((VirtualFileHandle *)method_handle)->handle,
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		return gnome_vfs_read_cancellable (((VirtualFileBackingHandle *)method_handle)->handle,
 					   buffer,
 					   num_bytes,
 					   bytes_read,
 					   context);
+	} else {
+		VirtualFileDeviceHandle *vfh = (VirtualFileDeviceHandle *) method_handle;
+		GnomeVFSFileSize possible_to_read;
+
+		if (vfh->pos == strlen(vfh->content)) {
+			*bytes_read = 0;
+			return GNOME_VFS_ERROR_EOF;
+		}
+
+		possible_to_read = strlen(vfh->content) - vfh->pos;
+		*bytes_read = possible_to_read < num_bytes ? possible_to_read : num_bytes;
+
+		memcpy(buffer, vfh->content + vfh->pos, *bytes_read);
+		vfh->pos += *bytes_read;
+	
+		return GNOME_VFS_OK;
+	}
 }
 
 static GnomeVFSResult
@@ -451,12 +530,20 @@
 	  GnomeVFSFileSize     *bytes_written,
 	  GnomeVFSContext      *context)
 {
+	VirtualFileHandleType *type;
+
 	DEBUG_PRINT ("do_write: %p", method_handle);
-	return gnome_vfs_write_cancellable (((VirtualFileHandle *)method_handle)->handle,
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		return gnome_vfs_write_cancellable (((VirtualFileBackingHandle *)method_handle)->handle,
 					    buffer,
 					    num_bytes,
 					    bytes_written,
 					    context);
+	} else {
+		return GNOME_VFS_ERROR_NOT_PERMITTED;
+	}
 
 }
 
@@ -467,11 +554,30 @@
 	 GnomeVFSFileOffset    offset,
 	 GnomeVFSContext      *context)
 {
+	VirtualFileHandleType *type;
+
 	DEBUG_PRINT ("do_seek: %p", method_handle);
-	return gnome_vfs_seek_cancellable (((VirtualFileHandle *)method_handle)->handle,
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		return gnome_vfs_seek_cancellable (((VirtualFileBackingHandle *)method_handle)->handle,
 					   whence,
 					   offset,
 					   context);
+	} else {
+		VirtualFileDeviceHandle *vfh = (VirtualFileDeviceHandle *) method_handle;
+
+		if (whence == GNOME_VFS_SEEK_START) 
+			vfh->pos = offset;
+		else if (whence == GNOME_VFS_SEEK_CURRENT) 
+			vfh->pos += offset;
+		else if (whence == GNOME_VFS_SEEK_END)
+			vfh->pos = strlen(vfh->content) + offset;
+
+		return GNOME_VFS_OK;
+	}
+
+	
 }
 
 static GnomeVFSResult
@@ -479,9 +585,18 @@
 	 GnomeVFSMethodHandle *method_handle,
 	 GnomeVFSFileSize     *offset_return)
 {
+	VirtualFileHandleType *type;
+
 	DEBUG_PRINT ("do_tell: %p", method_handle);
-	return gnome_vfs_tell (((VirtualFileHandle *)method_handle)->handle,
-			       offset_return);
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		return gnome_vfs_tell (((VirtualFileBackingHandle *)method_handle)->handle,
+				       offset_return);
+	} else {
+		return ((VirtualFileDeviceHandle *)method_handle)->pos;
+
+	}
 }
 
 static GnomeVFSResult
@@ -490,10 +605,17 @@
 		    GnomeVFSFileSize      where,
 		    GnomeVFSContext      *context)
 {
-	DEBUG_PRINT ("do_truncate_handle: %p", method_handle);
-	return gnome_vfs_truncate_handle_cancellable (((VirtualFileHandle *)method_handle)->handle,
-						      where,
-						      context);
+	VirtualFileHandleType *type;
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		DEBUG_PRINT ("do_truncate_handle: %p", method_handle);
+		return gnome_vfs_truncate_handle_cancellable (((VirtualFileBackingHandle *)method_handle)->handle,
+							      where,
+							      context);
+	} else {
+		return GNOME_VFS_ERROR_NOT_PERMITTED;
+	}
 }
 
 static GnomeVFSResult
@@ -503,9 +625,10 @@
 		   GnomeVFSFileInfoOptions options,
 		   GnomeVFSContext        *context)
 {
+	int			i;
 	char                   *path;
+	const gchar            *device_str;
 	VirtualDirHandle       *handle;
-	MappingProtocolMessage *reply;
 	GnomeVFSResult          ret;
 	gboolean                res;
 
@@ -518,45 +641,66 @@
 		return GNOME_VFS_ERROR_INVALID_URI;
 	}
 
-	reply = NULL;
-	res = request_op (MAPPING_PROTOCOL_OP_LIST_DIR,
-			  uri->method_string,
-			  path, NULL,
-			  FALSE,
-			  NULL,
-			  &reply);
+	device_str = gnome_vfs_uri_get_host_name(uri);
+	if (device_str == NULL) {
+		NautilusBurnDrive *drive;
+		GList *l = nautilus_burn_drive_monitor_get_drives(drive_monitor);
 
-	if (! res) {
-		return GNOME_VFS_ERROR_IO;
-	}
+		ret = GNOME_VFS_OK;
+		handle = g_new(VirtualDirHandle, 1);
+		handle->n_items = g_list_length (l) + 1;
+		handle->listing = g_new0(char *, handle->n_items * 2);
 
-	ret = MAPPING_PROTOCOL_REPLY (reply)->result;
+		for (i=0; l != NULL; i += 2, l = l->next) {
+		 	drive = (NautilusBurnDrive*) l->data;
+			handle->listing[i] = nautilus_burn_drive_get_name_for_display(drive);
+			handle->listing[i + 1] = NULL;
+		}
 
-	if (ret == GNOME_VFS_OK) {
-		int i;
+		handle->listing[i] = g_strdup("ISO Image");
+		handle->listing[i + 1] = NULL;
 
-		handle = g_new (VirtualDirHandle, 1);
+	} else {
+		MappingProtocolMessage *reply = NULL;
 
-		handle->pos = 0;
-		handle->dirname = path;
+		res = request_op (MAPPING_PROTOCOL_OP_LIST_DIR,
+				g_strdup(device_str),
+				path, NULL,
+				FALSE,
+				NULL,
+				&reply);
 
-		g_assert ((MAPPING_PROTOCOL_REPLY (reply)->n_strings % 2) == 0);
-		handle->n_items = MAPPING_PROTOCOL_REPLY (reply)->n_strings / 2;
-		handle->listing = g_new0 (char *, MAPPING_PROTOCOL_REPLY (reply)->n_strings);
-		for (i = 0; i < MAPPING_PROTOCOL_REPLY (reply)->n_strings; i++) {
-			handle->listing[i] = g_strdup (MAPPING_PROTOCOL_REPLY (reply)->strings[i]);
+		if (! res) {
+			return GNOME_VFS_ERROR_IO;
 		}
 
-		handle->root = g_strdup (uri->method_string);
+		ret = MAPPING_PROTOCOL_REPLY (reply)->result;
+
+		if (ret == GNOME_VFS_OK) {
+			handle = g_new (VirtualDirHandle, 1);
+
+			g_assert ((MAPPING_PROTOCOL_REPLY (reply)->n_strings % 2) == 0);
+			handle->n_items = MAPPING_PROTOCOL_REPLY (reply)->n_strings / 2;
+			handle->listing = g_new0 (char *, MAPPING_PROTOCOL_REPLY (reply)->n_strings);
+			for (i = 0; i < MAPPING_PROTOCOL_REPLY (reply)->n_strings; i++) {
+				handle->listing[i] = g_strdup (MAPPING_PROTOCOL_REPLY (reply)->strings[i]);
+			}
+
+		}
+
+		mapping_protocol_message_unref (reply);
+	}
+
+	if (ret == GNOME_VFS_OK) {
+		handle->pos = 0;
+		handle->dirname = path;
+		handle->root = g_strdup (device_str);
 		handle->options = options;
-
 		*method_handle = (GnomeVFSMethodHandle *)handle;
 	} else {
-		g_free (path);
+		g_free(path);
 	}
-
-	mapping_protocol_message_unref (reply);
-
+	
 	return ret;
 }
 
@@ -595,6 +739,30 @@
 	file_info->mime_type = g_strdup ("x-directory/normal");
 }
 
+static void
+fill_in_device_info (GnomeVFSFileInfo *file_info)
+{
+	VirtualFileDeviceHandle *vfd;
+	vfd = virtual_file_device_handle_new(file_info->name);
+
+	file_info->valid_fields |=
+		GNOME_VFS_FILE_INFO_FIELDS_TYPE |
+		GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS |
+		GNOME_VFS_FILE_INFO_FIELDS_FLAGS |
+		GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE |
+		GNOME_VFS_FILE_INFO_FIELDS_SIZE;
+
+	file_info->uid = getuid ();
+	file_info->type = GNOME_VFS_FILE_TYPE_REGULAR;
+	file_info->permissions = GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_OTHER_READ;
+	file_info->flags = GNOME_VFS_FILE_FLAGS_LOCAL;
+	file_info->mime_type = g_strdup ("application/x-desktop");
+	file_info->size = strlen(vfd->content);
+
+	g_free(vfd->content);
+	g_free(vfd);
+}
+
 static GnomeVFSResult
 do_read_directory (GnomeVFSMethod       *method,
 		   GnomeVFSMethodHandle *method_handle,
@@ -608,7 +776,7 @@
 	char             *path;
 	GnomeVFSURI      *file_uri;
 
-	DEBUG_PRINT ("do_read_directory: %p", method_handle);
+	DEBUG_PRINT ("do_read_directory: %p", method_handle);	
 
 	while (TRUE) {
 		if (handle->pos >= handle->n_items) {
@@ -621,7 +789,10 @@
 
 		if (backingfile == NULL) {
 			file_info->name = g_strdup (name);
-			fill_in_directory_info (file_info);
+			if (handle->root != NULL)
+				fill_in_directory_info (file_info);
+			else
+				fill_in_device_info (file_info);
 			break;
 		}
 
@@ -656,6 +827,7 @@
 	gboolean                res;
 	GnomeVFSURI            *file_uri = NULL;
 	char                   *path;
+	const gchar            *device_str;
 	MappingProtocolMessage *reply;
 
 	DEBUG_PRINT ("do_get_file_info: %s", uri->text);
@@ -665,39 +837,49 @@
 		return GNOME_VFS_ERROR_INVALID_URI;
 	}
 
-	reply = NULL;
-	res = request_op (MAPPING_PROTOCOL_OP_GET_BACKING_FILE,
-			  uri->method_string,
-			  path,
-			  NULL,
-			  FALSE,
-			  NULL,
-			  &reply);
+	device_str = gnome_vfs_uri_get_host_name(uri);
+	if (device_str == NULL) {
+		file_info->name = g_path_get_basename (path);
+		if (!strcmp(path, "/")) 
+			fill_in_directory_info (file_info);
+		else 
+			fill_in_device_info (file_info);
+		ret = GNOME_VFS_OK;
+	} else {
+		reply = NULL;
+		res = request_op (MAPPING_PROTOCOL_OP_GET_BACKING_FILE,
+				g_strdup(device_str),
+				path,
+				NULL,
+				FALSE,
+				NULL,
+				&reply);
 
-	if (! res) {
-		ret = GNOME_VFS_ERROR_IO;
-		DEBUG_PRINT ("do_get_file_info: file %s IO ERROR", path);
-		goto out;
-	}
+		if (! res) {
+			ret = GNOME_VFS_ERROR_IO;
+			DEBUG_PRINT ("do_get_file_info: file %s IO ERROR", path);
+			goto out;
+		}
 
-	ret = MAPPING_PROTOCOL_REPLY (reply)->result;
-	DEBUG_PRINT ("do_get_file_info: file %s result %s", path, gnome_vfs_result_to_string (ret));
+		ret = MAPPING_PROTOCOL_REPLY (reply)->result;
+		DEBUG_PRINT ("do_get_file_info: file %s result %s", path, gnome_vfs_result_to_string (ret));
 
-	if (ret == GNOME_VFS_ERROR_IS_DIRECTORY) {
-		file_info->name = g_path_get_basename (path);
-		fill_in_directory_info (file_info);
-		ret = GNOME_VFS_OK;
-	} else if (ret == GNOME_VFS_OK) {
-		file_uri = get_uri (MAPPING_PROTOCOL_REPLY (reply)->path);
-		ret = gnome_vfs_get_file_info_uri_cancellable (file_uri, file_info, options, context);
-		gnome_vfs_uri_unref (file_uri);
+		if (ret == GNOME_VFS_ERROR_IS_DIRECTORY) {
+			file_info->name = g_path_get_basename (path);
+			fill_in_directory_info (file_info);
+			ret = GNOME_VFS_OK;
+		} else if (ret == GNOME_VFS_OK) {
+			file_uri = get_uri (MAPPING_PROTOCOL_REPLY (reply)->path);
+			ret = gnome_vfs_get_file_info_uri_cancellable (file_uri, file_info, options, context);
+			gnome_vfs_uri_unref (file_uri);
 
-		g_free (file_info->name);
-		file_info->name = g_path_get_basename (path);
+			g_free (file_info->name);
+			file_info->name = g_path_get_basename (path);
+		}
+
+		mapping_protocol_message_unref (reply);
 	}
 
-	mapping_protocol_message_unref (reply);
-
  out:
 	g_free (path);
 
@@ -711,13 +893,21 @@
 			      GnomeVFSFileInfoOptions options,
 			      GnomeVFSContext        *context)
 {
-	GnomeVFSResult res;
+	VirtualFileHandleType *type;
 
 	DEBUG_PRINT ("do_get_file_info_from_handle: %p", method_handle);
-	res = gnome_vfs_get_file_info_from_handle_cancellable (((VirtualFileHandle *)method_handle)->handle,
-							       file_info, options, context);
-	/* TODO: Need to fill out the real name here. Need to wrap method_handle */
-	return res;
+
+	type = (VirtualFileHandleType *) method_handle;
+	if (*type == VIRTUAL_FILE_TYPE_BACKING) {
+		/* TODO: Need to fill out the real name here. Need to wrap method_handle */
+		return gnome_vfs_get_file_info_from_handle_cancellable (((VirtualFileBackingHandle *)method_handle)->handle,
+								       file_info, options, context);
+	} else {
+		VirtualFileDeviceHandle *vfh = (VirtualFileDeviceHandle*) method_handle;
+		file_info->name = g_strdup (vfh->name);
+		fill_in_device_info (file_info);
+		return GNOME_VFS_OK;
+	}
 }
 
 static GnomeVFSResult
@@ -1196,9 +1386,9 @@
 		 gpointer              operation_data,
 		 GnomeVFSContext      *context)
 {
-	VirtualFileHandle *handle;
+	VirtualFileBackingHandle *handle;
 
-	handle = (VirtualFileHandle *)method_handle;
+	handle = (VirtualFileBackingHandle *)method_handle;
 
 	if (strcmp (operation, "mapping:get_mapping") == 0) {
 		*(char **)operation_data = g_strdup (handle->backing_file);
@@ -1213,11 +1403,11 @@
 		 GnomeVFSFileOffset    offset,
 		 GnomeVFSFileSize      size)
 {
-	VirtualFileHandle *handle;
+	VirtualFileBackingHandle *handle;
 
 	g_return_val_if_fail (method_handle != NULL, GNOME_VFS_ERROR_INTERNAL);
 
-	handle = (VirtualFileHandle *) method_handle;
+	handle = (VirtualFileBackingHandle *) method_handle;
 
 	return GNOME_VFS_ERROR_NOT_SUPPORTED;
 }
@@ -1376,6 +1566,7 @@
 
 	daemon_ioc = mapping_protocol_channel_new (daemon_fd);
 	mapping_protocol_channel_set_message_handler (daemon_ioc, handle_message, NULL);
+	drive_monitor = nautilus_burn_get_drive_monitor();
 
 	return &method;
 }
Index: Makefile.am
===================================================================
--- Makefile.am	(wersja 2107)
+++ Makefile.am	(kopia robocza)
@@ -117,7 +117,7 @@
 libmapping_la_CFLAGS = $(AM_CFLAGS)
 
 libmapping_la_LDFLAGS = $(module_flags)
-libmapping_la_LIBADD = $(MAPPING_LIBS)
+libmapping_la_LIBADD = $(MAPPING_LIBS) libnautilus-burn.la
 
 ### Nautilus Extension
 nautilus_extensiondir = $(libdir)/nautilus/extensions-1.0
