brasero r1755 - in trunk: . libbrasero-media src src/plugins/checksum src/plugins/dvdcss



Author: philippr
Date: Fri Jan 16 09:35:12 2009
New Revision: 1755
URL: http://svn.gnome.org/viewvc/brasero?rev=1755&view=rev

Log:
2009-01-16  Philippe Rouquier  <bonfire-app wanadoo fr>

	Rework API and set eject for drives only not volumes
	Fix mounted volume detection
	Also allow for auth window when mounting

	Fixed some warnings with strings and dialogs

	Fix wrong macro in plugin

	* libbrasero-media/Makefile.am:
	* libbrasero-media/brasero-drive.c (brasero_drive_can_eject),
	(brasero_drive_eject), (brasero_drive_init),
	(brasero_drive_finalize):
	* libbrasero-media/brasero-drive.h:
	* libbrasero-media/brasero-gio-operation.c
	(brasero_gio_operation_destroy), (brasero_gio_operation_end),
	(brasero_gio_operation_timeout), (brasero_gio_operation_cancelled),
	(brasero_gio_operation_wait_for_operation_end),
	(brasero_gio_operation_umounted_cb),
	(brasero_gio_operation_umount_finish),
	(brasero_gio_operation_umount),
	(brasero_gio_operation_mount_finish),
	(brasero_gio_operation_mount),
	(brasero_gio_operation_eject_finish),
	(brasero_gio_operation_removed_cb),
	(brasero_gio_operation_eject_volume),
	(brasero_gio_operation_ejected_cb),
	(brasero_gio_operation_disconnected_cb),
	(brasero_gio_operation_eject_drive):
	* libbrasero-media/brasero-gio-operation.h:
	* libbrasero-media/brasero-volume.c (brasero_volume_is_mounted),
	(brasero_volume_get_mount_point), (brasero_volume_umount),
	(brasero_volume_mount), (brasero_volume_cancel_current_operation),
	(brasero_volume_finalize):
	* libbrasero-media/brasero-volume.h:
	* src/brasero-app.c (brasero_app_dialog):
	* src/brasero-burn-dialog.c (brasero_burn_dialog_image_error):
	* src/brasero-disc-option-dialog.c
	(brasero_disc_option_dialog_joliet_toggled_cb):
	* src/brasero-drive-properties.c
	(brasero_drive_properties_check_tmpdir):
	* src/brasero-eject-dialog.c (brasero_eject_dialog_activate):
	* src/brasero-split-dialog.c
	(brasero_split_dialog_clear_confirm_dialog):
	* src/brasero-sum-dialog.c
	(brasero_sum_dialog_set_track_checksum_type):
	* src/brasero-utils.c (brasero_utils_create_message_dialog):
	* src/burn.c (brasero_burn_eject), (brasero_burn_mount_media),
	(brasero_burn_unlock_src_media), (brasero_burn_unlock_dest_media):
	* src/plugins/checksum/Makefile.am:
	* src/plugins/checksum/burn-volume-read.c
	(brasero_volume_file_open), (brasero_volume_file_check_state):
	* src/plugins/dvdcss/burn-dvdcss.c
	(brasero_dvdcss_create_scrambled_sectors_map):


Added:
   trunk/libbrasero-media/brasero-gio-operation.c
   trunk/libbrasero-media/brasero-gio-operation.h
Modified:
   trunk/ChangeLog
   trunk/libbrasero-media/Makefile.am
   trunk/libbrasero-media/brasero-drive.c
   trunk/libbrasero-media/brasero-drive.h
   trunk/libbrasero-media/brasero-volume.c
   trunk/libbrasero-media/brasero-volume.h
   trunk/src/Makefile.am
   trunk/src/brasero-app.c
   trunk/src/brasero-burn-dialog.c
   trunk/src/brasero-disc-option-dialog.c
   trunk/src/brasero-drive-properties.c
   trunk/src/brasero-eject-dialog.c
   trunk/src/brasero-split-dialog.c
   trunk/src/brasero-sum-dialog.c
   trunk/src/brasero-utils.c
   trunk/src/burn.c
   trunk/src/plugins/checksum/Makefile.am
   trunk/src/plugins/checksum/burn-volume-read.c
   trunk/src/plugins/dvdcss/burn-dvdcss.c

Modified: trunk/libbrasero-media/Makefile.am
==============================================================================
--- trunk/libbrasero-media/Makefile.am	(original)
+++ trunk/libbrasero-media/Makefile.am	Fri Jan 16 09:35:12 2009
@@ -126,7 +126,9 @@
 	brasero-drive-selection.c         \
 	brasero-drive-selection.h         \
 	brasero-media-private.h         \
-	brasero-medium-selection-priv.h
+	brasero-medium-selection-priv.h         \
+	brasero-gio-operation.h         \
+	brasero-gio-operation.c
 
 # FreeBSD's SCSI CAM interface
 if HAVE_CAM_LIB_H

Modified: trunk/libbrasero-media/brasero-drive.c
==============================================================================
--- trunk/libbrasero-media/brasero-drive.c	(original)
+++ trunk/libbrasero-media/brasero-drive.c	Fri Jan 16 09:35:12 2009
@@ -35,6 +35,7 @@
 #include <gio/gio.h>
 
 #include "brasero-media-private.h"
+#include "brasero-gio-operation.h"
 
 #include "brasero-medium.h"
 #include "brasero-volume.h"
@@ -66,6 +67,8 @@
 
 	gulong hal_sig;
 
+	GCancellable *cancel;
+
 	guint probed:1;
 };
 
@@ -154,6 +157,110 @@
 }
 
 /**
+ * brasero_drive_can_eject:
+ * @drive: #BraseroDrive
+ *
+ * Returns whether the drive can eject media.
+ *
+ * Return value: a #gboolean. TRUE if the media can be ejected, FALSE otherwise.
+ *
+ **/
+gboolean
+brasero_drive_can_eject (BraseroDrive *drive)
+{
+	GDrive *gdrive;
+	GVolume *volume;
+	gboolean result;
+	BraseroDrivePrivate *priv;
+
+	g_return_val_if_fail (drive != NULL, FALSE);
+	g_return_val_if_fail (BRASERO_IS_DRIVE (drive), FALSE);
+
+	priv = BRASERO_DRIVE_PRIVATE (drive);
+
+	gdrive = brasero_drive_get_gdrive (drive);
+	if (!gdrive) {
+		BRASERO_MEDIA_LOG ("No GDrive");
+		goto last_resort;
+	}
+
+	if (!g_drive_can_eject (gdrive)) {
+		BRASERO_MEDIA_LOG ("GDrive can't eject");
+		goto last_resort;
+	}
+
+	g_object_unref (gdrive);
+	return TRUE;
+
+last_resort:
+
+	if (gdrive)
+		g_object_unref (gdrive);
+
+	if (!priv->medium)
+		return FALSE;
+
+	/* last resort */
+	volume = brasero_volume_get_gvolume (BRASERO_VOLUME (priv->medium));
+	if (!volume)
+		return FALSE;
+
+	result = g_volume_can_eject (volume);
+	g_object_unref (volume);
+
+	return result;
+}
+
+/**
+ * brasero_drive_eject:
+ * @drive: #BraseroDrive
+ * @wait: #gboolean
+ * @error: #GError
+ *
+ * Open the drive tray or ejects the media if there is any inside.
+ *
+ * Return value: a #gboolean. TRUE on success, FALSE otherwise.
+ *
+ **/
+gboolean
+brasero_drive_eject (BraseroDrive *drive,
+		     gboolean wait,
+		     GError **error)
+{
+	BraseroDrivePrivate *priv;
+	GVolume *gvolume;
+	GDrive *gdrive;
+	gboolean res;
+
+	g_return_val_if_fail (drive != NULL, FALSE);
+	g_return_val_if_fail (BRASERO_IS_DRIVE (drive), FALSE);
+
+	priv = BRASERO_DRIVE_PRIVATE (drive);
+
+	gdrive = brasero_drive_get_gdrive (drive);
+	res = brasero_gio_operation_eject_drive (gdrive,
+						 priv->cancel,
+						 wait,
+						 error);
+	g_object_unref (gdrive);
+
+	if (res)
+		return TRUE;
+
+	if (!priv->medium)
+		return FALSE;
+
+	gvolume = brasero_volume_get_gvolume (BRASERO_VOLUME (priv->medium));
+	res = brasero_gio_operation_eject_volume (gvolume,
+						  priv->cancel,
+						  wait,
+						  error);
+	g_object_unref (gvolume);
+
+	return res;
+}
+
+/**
  * brasero_drive_get_bus_target_lun_string:
  * @drive: a #BraseroDrive
  *
@@ -528,7 +635,12 @@
 
 static void
 brasero_drive_init (BraseroDrive *object)
-{ }
+{
+	BraseroDrivePrivate *priv;
+
+	priv = BRASERO_DRIVE_PRIVATE (object);
+	priv->cancel = g_cancellable_new ();
+}
 
 static void
 brasero_drive_finalize (GObject *object)
@@ -571,6 +683,12 @@
 		priv->udi = NULL;
 	}
 
+	if (priv->cancel) {
+		g_cancellable_cancel (priv->cancel);
+		g_object_unref (priv->cancel);
+		priv->cancel = NULL;
+	}
+
 	G_OBJECT_CLASS (brasero_drive_parent_class)->finalize (object);
 }
 

Modified: trunk/libbrasero-media/brasero-drive.h
==============================================================================
--- trunk/libbrasero-media/brasero-drive.h	(original)
+++ trunk/libbrasero-media/brasero-drive.h	Fri Jan 16 09:35:12 2009
@@ -107,6 +107,14 @@
 brasero_drive_can_write (BraseroDrive *drive);
 
 gboolean
+brasero_drive_can_eject (BraseroDrive *drive);
+
+gboolean
+brasero_drive_eject (BraseroDrive *drive,
+		     gboolean wait,
+		     GError **error);
+
+gboolean
 brasero_drive_is_door_open (BraseroDrive *drive);
 
 gboolean

Added: trunk/libbrasero-media/brasero-gio-operation.c
==============================================================================
--- (empty file)
+++ trunk/libbrasero-media/brasero-gio-operation.c	Fri Jan 16 09:35:12 2009
@@ -0,0 +1,502 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Brasero
+ * Copyright (C) Rouquier Philippe 2009 <bonfire-app wanadoo fr>
+ * 
+ * Brasero is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Brasero is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include "brasero-drive.h"
+#include "brasero-media-private.h"
+#include "brasero-gio-operation.h"
+
+typedef struct _BraseroGioOperation BraseroGioOperation;
+struct _BraseroGioOperation
+{
+	GMainLoop *loop;
+	GCancellable *cancel;
+	guint timeout_id;
+	gboolean result;
+	GError *error;
+};
+
+static void
+brasero_gio_operation_destroy (BraseroGioOperation *operation)
+{
+	if (operation->cancel) {
+		g_cancellable_cancel (operation->cancel);
+		operation->cancel = NULL;
+	}
+
+	if (operation->timeout_id) {
+		g_source_remove (operation->timeout_id);
+		operation->timeout_id = 0;
+	}
+
+	if (operation->loop && g_main_loop_is_running (operation->loop))
+		g_main_loop_quit (operation->loop);
+}
+
+static void
+brasero_gio_operation_end (gpointer callback_data)
+{
+	BraseroGioOperation *operation = callback_data;
+
+	if (!operation->loop)
+		return;
+
+	if (!g_main_loop_is_running (operation->loop))
+		return;
+
+	g_main_loop_quit (operation->loop);	
+}
+
+static gboolean
+brasero_gio_operation_timeout (gpointer callback_data)
+{
+	BraseroGioOperation *operation = callback_data;
+
+	brasero_gio_operation_end (operation);
+
+	BRASERO_MEDIA_LOG ("Volume/Disc operation timed out");
+
+	operation->timeout_id = 0;
+	operation->result = FALSE;
+	return FALSE;
+}
+
+static void
+brasero_gio_operation_cancelled (GCancellable *cancel,
+				 BraseroGioOperation *operation)
+{
+	operation->result = FALSE;
+	g_cancellable_cancel (operation->cancel);
+	if (operation->loop && g_main_loop_is_running (operation->loop))
+		g_main_loop_quit (operation->loop);
+}
+
+static gboolean
+brasero_gio_operation_wait_for_operation_end (BraseroGioOperation *operation,
+					      GError **error)
+{
+	BRASERO_MEDIA_LOG ("Waiting for end of async operation");
+
+	g_object_ref (operation->cancel);
+	g_cancellable_reset (operation->cancel);
+	g_signal_connect (operation->cancel,
+			  "cancelled",
+			  G_CALLBACK (brasero_gio_operation_cancelled),
+			  operation);
+
+	/* put a timeout (30 sec) */
+	operation->timeout_id = g_timeout_add_seconds (20,
+						       brasero_gio_operation_timeout,
+						       operation);
+
+	operation->loop = g_main_loop_new (NULL, FALSE);
+	g_main_loop_run (operation->loop);
+
+	g_main_loop_unref (operation->loop);
+	operation->loop = NULL;
+
+	if (operation->timeout_id) {
+		g_source_remove (operation->timeout_id);
+		operation->timeout_id = 0;
+	}
+
+	if (operation->error) {
+		if (error)
+			g_propagate_error (error, operation->error);
+		else
+			g_error_free (operation->error);
+
+		operation->error = NULL;
+	}
+	g_cancellable_reset (operation->cancel);
+	g_object_unref (operation->cancel);
+
+	return operation->result;
+}
+
+static void
+brasero_gio_operation_umounted_cb (GMount *mount,
+				   BraseroGioOperation *operation)
+{
+	brasero_gio_operation_end (operation);
+}
+
+static void
+brasero_gio_operation_umount_finish (GObject *source,
+				     GAsyncResult *result,
+				     gpointer user_data)
+{
+	BraseroGioOperation *op = user_data;
+
+	if (!op->loop)
+		return;
+
+	op->result = g_mount_unmount_finish (G_MOUNT (source),
+					     result,
+					     &op->error);
+
+	BRASERO_MEDIA_LOG ("Umount operation completed (result = %d)", op->result);
+
+	if (op->error) {
+		if (op->error->code == G_IO_ERROR_FAILED_HANDLED) {
+			/* means we shouldn't display any error message since 
+			 * that was already done */
+			g_error_free (op->error);
+			op->error = NULL;
+		}
+		else if (op->error->code == G_IO_ERROR_NOT_MOUNTED) {
+			/* That can happen sometimes */
+			g_error_free (op->error);
+			op->error = NULL;
+			op->result = TRUE;
+		}
+
+		/* Since there was an error. The "unmounted" signal won't be 
+		 * emitted by GVolumeMonitor and therefore we'd get stuck if
+		 * we didn't get out of the loop. */
+		brasero_gio_operation_end (op);
+	}
+	else if (!op->result)
+		brasero_gio_operation_end (op);
+}
+
+gboolean
+brasero_gio_operation_umount (GVolume *gvolume,
+			      GCancellable *cancel,
+			      gboolean wait,
+			      GError **error)
+{
+	GMount *mount;
+	gboolean result;
+
+	BRASERO_MEDIA_LOG ("Unmounting volume %s", g_volume_get_name (gvolume));
+
+	if (!gvolume) {
+		BRASERO_MEDIA_LOG ("No volume");
+		return TRUE;
+	}
+
+	mount = g_volume_get_mount (gvolume);
+	if (!mount) {
+		BRASERO_MEDIA_LOG ("No mount");
+		return TRUE;
+	}
+
+	if (!g_mount_can_unmount (mount)) {
+		/* NOTE: that can happen when for example a blank medium is 
+		 * mounted on burn:// */
+		BRASERO_MEDIA_LOG ("Mount can't unmount");
+		return FALSE;
+	}
+
+	if (wait) {
+		gulong umount_sig;
+		BraseroGioOperation *op;
+
+		op = g_new0 (BraseroGioOperation, 1);
+		op->cancel = cancel;
+
+		umount_sig = g_signal_connect_after (mount,
+						     "unmounted",
+						     G_CALLBACK (brasero_gio_operation_umounted_cb),
+						     op);
+
+		g_mount_unmount (mount,
+				 G_MOUNT_UNMOUNT_NONE,
+				 cancel,
+				 brasero_gio_operation_umount_finish,
+				 op);
+		result = brasero_gio_operation_wait_for_operation_end (op, error);
+		brasero_gio_operation_destroy (op);
+		g_signal_handler_disconnect (mount, umount_sig);
+	}
+	else {
+		g_mount_unmount (mount,
+				 G_MOUNT_UNMOUNT_NONE,
+				 cancel,
+				 NULL,					/* callback */
+				 NULL);
+		result = TRUE;
+	}
+	g_object_unref (mount);
+
+	BRASERO_MEDIA_LOG ("Unmount result = %d", result);
+	return result;
+}
+
+static void
+brasero_gio_operation_mount_finish (GObject *source,
+				    GAsyncResult *result,
+				    gpointer user_data)
+{
+	BraseroGioOperation *op = user_data;
+
+	op->result = g_volume_mount_finish (G_VOLUME (source),
+					    result,
+					    &op->error);
+
+	if (op->error) {
+		if (op->error->code == G_IO_ERROR_FAILED_HANDLED) {
+			/* means we shouldn't display any error message since 
+			 * that was already done */
+			g_error_free (op->error);
+			op->error = NULL;
+			op->result = TRUE;
+		}
+		else if (op->error->code == G_IO_ERROR_ALREADY_MOUNTED) {
+			g_error_free (op->error);
+			op->error = NULL;
+			op->result = TRUE;
+		}
+	}
+
+	brasero_gio_operation_end (op);
+}
+
+gboolean
+brasero_gio_operation_mount (GVolume *gvolume,
+			     GtkWindow *parent_window,
+			     GCancellable *cancel,
+			     gboolean wait,
+			     GError **error)
+{
+	GMount *mount;
+	gboolean result;
+	GMountOperation *operation = NULL;
+
+	BRASERO_MEDIA_LOG ("Mounting");
+
+	if (!gvolume) {
+		BRASERO_MEDIA_LOG ("No volume");
+		return FALSE;
+	}
+
+	if (!g_volume_can_mount (gvolume)) {
+		BRASERO_MEDIA_LOG ("Volume can't be mounted");
+		return FALSE;
+	}
+
+	mount = g_volume_get_mount (gvolume);
+	if (mount) {
+		BRASERO_MEDIA_LOG ("Existing mount");
+		g_object_unref (mount);
+		return TRUE;
+	}
+
+	if (parent_window && GTK_IS_WINDOW (parent_window))
+		operation = gtk_mount_operation_new (parent_window);
+
+	if (wait) {
+		BraseroGioOperation *op;
+
+		op = g_new0 (BraseroGioOperation, 1);
+		op->cancel = cancel;
+
+		g_volume_mount (gvolume,
+				G_MOUNT_MOUNT_NONE,
+				operation,				/* authentification */
+				cancel,
+				brasero_gio_operation_mount_finish,
+				op);
+		result = brasero_gio_operation_wait_for_operation_end (op, error);
+	}
+	else {
+		g_volume_mount (gvolume,
+				G_MOUNT_MOUNT_NONE,
+				operation,				/* authentification */
+				cancel,
+				NULL,
+				NULL);
+		result = TRUE;
+	}
+
+	if (operation)
+		g_object_unref (operation);
+
+	BRASERO_MEDIA_LOG ("Mount result = %d", result);
+
+	return result;
+}
+
+static void
+brasero_gio_operation_eject_finish (GObject *source,
+				    GAsyncResult *result,
+				    gpointer user_data)
+{
+	BraseroGioOperation *operation = user_data;
+
+	if (G_IS_DRIVE (source))
+		operation->result = g_drive_eject_finish (G_DRIVE (source),
+							  result,
+							  &operation->error);
+	else
+		operation->result = g_volume_eject_finish (G_VOLUME (source),
+							   result,
+							   &operation->error);
+
+	if (operation->error) {
+		if (operation->error->code == G_IO_ERROR_FAILED_HANDLED) {
+			/* means we shouldn't display any error message since 
+			 * that was already done */
+			g_error_free (operation->error);
+			operation->error = NULL;
+		}
+
+		brasero_gio_operation_end (operation);
+	}
+	else if (!operation->result)
+		brasero_gio_operation_end (operation);
+}
+
+static void
+brasero_gio_operation_removed_cb (GVolume *volume,
+				  gpointer callback_data)
+{
+	BraseroGioOperation *operation = callback_data;
+	brasero_gio_operation_end (operation);
+}
+
+gboolean
+brasero_gio_operation_eject_volume (GVolume *gvolume,
+				    GCancellable *cancel,
+				    gboolean wait,
+				    GError **error)
+{
+	gboolean result;
+
+	if (!g_volume_can_eject (gvolume))
+		return FALSE;
+
+	if (wait) {
+		gulong eject_sig;
+		BraseroGioOperation *op;
+
+		op = g_new0 (BraseroGioOperation, 1);
+		op->cancel = cancel;
+
+		eject_sig = g_signal_connect (gvolume,
+					      "removed",
+					      G_CALLBACK (brasero_gio_operation_removed_cb),
+					      op);
+
+		g_volume_eject (gvolume,
+				G_MOUNT_UNMOUNT_NONE,
+				cancel,
+				brasero_gio_operation_eject_finish,
+				op);
+
+		result = brasero_gio_operation_wait_for_operation_end (op, error);
+		g_signal_handler_disconnect (gvolume, eject_sig);
+
+		brasero_gio_operation_destroy (op);
+	}
+	else {
+		g_volume_eject (gvolume,
+				G_MOUNT_UNMOUNT_NONE,
+				cancel,
+				NULL,
+				NULL);
+		result = TRUE;
+	}
+
+	return result;
+}
+
+static void
+brasero_gio_operation_ejected_cb (GDrive *gdrive,
+				  gpointer callback_data)
+{
+	BraseroGioOperation *operation = callback_data;
+
+	if (!g_drive_has_media (gdrive))
+		brasero_gio_operation_end (operation);
+}
+
+static void
+brasero_gio_operation_disconnected_cb (GDrive *gdrive,
+				       gpointer callback_data)
+{
+	BraseroGioOperation *operation = callback_data;
+	brasero_gio_operation_end (operation);
+}
+
+gboolean
+brasero_gio_operation_eject_drive (GDrive *gdrive,
+				   GCancellable *cancel,
+				   gboolean wait,
+				   GError **error)
+{
+	gboolean result;
+
+	if (!gdrive) {
+		BRASERO_MEDIA_LOG ("No GDrive");
+		return FALSE;
+	}
+
+	if (!g_drive_can_eject (gdrive)) {
+		BRASERO_MEDIA_LOG ("GDrive can't eject");
+		return FALSE;
+	}
+
+	if (wait) {
+		gulong eject_sig;
+		gulong disconnect_sig;
+		BraseroGioOperation *op;
+
+		op = g_new0 (BraseroGioOperation, 1);
+		op->cancel = cancel;
+
+		eject_sig = g_signal_connect (gdrive,
+					      "changed",
+					      G_CALLBACK (brasero_gio_operation_ejected_cb),
+					      op);
+
+		disconnect_sig = g_signal_connect (gdrive,
+						   "disconnected",
+						   G_CALLBACK (brasero_gio_operation_disconnected_cb),
+						   op);
+
+		g_drive_eject (gdrive,
+			       G_MOUNT_UNMOUNT_NONE,
+			       cancel,
+			       brasero_gio_operation_eject_finish,
+			       op);
+
+		result = brasero_gio_operation_wait_for_operation_end (op, error);
+		brasero_gio_operation_destroy (op);
+		g_signal_handler_disconnect (gdrive, eject_sig);
+		g_signal_handler_disconnect (gdrive, disconnect_sig);
+	}
+	else {
+		g_drive_eject (gdrive,
+			       G_MOUNT_UNMOUNT_NONE,
+			       cancel,
+			       NULL,
+			       NULL);
+		result = TRUE;
+	}
+
+	return result;
+}

Added: trunk/libbrasero-media/brasero-gio-operation.h
==============================================================================
--- (empty file)
+++ trunk/libbrasero-media/brasero-gio-operation.h	Fri Jan 16 09:35:12 2009
@@ -0,0 +1,113 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Brasero
+ * Copyright (C) Rouquier Philippe 2009 <bonfire-app wanadoo fr>
+ * 
+ * Brasero is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Brasero is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _BRASERO_GIO_OPERATION_H_
+#define _BRASERO_GIO_OPERATION_H_
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+gboolean
+brasero_gio_operation_umount (GVolume *gvolume,
+			      GCancellable *cancel,
+			      gboolean wait,
+			      GError **error);
+
+gboolean
+brasero_gio_operation_mount (GVolume *gvolume,
+			     GtkWindow *parent_window,
+			     GCancellable *cancel,
+			     gboolean wait,
+			     GError **error);
+
+gboolean
+brasero_gio_operation_eject_volume (GVolume *gvolume,
+				    GCancellable *cancel,
+				    gboolean wait,
+				    GError **error);
+
+gboolean
+brasero_gio_operation_eject_drive (GDrive *gdrive,
+				   GCancellable *cancel,
+				   gboolean wait,
+				   GError **error);
+
+G_END_DECLS
+
+#endif /* _BRASERO_GIO_OPERATION_H_ */
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Brasero
+ * Copyright (C) Rouquier Philippe 2009 <bonfire-app wanadoo fr>
+ * 
+ * Brasero is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Brasero is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _BRASERO_GIO_OPERATION_H_
+#define _BRASERO_GIO_OPERATION_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_GIO_OPERATION             (brasero_gio_operation_get_type ())
+#define BRASERO_GIO_OPERATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_GIO_OPERATION, BraseroGioOperation))
+#define BRASERO_GIO_OPERATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_GIO_OPERATION, BraseroGioOperationClass))
+#define BRASERO_IS_GIO_OPERATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_GIO_OPERATION))
+#define BRASERO_IS_GIO_OPERATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_GIO_OPERATION))
+#define BRASERO_GIO_OPERATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_GIO_OPERATION, BraseroGioOperationClass))
+
+typedef struct _BraseroGioOperationClass BraseroGioOperationClass;
+typedef struct _BraseroGioOperation BraseroGioOperation;
+
+struct _BraseroGioOperationClass
+{
+	GObjectClass parent_class;
+};
+
+struct _BraseroGioOperation
+{
+	GObject parent_instance;
+};
+
+GType brasero_gio_operation_get_type (void) G_GNUC_CONST;
+
+BraseroGioOperation *
+brasero_gio_operation_new (void);
+
+void
+brasero_gio_operation_cancel (BraseroGioOperation *operation);
+
+G_END_DECLS
+
+#endif /* _BRASERO_GIO_OPERATION_H_ */

Modified: trunk/libbrasero-media/brasero-volume.c
==============================================================================
--- trunk/libbrasero-media/brasero-volume.c	(original)
+++ trunk/libbrasero-media/brasero-volume.c	Fri Jan 16 09:35:12 2009
@@ -1,871 +1,364 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * brasero
- * Copyright (C) Philippe Rouquier 2005-2008 <bonfire-app wanadoo fr>
- *
- * Brasero is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * Brasero is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <string.h>
-
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-
-#include <gio/gio.h>
-
-#include "brasero-media-private.h"
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2005-2008 <bonfire-app wanadoo fr>
+ *
+ * Brasero is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * Brasero is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#include <gio/gio.h>
+
+#include "brasero-media-private.h"
 #include "brasero-volume.h"
-
-typedef struct _BraseroVolumePrivate BraseroVolumePrivate;
-struct _BraseroVolumePrivate
-{
-	GCancellable *cancel;
-
-	guint timeout_id;
-	GMainLoop *loop;
-	gboolean result;
-	GError *error;
-};
-
-#define BRASERO_VOLUME_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_VOLUME, BraseroVolumePrivate))
-
-G_DEFINE_TYPE (BraseroVolume, brasero_volume, BRASERO_TYPE_MEDIUM);
-
-static GVolume *
-brasero_volume_get_gvolume (BraseroVolume *self)
-{
-	const gchar *volume_path = NULL;
-	BraseroVolumePrivate *priv;
-	GVolumeMonitor *monitor;
-	GVolume *volume = NULL;
-	BraseroDrive *drive;
-	GList *volumes;
-	GList *iter;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-
-#if defined(HAVE_STRUCT_USCSI_CMD)
-	volume_path = brasero_drive_get_block_device (drive);
-#else
-	volume_path = brasero_drive_get_device (drive);
-#endif
-
-	/* NOTE: medium-monitor already holds a reference for GVolumeMonitor */
-	monitor = g_volume_monitor_get ();
-	volumes = g_volume_monitor_get_volumes (monitor);
-	g_object_unref (monitor);
-
-	for (iter = volumes; iter; iter = iter->next) {
-		gchar *device_path;
-		GVolume *tmp;
-
-		tmp = iter->data;
-		device_path = g_volume_get_identifier (tmp, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-		if (!device_path)
-			continue;
-
-		BRASERO_MEDIA_LOG ("Found volume %s", device_path);
-		if (!strcmp (device_path, volume_path)) {
-			volume = tmp;
-			g_free (device_path);
-			g_object_ref (volume);
-			break;
-		}
-
-		g_free (device_path);
-	}
-	g_list_foreach (volumes, (GFunc) g_object_unref, NULL);
-	g_list_free (volumes);
-
-	if (!volume)
-		BRASERO_MEDIA_LOG ("No volume found for medium");
-
-	return volume;
-}
-
-gboolean
-brasero_volume_is_mounted (BraseroVolume *self)
-{
-	GList *iter;
-	GList *mounts;
-	gboolean result;
-	BraseroDrive *drive;
-	GVolumeMonitor *monitor;
-	const gchar *volume_path;
-	BraseroVolumePrivate *priv;
-
-	if (!self)
-		return FALSE;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-
-#if defined(HAVE_STRUCT_USCSI_CMD)
-	volume_path = brasero_drive_get_block_device (drive);
-#else
-	volume_path = brasero_drive_get_device (drive);
-#endif
-
-	if (!volume_path)
-		return FALSE;
-
-	monitor = g_volume_monitor_get ();
-	mounts = g_volume_monitor_get_mounts (monitor);
-	g_object_unref (monitor);
-
-	result = FALSE;
-	for (iter = mounts; iter; iter = iter->next) {
-		GMount *mount;
-		GVolume *volume;
-		gchar *device_path;
-
-		mount = iter->data;
-		volume = g_mount_get_volume (mount);
-		if (!volume)
-			continue;
-
-		device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-		if (!device_path)
-			continue;		
-
-		if (!strcmp (device_path, volume_path)) {
-			result = TRUE;
-			break;
-		}
-	}
-	g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
-	g_list_free (mounts);
-
-	return result;
-}
-
-gchar *
-brasero_volume_get_mount_point (BraseroVolume *self,
-				GError **error)
-{
-	BraseroVolumePrivate *priv;
-	gchar *local_path = NULL;
-	GVolume *volume;
-	GMount *mount;
-	GFile *root;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		return NULL;
-
-	/* get the uri for the mount point */
-	mount = g_volume_get_mount (volume);
-	g_object_unref (volume);
-	if (!mount)
-		return NULL;
-
-	root = g_mount_get_root (mount);
-	g_object_unref (mount);
-
-	if (!root) {
-		g_set_error (error,
-			     BRASERO_MEDIA_ERROR,
-			     BRASERO_MEDIA_ERROR_GENERAL,
-			     _("The disc mount point could not be retrieved"));
-	}
-	else {
-		local_path = g_file_get_path (root);
-		g_object_unref (root);
-	}
-
-	return local_path;
-}
-
-static void
-brasero_volume_operation_end (BraseroVolume *self)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-	if (!priv->loop)
-		return;
-
-	if (!g_main_loop_is_running (priv->loop))
-		return;
-
-	g_main_loop_quit (priv->loop);	
-}
-
-static gboolean
-brasero_volume_operation_timeout (gpointer data)
-{
-	BraseroVolume *self = BRASERO_VOLUME (data);
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-	brasero_volume_operation_end (self);
-
-	BRASERO_MEDIA_LOG ("Volume/Disc operation timed out");
-	priv->timeout_id = 0;
-	priv->result = FALSE;
-	return FALSE;
-}
-
-static gboolean
-brasero_volume_wait_for_operation_end (BraseroVolume *self,
-				       GError **error)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	/* put a timeout (30 sec) */
-	priv->timeout_id = g_timeout_add_seconds (20,
-						  brasero_volume_operation_timeout,
-						  self);
-
-	priv->loop = g_main_loop_new (NULL, FALSE);
-	g_main_loop_run (priv->loop);
-
-	g_main_loop_unref (priv->loop);
-	priv->loop = NULL;
-
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
-
-	if (priv->error) {
-		if (error)
-			g_propagate_error (error, priv->error);
-		else
-			g_error_free (priv->error);
-
-		priv->error = NULL;
-	}
-	g_cancellable_reset (priv->cancel);
-
-	return priv->result;
-}
-
-static void
-brasero_volume_umounted_cb (GVolumeMonitor *monitor,
-			    GMount *mount,
-			    BraseroVolume *self)
-{
-	BraseroVolumePrivate *priv;
-	GMount *vol_mount;
-	GVolume *volume;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	volume = brasero_volume_get_gvolume (self);
-	vol_mount = g_volume_get_mount (volume);
-	g_object_unref (volume);
-
-	/* If it's NULL then that means it was unmounted */
-	if (!vol_mount) {
-		brasero_volume_operation_end (self);
-		return;
-	}
-
-	g_object_unref (vol_mount);
-
-	/* Check it's the one we were looking for */
-	if (vol_mount != mount)
-		return;
-
-	brasero_volume_operation_end (self);
-}
-
-static void
-brasero_volume_umount_finish (GObject *source,
-			      GAsyncResult *result,
-			      gpointer user_data)
-{
-	BraseroVolume *self = BRASERO_VOLUME (user_data);
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	if (!priv->loop)
-		return;
-
-	priv->result = g_mount_unmount_finish (G_MOUNT (source),
-					       result,
-					       &priv->error);
-
-	BRASERO_MEDIA_LOG ("Umount operation completed (result = %d)", priv->result);
-
-	if (priv->error) {
-		if (priv->error->code == G_IO_ERROR_FAILED_HANDLED) {
-			/* means we shouldn't display any error message since 
-			 * that was already done */
-			g_error_free (priv->error);
-			priv->error = NULL;
-		}
-		else if (priv->error->code == G_IO_ERROR_NOT_MOUNTED) {
-			/* That can happen sometimes */
-			g_error_free (priv->error);
-			priv->error = NULL;
-			priv->result = TRUE;
-		}
-
-		/* Since there was an error. The "unmounted" signal won't be 
-		 * emitted by GVolumeMonitor and therefore we'd get stuck if
-		 * we didn't get out of the loop. */
-		brasero_volume_operation_end (self);
-	}
-	else if (!priv->result)
-		brasero_volume_operation_end (self);
-}
-
-gboolean
-brasero_volume_umount (BraseroVolume *self,
-		       gboolean wait,
-		       GError **error)
-{
-	GMount *mount;
-	gboolean result;
-	GVolume *volume;
-	BraseroVolumePrivate *priv;
-
-	if (!self)
+#include "brasero-gio-operation.h"
+
+typedef struct _BraseroVolumePrivate BraseroVolumePrivate;
+struct _BraseroVolumePrivate
+{
+	GCancellable *cancel;
+};
+
+#define BRASERO_VOLUME_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_VOLUME, BraseroVolumePrivate))
+
+G_DEFINE_TYPE (BraseroVolume, brasero_volume, BRASERO_TYPE_MEDIUM);
+
+GVolume *
+brasero_volume_get_gvolume (BraseroVolume *self)
+{
+	const gchar *volume_path = NULL;
+	BraseroVolumePrivate *priv;
+	GVolumeMonitor *monitor;
+	GVolume *volume = NULL;
+	BraseroDrive *drive;
+	GList *volumes;
+	GList *iter;
+
+	priv = BRASERO_VOLUME_PRIVATE (self);
+
+	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
+
+#if defined(HAVE_STRUCT_USCSI_CMD)
+	volume_path = brasero_drive_get_block_device (drive);
+#else
+	volume_path = brasero_drive_get_device (drive);
+#endif
+
+	/* NOTE: medium-monitor already holds a reference for GVolumeMonitor */
+	monitor = g_volume_monitor_get ();
+	volumes = g_volume_monitor_get_volumes (monitor);
+	g_object_unref (monitor);
+
+	for (iter = volumes; iter; iter = iter->next) {
+		gchar *device_path;
+		GVolume *tmp;
+
+		tmp = iter->data;
+		device_path = g_volume_get_identifier (tmp, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+		if (!device_path)
+			continue;
+
+		BRASERO_MEDIA_LOG ("Found volume %s", device_path);
+		if (!strcmp (device_path, volume_path)) {
+			volume = tmp;
+			g_free (device_path);
+			g_object_ref (volume);
+			break;
+		}
+
+		g_free (device_path);
+	}
+	g_list_foreach (volumes, (GFunc) g_object_unref, NULL);
+	g_list_free (volumes);
+
+	if (!volume)
+		BRASERO_MEDIA_LOG ("No volume found for medium");
+
+	return volume;
+}
+
+gboolean
+brasero_volume_is_mounted (BraseroVolume *volume)
+{
+	gchar *path;
+
+	/* NOTE: that's the surest way to know if a drive is really mounted. For
+	 * GIO a blank medium can be mounted to burn:/// which is not really 
+	 * what we're interested in. So the mount path must be also local. */
+	path = brasero_volume_get_mount_point (volume, NULL);
+	if (path) {
+		g_free (path);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+gchar *
+brasero_volume_get_mount_point (BraseroVolume *volume,
+				GError **error)
+{
+	BraseroVolumePrivate *priv;
+	gchar *local_path = NULL;
+	GVolume *gvolume;
+	GMount *mount;
+	GFile *root;
+
+	priv = BRASERO_VOLUME_PRIVATE (volume);
+
+	gvolume = brasero_volume_get_gvolume (volume);
+	if (!gvolume)
+		return NULL;
+
+	/* get the uri for the mount point */
+	mount = g_volume_get_mount (gvolume);
+	g_object_unref (gvolume);
+	if (!mount)
+		return NULL;
+
+	root = g_mount_get_root (mount);
+	g_object_unref (mount);
+
+	if (!root) {
+		g_set_error (error,
+			     BRASERO_MEDIA_ERROR,
+			     BRASERO_MEDIA_ERROR_GENERAL,
+			     _("The disc mount point could not be retrieved"));
+	}
+	else {
+		local_path = g_file_get_path (root);
+		g_object_unref (root);
+	}
+
+	return local_path;
+}
+
+gboolean
+brasero_volume_umount (BraseroVolume *volume,
+		       gboolean wait,
+		       GError **error)
+{
+	gboolean result;
+	GVolume *gvolume;
+	BraseroVolumePrivate *priv;
+
+	if (!volume)
+		return TRUE;
+
+	priv = BRASERO_VOLUME_PRIVATE (volume);
+
+	gvolume = brasero_volume_get_gvolume (volume);
+	if (!gvolume)
 		return TRUE;
 
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
+	result = brasero_gio_operation_umount (gvolume,
+					       priv->cancel,
+					       wait,
+					       error);
+	g_object_unref (gvolume);
+
+	return result;
+}
+
+gboolean
+brasero_volume_mount (BraseroVolume *volume,
+		      GtkWindow *parent_window,
+		      gboolean wait,
+		      GError **error)
+{
+	gboolean result;
+	GVolume *gvolume;
+	BraseroVolumePrivate *priv;
+
+	if (!volume)
+		return TRUE;
+
+	priv = BRASERO_VOLUME_PRIVATE (volume);
+
+	gvolume = brasero_volume_get_gvolume (volume);
+	if (!gvolume)
 		return TRUE;
 
-	if (!g_volume_can_mount (volume)) {
-		/* if it can't be mounted then it's unmounted ... */
-		g_object_unref (volume);
-		return TRUE;
-	}
-
-	mount = g_volume_get_mount (volume);
-	g_object_unref (volume);
-
-	if (!mount)
-		return TRUE;
-
-	if (!g_mount_can_unmount (mount))
-		return FALSE;
-
-	if (wait) {
-		gulong umount_sig;
-		GVolumeMonitor *monitor;
-
-		monitor = g_volume_monitor_get ();
-		umount_sig = g_signal_connect_after (monitor,
-						     "mount-removed",
-						     G_CALLBACK (brasero_volume_umounted_cb),
-						     self);
-
-		g_mount_unmount (mount,
-				 G_MOUNT_UNMOUNT_NONE,
-				 priv->cancel,
-				 brasero_volume_umount_finish,
-				 self);
-		result = brasero_volume_wait_for_operation_end (self, error);
-
-		g_signal_handler_disconnect (monitor, umount_sig);
-	}
-	else {
-		g_mount_unmount (mount,
-				 G_MOUNT_UNMOUNT_NONE,
-				 priv->cancel,
-				 NULL,					/* callback */
-				 self);
-		result = TRUE;
-	}
-	g_object_unref (mount);
-
-	return result;
-}
-
-static void
-brasero_volume_mount_finish (GObject *source,
-			     GAsyncResult *result,
-			     gpointer user_data)
-{
-	BraseroVolume *self = BRASERO_VOLUME (user_data);
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-	priv->result = g_volume_mount_finish (G_VOLUME (source),
-					      result,
-					      &priv->error);
-
-	if (priv->error) {
-		if (priv->error->code == G_IO_ERROR_FAILED_HANDLED) {
-			/* means we shouldn't display any error message since 
-			 * that was already done */
-			g_error_free (priv->error);
-			priv->error = NULL;
-			priv->result = TRUE;
-		}
-		else if (priv->error->code == G_IO_ERROR_ALREADY_MOUNTED) {
-			g_error_free (priv->error);
-			priv->error = NULL;
-			priv->result = TRUE;
-		}
-	}
-
-	brasero_volume_operation_end (self);
-}
-
-gboolean
-brasero_volume_mount (BraseroVolume *self,
-		      gboolean wait,
-		      GError **error)
-{
-	GMount *mount;
-	gboolean result;
-	GVolume *volume;
-	BraseroVolumePrivate *priv;
-
-	if (!self)
-		return FALSE;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		return FALSE;
-
-	if (!g_volume_can_mount (volume)) {
-		g_object_unref (volume);
-		return FALSE;
-	}
-
-	mount = g_volume_get_mount (volume);
-	if (mount) {
-		g_object_unref (volume);
-		g_object_unref (mount);
-		return TRUE;
-	}
-
-	if (wait) {
-		g_volume_mount (volume,
-				G_MOUNT_MOUNT_NONE,
-				NULL,					/* authentification */
-				priv->cancel,
-				brasero_volume_mount_finish,
-				self);
-		result = brasero_volume_wait_for_operation_end (self, error);
-	}
-	else {
-		g_volume_mount (volume,
-				G_MOUNT_MOUNT_NONE,
-				NULL,					/* authentification */
-				priv->cancel,
-				NULL,
-				self);
-		result = TRUE;
-	}
-	g_object_unref (volume);
-
-	return result;
-}
-
-static void
-brasero_volume_ejected_cb (BraseroDrive *drive,
-			   gpointer callback_data)
-{
-	BraseroVolume *self = BRASERO_VOLUME (callback_data);
-	brasero_volume_operation_end (self);
-}
-
-static void
-brasero_volume_eject_finish (GObject *source,
-			     GAsyncResult *result,
-			     gpointer user_data)
-{
-	BraseroVolume *self = BRASERO_VOLUME (user_data);
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-	if (G_IS_DRIVE (source))
-		priv->result = g_drive_eject_finish (G_DRIVE (source),
-						     result,
-						     &priv->error);
-	else
-		priv->result = g_volume_eject_finish (G_VOLUME (source),
-						      result,
-						      &priv->error);
-
-	if (priv->error) {
-		if (priv->error->code == G_IO_ERROR_FAILED_HANDLED) {
-			/* means we shouldn't display any error message since 
-			 * that was already done */
-			g_error_free (priv->error);
-			priv->error = NULL;
-		}
-
-		brasero_volume_operation_end (self);
-	}
-	else if (!priv->result)
-		brasero_volume_operation_end (self);
-}
-
-static gboolean
-brasero_volume_eject_gvolume (BraseroVolume *self,
-			      gboolean wait,
-			      GVolume *volume,
-			      GError **error)
-{
-	BraseroVolumePrivate *priv;
-	gboolean result;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	if (!g_volume_can_eject (volume))
-		return FALSE;
-
-	if (wait) {
-		gulong eject_sig;
-		BraseroDrive *drive;
-
-		drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-		eject_sig = g_signal_connect (drive,
-					      "medium-removed",
-					      G_CALLBACK (brasero_volume_ejected_cb),
-					      self);
-
-		g_volume_eject (volume,
-				G_MOUNT_UNMOUNT_NONE,
-				priv->cancel,
-				brasero_volume_eject_finish,
-				self);
-
-		g_object_ref (self);
-		result = brasero_volume_wait_for_operation_end (self, error);
-		g_object_unref (self);
-
-		/* NOTE: from this point on self is no longer valid */
-
-		g_signal_handler_disconnect (drive, eject_sig);
-	}
-	else {
-		g_volume_eject (volume,
-				G_MOUNT_UNMOUNT_NONE,
-				priv->cancel,
-				NULL,
-				self);
-		result = TRUE;
-	}
-
-	return result;
-}
-
-gboolean
-brasero_volume_eject (BraseroVolume *self,
-		      gboolean wait,
-		      GError **error)
-{
-	GDrive *gdrive;
-	GVolume *volume;
-	gboolean result;
-	BraseroDrive *drive;
-	BraseroVolumePrivate *priv;
-
-	BRASERO_MEDIA_LOG ("Ejecting");
-
-	if (!self)
-		return TRUE;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-	gdrive = brasero_drive_get_gdrive (drive);
-	if (!gdrive) {
-		BRASERO_MEDIA_LOG ("No GDrive");
-		goto last_resort;
-	}
-
-	if (!g_drive_can_eject (gdrive)) {
-		BRASERO_MEDIA_LOG ("GDrive can't eject");
-		goto last_resort;
-	}
-
-	if (wait) {
-		gulong eject_sig;
-		BraseroDrive *drive;
-
-		drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-		eject_sig = g_signal_connect (drive,
-					      "medium-removed",
-					      G_CALLBACK (brasero_volume_ejected_cb),
-					      self);
-
-		g_drive_eject (gdrive,
-			       G_MOUNT_UNMOUNT_NONE,
-			       priv->cancel,
-			       brasero_volume_eject_finish,
-			       self);
-
-		g_object_ref (self);
-		result = brasero_volume_wait_for_operation_end (self, error);
-		g_object_unref (self);
-
-		/* NOTE: from this point on self is no longer valid */
-
-		g_signal_handler_disconnect (drive, eject_sig);
-	}
-	else {
-		g_drive_eject (gdrive,
-			       G_MOUNT_UNMOUNT_NONE,
-			       priv->cancel,
-			       NULL,
-			       self);
-		result = TRUE;
-	}
-
-	g_object_unref (gdrive);
-	return result;
-
-last_resort:
-
-	/* last resort */
-	volume = brasero_volume_get_gvolume (self);
-	result = brasero_volume_eject_gvolume (self, wait, volume, error);
-	g_object_unref (volume);
-
-	if (gdrive)
-		g_object_unref (gdrive);
-
-	return result;
-}
-
-gboolean
-brasero_volume_can_eject (BraseroVolume *self)
-{
-	GDrive *gdrive;
-	GVolume *volume;
-	gboolean result;
-	BraseroDrive *drive;
-	BraseroVolumePrivate *priv;
-
-	BRASERO_MEDIA_LOG ("Ejecting");
-
-	if (!self)
-		return TRUE;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	drive = brasero_medium_get_drive (BRASERO_MEDIUM (self));
-	gdrive = brasero_drive_get_gdrive (drive);
-	if (!gdrive) {
-		BRASERO_MEDIA_LOG ("No GDrive");
-		goto last_resort;
-	}
-
-	if (!g_drive_can_eject (gdrive)) {
-		BRASERO_MEDIA_LOG ("GDrive can't eject");
-		goto last_resort;
-	}
-
-	g_object_unref (gdrive);
-	return TRUE;
-
-last_resort:
-
-	if (gdrive)
-		g_object_unref (gdrive);
-
-	/* last resort */
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		return FALSE;
-
-	result = g_volume_can_eject (volume);
-	g_object_unref (volume);
-
-	return result;
-}
-
-void
-brasero_volume_cancel_current_operation (BraseroVolume *self)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);	
-
-	priv->result = FALSE;
-
-	g_cancellable_cancel (priv->cancel);
-	if (priv->loop && g_main_loop_is_running (priv->loop))
-		g_main_loop_quit (priv->loop);
-}
-
-GIcon *
-brasero_volume_get_icon (BraseroVolume *self)
-{
-	GVolume *volume;
-	GMount *mount;
-	GIcon *icon;
-
-	if (!self)
-		return g_themed_icon_new_with_default_fallbacks ("drive-optical");
-
-	if (brasero_medium_get_status (BRASERO_MEDIUM (self)) == BRASERO_MEDIUM_FILE)
-		return g_themed_icon_new_with_default_fallbacks ("iso-image-new");
-
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		return g_themed_icon_new_with_default_fallbacks ("drive-optical");
-
-	mount = g_volume_get_mount (volume);
-	if (mount) {
-		icon = g_mount_get_icon (mount);
-		g_object_unref (mount);
-	}
-	else
-		icon = g_volume_get_icon (volume);
-
-	g_object_unref (volume);
-
-	return icon;
-}
-
-gchar *
-brasero_volume_get_name (BraseroVolume *self)
-{
-	BraseroVolumePrivate *priv;
-	BraseroMedia media;
-	const gchar *type;
-	GVolume *volume;
-	gchar *name;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-
-	media = brasero_medium_get_status (BRASERO_MEDIUM (self));
-	if (media & BRASERO_MEDIUM_FILE) {
-		/* Translators: This is a fake drive, a file, and means that
-		 * when we're writing, we're writing to a file and create an
-		 * image on the hard drive. */
-		return g_strdup (_("Image File"));
-	}
-
-	if (media & BRASERO_MEDIUM_HAS_AUDIO) {
-		const gchar *audio_name;
-
-		audio_name = brasero_medium_get_CD_TEXT_title (BRASERO_MEDIUM (self));
-		if (audio_name)
-			return g_strdup (audio_name);
-	}
-
-	volume = brasero_volume_get_gvolume (self);
-	if (!volume)
-		goto last_chance;
-
-	name = g_volume_get_name (volume);
-	g_object_unref (volume);
-
-	if (name)
-		return name;
-
-last_chance:
-
-	type = brasero_medium_get_type_string (BRASERO_MEDIUM (self));
-	name = NULL;
-	if (media & BRASERO_MEDIUM_BLANK) {
-		/* NOTE for translators: the first %s is the disc type. */
-		name = g_strdup_printf (_("Blank %s"), type);
-	}
-	else if (BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA)) {
-		/* NOTE for translators: the first %s is the disc type. */
-		name = g_strdup_printf (_("Audio and data %s"), type);
-	}
-	else if (media & BRASERO_MEDIUM_HAS_AUDIO) {
-		/* NOTE for translators: the first %s is the disc type. */
-		name = g_strdup_printf (_("Audio %s"), type);
-	}
-	else if (media & BRASERO_MEDIUM_HAS_DATA) {
-		/* NOTE for translators: the first %s is the disc type. */
-		name = g_strdup_printf (_("Data %s"), type);
-	}
-	else {
-		/* NOTE for translators: the first %s is the disc type. */
-		name = g_strdup (type);
-	}
-
-	return name;
-}
-
-static void
-brasero_volume_init (BraseroVolume *object)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (object);
-	priv->cancel = g_cancellable_new ();
-}
-
-static void
-brasero_volume_finalize (GObject *object)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (object);
-
-	if (priv->cancel) {
-		g_cancellable_cancel (priv->cancel);
-		g_object_unref (priv->cancel);
-		priv->cancel = NULL;
-	}
-
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
-
-	if (priv->loop && g_main_loop_is_running (priv->loop))
-		g_main_loop_quit (priv->loop);
-
-	G_OBJECT_CLASS (brasero_volume_parent_class)->finalize (object);
-}
-
-static void
-brasero_volume_class_init (BraseroVolumeClass *klass)
-{
-	GObjectClass* object_class = G_OBJECT_CLASS (klass);
-
-	g_type_class_add_private (klass, sizeof (BraseroVolumePrivate));
-
-	object_class->finalize = brasero_volume_finalize;
-}
-
-BraseroVolume *
-brasero_volume_new (BraseroDrive *drive,
-		    const gchar *udi)
-{
-	BraseroVolume *volume;
-
-	g_return_val_if_fail (drive != NULL, NULL);
-	volume = g_object_new (BRASERO_TYPE_VOLUME,
-			       "drive", drive,
-			       "udi", udi,
-			       NULL);
-
-	return volume;
-}
+	result = brasero_gio_operation_mount (gvolume,
+					      parent_window,
+					      priv->cancel,
+					      wait,
+					      error);
+	g_object_unref (gvolume);
+
+	return result;
+}
+
+void
+brasero_volume_cancel_current_operation (BraseroVolume *self)
+{
+	BraseroVolumePrivate *priv;
+
+	priv = BRASERO_VOLUME_PRIVATE (self);	
+	g_cancellable_cancel (priv->cancel);
+}
+
+GIcon *
+brasero_volume_get_icon (BraseroVolume *self)
+{
+	GVolume *volume;
+	GMount *mount;
+	GIcon *icon;
+
+	if (!self)
+		return g_themed_icon_new_with_default_fallbacks ("drive-optical");
+
+	if (brasero_medium_get_status (BRASERO_MEDIUM (self)) == BRASERO_MEDIUM_FILE)
+		return g_themed_icon_new_with_default_fallbacks ("iso-image-new");
+
+	volume = brasero_volume_get_gvolume (self);
+	if (!volume)
+		return g_themed_icon_new_with_default_fallbacks ("drive-optical");
+
+	mount = g_volume_get_mount (volume);
+	if (mount) {
+		icon = g_mount_get_icon (mount);
+		g_object_unref (mount);
+	}
+	else
+		icon = g_volume_get_icon (volume);
+
+	g_object_unref (volume);
+
+	return icon;
+}
+
+gchar *
+brasero_volume_get_name (BraseroVolume *self)
+{
+	BraseroVolumePrivate *priv;
+	BraseroMedia media;
+	const gchar *type;
+	GVolume *volume;
+	gchar *name;
+
+	priv = BRASERO_VOLUME_PRIVATE (self);
+
+	media = brasero_medium_get_status (BRASERO_MEDIUM (self));
+	if (media & BRASERO_MEDIUM_FILE) {
+		/* Translators: This is a fake drive, a file, and means that
+		 * when we're writing, we're writing to a file and create an
+		 * image on the hard drive. */
+		return g_strdup (_("Image File"));
+	}
+
+	if (media & BRASERO_MEDIUM_HAS_AUDIO) {
+		const gchar *audio_name;
+
+		audio_name = brasero_medium_get_CD_TEXT_title (BRASERO_MEDIUM (self));
+		if (audio_name)
+			return g_strdup (audio_name);
+	}
+
+	volume = brasero_volume_get_gvolume (self);
+	if (!volume)
+		goto last_chance;
+
+	name = g_volume_get_name (volume);
+	g_object_unref (volume);
+
+	if (name)
+		return name;
+
+last_chance:
+
+	type = brasero_medium_get_type_string (BRASERO_MEDIUM (self));
+	name = NULL;
+	if (media & BRASERO_MEDIUM_BLANK) {
+		/* NOTE for translators: the first %s is the disc type. */
+		name = g_strdup_printf (_("Blank %s"), type);
+	}
+	else if (BRASERO_MEDIUM_IS (media, BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA)) {
+		/* NOTE for translators: the first %s is the disc type. */
+		name = g_strdup_printf (_("Audio and data %s"), type);
+	}
+	else if (media & BRASERO_MEDIUM_HAS_AUDIO) {
+		/* NOTE for translators: the first %s is the disc type. */
+		name = g_strdup_printf (_("Audio %s"), type);
+	}
+	else if (media & BRASERO_MEDIUM_HAS_DATA) {
+		/* NOTE for translators: the first %s is the disc type. */
+		name = g_strdup_printf (_("Data %s"), type);
+	}
+	else {
+		/* NOTE for translators: the first %s is the disc type. */
+		name = g_strdup (type);
+	}
+
+	return name;
+}
+
+static void
+brasero_volume_init (BraseroVolume *object)
+{
+	BraseroVolumePrivate *priv;
+
+	priv = BRASERO_VOLUME_PRIVATE (object);
+	priv->cancel = g_cancellable_new ();
+}
+
+static void
+brasero_volume_finalize (GObject *object)
+{
+	BraseroVolumePrivate *priv;
+
+	priv = BRASERO_VOLUME_PRIVATE (object);
+
+	if (priv->cancel) {
+		g_cancellable_cancel (priv->cancel);
+		g_object_unref (priv->cancel);
+		priv->cancel = NULL;
+	}
+
+	G_OBJECT_CLASS (brasero_volume_parent_class)->finalize (object);
+}
+
+static void
+brasero_volume_class_init (BraseroVolumeClass *klass)
+{
+	GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (klass, sizeof (BraseroVolumePrivate));
+
+	object_class->finalize = brasero_volume_finalize;
+}
+
+BraseroVolume *
+brasero_volume_new (BraseroDrive *drive,
+		    const gchar *udi)
+{
+	BraseroVolume *volume;
+
+	g_return_val_if_fail (drive != NULL, NULL);
+	volume = g_object_new (BRASERO_TYPE_VOLUME,
+			       "drive", drive,
+			       "udi", udi,
+			       NULL);
+
+	return volume;
+}

Modified: trunk/libbrasero-media/brasero-volume.h
==============================================================================
--- trunk/libbrasero-media/brasero-volume.h	(original)
+++ trunk/libbrasero-media/brasero-volume.h	Fri Jan 16 09:35:12 2009
@@ -1,91 +1,87 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * brasero
- * Copyright (C) Philippe Rouquier 2005-2008 <bonfire-app wanadoo fr>
- * 
- *  Brasero is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- * 
- * brasero is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with brasero.  If not, write to:
- * 	The Free Software Foundation, Inc.,
- * 	51 Franklin Street, Fifth Floor
- * 	Boston, MA  02110-1301, USA.
- */
-
-#ifndef _BRASERO_VOLUME_H_
-#define _BRASERO_VOLUME_H_
-
-#include <glib-object.h>
-#include <gio/gio.h>
-
-#include <brasero-drive.h>
-
-G_BEGIN_DECLS
-
-#define BRASERO_TYPE_VOLUME             (brasero_volume_get_type ())
-#define BRASERO_VOLUME(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_VOLUME, BraseroVolume))
-#define BRASERO_VOLUME_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_VOLUME, BraseroVolumeClass))
-#define BRASERO_IS_VOLUME(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_VOLUME))
-#define BRASERO_IS_VOLUME_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_VOLUME))
-#define BRASERO_VOLUME_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_VOLUME, BraseroVolumeClass))
-
-typedef struct _BraseroVolumeClass BraseroVolumeClass;
-typedef struct _BraseroVolume BraseroVolume;
-
-struct _BraseroVolumeClass
-{
-	BraseroMediumClass parent_class;
-};
-
-struct _BraseroVolume
-{
-	BraseroMedium parent_instance;
-};
-
-GType brasero_volume_get_type (void) G_GNUC_CONST;
-
-gchar *
-brasero_volume_get_name (BraseroVolume *volume);
-
-GIcon *
-brasero_volume_get_icon (BraseroVolume *volume);
-
-gboolean
-brasero_volume_is_mounted (BraseroVolume *volume);
-
-gchar *
-brasero_volume_get_mount_point (BraseroVolume *volume,
-				GError **error);
-
-gboolean
-brasero_volume_umount (BraseroVolume *volume,
-		       gboolean wait,
-		       GError **error);
-
-gboolean
-brasero_volume_mount (BraseroVolume *volume,
-		      gboolean wait,
-		      GError **error);
-
-gboolean
-brasero_volume_can_eject (BraseroVolume *volume);
-
-gboolean
-brasero_volume_eject (BraseroVolume *volume,
-		      gboolean wait,
-		      GError **error);
-
-void
-brasero_volume_cancel_current_operation (BraseroVolume *volume);
-
-G_END_DECLS
-
-#endif /* _BRASERO_VOLUME_H_ */
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2005-2008 <bonfire-app wanadoo fr>
+ * 
+ *  Brasero is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ * 
+ * brasero is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with brasero.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _BRASERO_VOLUME_H_
+#define _BRASERO_VOLUME_H_
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+#include <brasero-drive.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_VOLUME             (brasero_volume_get_type ())
+#define BRASERO_VOLUME(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_VOLUME, BraseroVolume))
+#define BRASERO_VOLUME_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_VOLUME, BraseroVolumeClass))
+#define BRASERO_IS_VOLUME(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_VOLUME))
+#define BRASERO_IS_VOLUME_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_VOLUME))
+#define BRASERO_VOLUME_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_VOLUME, BraseroVolumeClass))
+
+typedef struct _BraseroVolumeClass BraseroVolumeClass;
+typedef struct _BraseroVolume BraseroVolume;
+
+struct _BraseroVolumeClass
+{
+	BraseroMediumClass parent_class;
+};
+
+struct _BraseroVolume
+{
+	BraseroMedium parent_instance;
+};
+
+GType brasero_volume_get_type (void) G_GNUC_CONST;
+
+gchar *
+brasero_volume_get_name (BraseroVolume *volume);
+
+GIcon *
+brasero_volume_get_icon (BraseroVolume *volume);
+
+GVolume *
+brasero_volume_get_gvolume (BraseroVolume *self);
+
+gboolean
+brasero_volume_is_mounted (BraseroVolume *volume);
+
+gchar *
+brasero_volume_get_mount_point (BraseroVolume *volume,
+				GError **error);
+
+gboolean
+brasero_volume_umount (BraseroVolume *volume,
+		       gboolean wait,
+		       GError **error);
+
+gboolean
+brasero_volume_mount (BraseroVolume *volume,
+		      GtkWindow *parent_window,
+		      gboolean wait,
+		      GError **error);
+
+void
+brasero_volume_cancel_current_operation (BraseroVolume *volume);
+
+G_END_DECLS
+
+#endif /* _BRASERO_VOLUME_H_ */

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri Jan 16 09:35:12 2009
@@ -221,7 +221,7 @@
 	eggsmclient.c           \
 	eggsmclient.h           \
 	eggsmclient-private.h           \
-	eggsmclient-xsmp.c
+	eggsmclient-xsmp.c           
 
 if BUILD_INOTIFY
 brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h

Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c	(original)
+++ trunk/src/brasero-app.c	Fri Jan 16 09:35:12 2009
@@ -491,6 +491,7 @@
 					 GTK_DIALOG_MODAL,
 					 msg_type,
 					 button_type,
+					 "%s",
 					 primary_message);
 
 	if (!toplevel && priv->parent) {

Modified: trunk/src/brasero-burn-dialog.c
==============================================================================
--- trunk/src/brasero-burn-dialog.c	(original)
+++ trunk/src/brasero-burn-dialog.c	Fri Jan 16 09:35:12 2009
@@ -648,6 +648,7 @@
 					  GTK_DIALOG_MODAL,
 					  GTK_MESSAGE_ERROR,
 					  GTK_BUTTONS_NONE,
+					  "%s",
 					  string);
 	g_free (string);
 

Modified: trunk/src/brasero-disc-option-dialog.c
==============================================================================
--- trunk/src/brasero-disc-option-dialog.c	(original)
+++ trunk/src/brasero-disc-option-dialog.c	Fri Jan 16 09:35:12 2009
@@ -325,7 +325,7 @@
 	secondary = g_strdup_printf ("%s\n%s",
 				     _("Some files don't have a suitable name for a fully Windows-compatible CD."),
 				     _("Those names should be changed and truncated to 64 characters."));
-	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), secondary);
+	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", secondary);
 	g_free (secondary);
 
 	gtk_dialog_add_button (GTK_DIALOG (message),

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Fri Jan 16 09:35:12 2009
@@ -236,7 +236,7 @@
 						 _("Do you really want to choose this location?"));
 
 		string = g_strdup_printf ("%s.", error->message);
-		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), string);
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", string);
 		g_error_free (error);
 		g_free (string);
 
@@ -272,7 +272,7 @@
 						 _("Do you really want to choose this location?"));
 
 		string = g_strdup_printf ("%s.", _("You do not have the required permission to write at this location"));
-		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), string);
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", string);
 		g_free (string);
 
 		gtk_dialog_add_buttons (GTK_DIALOG (dialog),

Modified: trunk/src/brasero-eject-dialog.c
==============================================================================
--- trunk/src/brasero-eject-dialog.c	(original)
+++ trunk/src/brasero-eject-dialog.c	Fri Jan 16 09:35:12 2009
@@ -37,6 +37,7 @@
 #include "brasero-eject-dialog.h"
 #include "brasero-tool-dialog.h"
 #include "brasero-medium.h"
+#include "brasero-drive.h"
 #include "brasero-volume.h"
 #include "burn-debug.h"
 #include "brasero-utils.h"
@@ -81,7 +82,7 @@
 		return TRUE;
 	}*/
 
-	if (!brasero_volume_eject (BRASERO_VOLUME (medium), TRUE, &error)) {
+	if (!brasero_drive_eject (drive, TRUE, &error)) {
 		BRASERO_BURN_LOG ("Error ejecting medium: %s", error?error->message:"Unknown error");
 		return TRUE;
 	}

Modified: trunk/src/brasero-split-dialog.c
==============================================================================
--- trunk/src/brasero-split-dialog.c	(original)
+++ trunk/src/brasero-split-dialog.c	Fri Jan 16 09:35:12 2009
@@ -687,6 +687,7 @@
 					  GTK_DIALOG_MODAL,
 					  GTK_MESSAGE_QUESTION,
 					  GTK_BUTTONS_NONE,
+					  "%s",
 					  primary);
 
 	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),

Modified: trunk/src/brasero-sum-dialog.c
==============================================================================
--- trunk/src/brasero-sum-dialog.c	(original)
+++ trunk/src/brasero-sum-dialog.c	Fri Jan 16 09:35:12 2009
@@ -525,7 +525,10 @@
 
 	medium = brasero_drive_get_medium (drive);
 
-	retval = brasero_volume_mount (BRASERO_VOLUME (medium), TRUE, error);
+	retval = brasero_volume_mount (BRASERO_VOLUME (medium),
+				       GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
+				       TRUE,
+				       error);
 	if (!retval)
 		return BRASERO_CHECKSUM_NONE;
 

Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c	(original)
+++ trunk/src/brasero-utils.c	Fri Jan 16 09:35:12 2009
@@ -522,6 +522,7 @@
 					  GTK_DIALOG_DESTROY_WITH_PARENT,
 					  type,
 					  GTK_BUTTONS_CLOSE,
+					  "%s",
 					  primary_message);
 
 	gtk_window_set_title (GTK_WINDOW (message), "");

Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c	(original)
+++ trunk/src/burn.c	Fri Jan 16 09:35:12 2009
@@ -265,18 +265,15 @@
 		    BraseroDrive *drive,
 		    GError **error)
 {
-	BraseroMedium *medium;
 	guint counter = 0;
 
-	medium = brasero_drive_get_medium (drive);
-	brasero_volume_eject (BRASERO_VOLUME (medium), TRUE, error);
+	brasero_drive_eject (drive, TRUE, error);
 
 	/* sleep some time and see what happened */
 	brasero_burn_sleep (self, 500);
-	medium = brasero_drive_get_medium (drive);
 
 	/* Retry several times, since sometimes the drives are really busy */
-	while (medium && brasero_medium_get_status (medium) != BRASERO_MEDIUM_NONE) {
+	while (brasero_drive_get_medium (drive)) {
 		counter ++;
 		if (counter > MAX_EJECT_ATTEMPTS) {
 			gchar *name;
@@ -297,9 +294,8 @@
 		}
 
 		BRASERO_BURN_LOG ("Retrying ejection");
-		brasero_volume_eject (BRASERO_VOLUME (medium), TRUE, error);
+		brasero_drive_eject (drive, TRUE, error);
 		brasero_burn_sleep (self, 500);
-		medium = brasero_drive_get_medium (drive);
 	}
 
 	return BRASERO_BURN_OK;
@@ -1018,7 +1014,9 @@
 		BRASERO_BURN_LOG ("Trying to mount medium");
 
 		/* NOTE: we don't really care about the return value */
-		brasero_volume_mount (BRASERO_VOLUME (medium), FALSE, NULL);
+		/* NOTE: brasero_app_get_default () wouldn't work here as we 
+		 * want to have it split soon */
+		brasero_volume_mount (BRASERO_VOLUME (medium), NULL, FALSE, NULL);
 		priv->mounted_by_us = TRUE;
 
 		brasero_burn_sleep (self, MOUNT_TIMEOUT);
@@ -1124,7 +1122,7 @@
 	 * one thing it avoids breaking other applications that are using it
 	 * like for example totem. */
 	/* if (BRASERO_BURN_SESSION_EJECT (priv->session))
-		brasero_volume_eject (BRASERO_VOLUME (medium), FALSE, error); */
+		brasero_drive_eject (BRASERO_VOLUME (medium), FALSE, error); */
 
 	priv->src = NULL;
 	return BRASERO_BURN_OK;
@@ -1135,7 +1133,6 @@
 				GError **error)
 {
 	BraseroBurnPrivate *priv = BRASERO_BURN_PRIVATE (burn);
-	BraseroMedium *medium;
 
 	if (!priv->dest)
 		return BRASERO_BURN_OK;
@@ -1147,7 +1144,6 @@
 
 	priv->dest_locked = 0;
 	brasero_drive_unlock (priv->dest);
-	medium = brasero_drive_get_medium (priv->dest);
 
 	if (!BRASERO_BURN_SESSION_EJECT (priv->session)) {
 		if (priv->dest) {
@@ -1164,7 +1160,7 @@
 		}
 	}
 	else
-		brasero_volume_eject (BRASERO_VOLUME (medium), FALSE, error);
+		brasero_drive_eject (priv->dest, FALSE, error);
 
 	priv->dest = NULL;
 	return BRASERO_BURN_OK;

Modified: trunk/src/plugins/checksum/Makefile.am
==============================================================================
--- trunk/src/plugins/checksum/Makefile.am	(original)
+++ trunk/src/plugins/checksum/Makefile.am	Fri Jan 16 09:35:12 2009
@@ -11,6 +11,7 @@
 	-DBRASERO_LIBDIR=\"$(libdir)\"  	         	\
 	$(DISABLE_DEPRECATED)				\
 	$(BRASERO_GLIB_CFLAGS)				\
+	$(BRASERO_GTK_CFLAGS)				\
 	$(BRASERO_GCONF_CFLAGS)
 
 checksumdir = $(libdir)/brasero/plugins
@@ -29,4 +30,4 @@
 				      burn-volume-read.h
 
 libbrasero_checksum_file_la_LDFLAGS = -module -avoid-version
-libbrasero_checksum_file_la_LIBADD = $(BRASERO_GLIB_LIBS) $(BRASERO_GCONF_LIBS)
+libbrasero_checksum_file_la_LIBADD = $(BRASERO_GLIB_LIBS) $(BRASERO_GCONF_LIBS) $(BRASERO_GTK_LIBS)

Modified: trunk/src/plugins/checksum/burn-volume-read.c
==============================================================================
--- trunk/src/plugins/checksum/burn-volume-read.c	(original)
+++ trunk/src/plugins/checksum/burn-volume-read.c	Fri Jan 16 09:35:12 2009
@@ -84,7 +84,7 @@
 
 	handle->position = extent->block;
 	handle->extent_size = extent->size;
-	handle->extent_last = BRASERO_SIZE_TO_SECTORS (extent->size, 2048) + extent->block;
+	handle->extent_last = BRASERO_BYTES_TO_SECTORS (extent->size, 2048) + extent->block;
 
 	/* start loading first block */
 	res_seek = BRASERO_VOL_SRC_SEEK (handle->src, handle->position, SEEK_SET,  NULL);
@@ -139,7 +139,7 @@
 
 		handle->position = extent->block;
 		handle->extent_size = extent->size;
-		handle->extent_last = BRASERO_SIZE_TO_SECTORS (extent->size, 2048) + extent->block;
+		handle->extent_last = BRASERO_BYTES_TO_SECTORS (extent->size, 2048) + extent->block;
 	}
 
 	result = BRASERO_VOL_SRC_READ (handle->src, (char *) handle->buffer, 1, NULL);

Modified: trunk/src/plugins/dvdcss/burn-dvdcss.c
==============================================================================
--- trunk/src/plugins/dvdcss/burn-dvdcss.c	(original)
+++ trunk/src/plugins/dvdcss/burn-dvdcss.c	Fri Jan 16 09:35:12 2009
@@ -265,7 +265,7 @@
 
 					extent = extents->data;
 					range->start = extent->block;
-					range->end = extent->block + BRASERO_SIZE_TO_SECTORS (extent->size, DVDCSS_BLOCK_SIZE);
+					range->end = extent->block + BRASERO_BYTES_TO_SECTORS (extent->size, DVDCSS_BLOCK_SIZE);
 
 					g_queue_push_head (map, range);
 



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