brasero r748 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r748 - in trunk: . src
- Date: Mon, 21 Apr 2008 17:16:44 +0100 (BST)
Author: philippr
Date: Mon Apr 21 16:16:43 2008
New Revision: 748
URL: http://svn.gnome.org/viewvc/brasero?rev=748&view=rev
Log:
Fix for good this time unmount operation by waiting for GVolumeMonitor signal
Fix warning with g_propagate_error
* src/burn-volume-obj.c (brasero_volume_wait_for_operation_end),
(brasero_volume_umounted_cb), (brasero_volume_umount_finish),
(brasero_volume_umount), (brasero_volume_mount_finish):
* src/burn.c (brasero_burn_run_imager),
(brasero_burn_run_recorder):
Modified:
trunk/ChangeLog
trunk/src/burn-volume-obj.c
trunk/src/burn.c
Modified: trunk/src/burn-volume-obj.c
==============================================================================
--- trunk/src/burn-volume-obj.c (original)
+++ trunk/src/burn-volume-obj.c Mon Apr 21 16:16:43 2008
@@ -173,6 +173,7 @@
priv = BRASERO_VOLUME_PRIVATE (self);
+ /* FIXME! that's where we should put a timeout (30 sec ?) */
priv->loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (priv->loop);
@@ -208,6 +209,34 @@
}
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);
+ if (vol_mount != mount)
+ return;
+
+ brasero_volume_operation_end (self);
+}
+
+static void
brasero_volume_umount_finish (GObject *source,
GAsyncResult *result,
gpointer user_data)
@@ -216,6 +245,10 @@
BraseroVolumePrivate *priv;
priv = BRASERO_VOLUME_PRIVATE (self);
+
+ if (!priv->loop)
+ return;
+
priv->result = g_mount_unmount_finish (G_MOUNT (source),
result,
&priv->error);
@@ -231,11 +264,10 @@
/* That can happen sometimes */
g_error_free (priv->error);
priv->error = NULL;
+ priv->result = TRUE;
}
}
- brasero_volume_operation_end (self);
-
if (priv->result)
g_signal_emit (self,
volume_signals[UNMOUNTED],
@@ -268,12 +300,23 @@
return FALSE;
if (wait) {
+ gulong umount_sig;
+ GVolumeMonitor *monitor;
+
+ monitor = g_volume_monitor_get ();
+ umount_sig = g_signal_connect (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,
@@ -307,10 +350,12 @@
* 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;
}
}
Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c (original)
+++ trunk/src/burn.c Mon Apr 21 16:16:43 2008
@@ -1267,8 +1267,9 @@
}
if (result != BRASERO_BURN_ERR) {
- if (error)
+ if (error && ret_error)
g_propagate_error (error, ret_error);
+
return result;
}
@@ -1312,7 +1313,9 @@
*/
/* not recoverable propagate the error */
- g_propagate_error (error, ret_error);
+ if (error && ret_error)
+ g_propagate_error (error, ret_error);
+
return BRASERO_BURN_ERR;
}
@@ -1389,7 +1392,9 @@
* if the user wants to carry on with a non joliet disc */
result = brasero_burn_ask_for_joliet (burn);
if (result != BRASERO_BURN_OK) {
- g_propagate_error (error, ret_error);
+ if (ret_error)
+ g_propagate_error (error, ret_error);
+
return result;
}
@@ -1494,7 +1499,9 @@
goto start;
}
- g_propagate_error (error, ret_error);
+ if (ret_error)
+ g_propagate_error (error, ret_error);
+
return BRASERO_BURN_ERR;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]