[brasero/gnome-2-30] Handle the case where despite our locking the medium, the user manages to eject it while the option



commit ea3e0c4b478b8eb678c71589b71da3c781fecb9b
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sat Jun 19 22:42:26 2010 +0200

    Handle the case where despite our locking the medium, the user manages to eject it while the option dialog is showing

 src/brasero-project.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 99f0a0c..4591e04 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1463,6 +1463,14 @@ brasero_project_setup_session (BraseroProject *project,
 	}
 }
 
+static void
+brasero_project_output_changed (BraseroBurnSession *session,
+                                BraseroMedium *former_medium,
+                                GtkDialog *dialog)
+{
+	gtk_dialog_response (dialog, GTK_RESPONSE_CANCEL);
+}
+
 static BraseroBurnResult
 brasero_project_drive_properties (BraseroProject *project)
 {
@@ -1474,6 +1482,7 @@ brasero_project_drive_properties (BraseroProject *project)
 	GtkWidget *options;
 	GtkWidget *button;
 	GtkWidget *dialog;
+	glong cancel_sig;
 	GtkWidget *box;
 	gchar *header;
 	gchar *string;
@@ -1494,6 +1503,12 @@ brasero_project_drive_properties (BraseroProject *project)
 					      NULL);
 	g_free (header);
 
+	/* This is in case the medium gets ejected instead of our locking it */
+	cancel_sig = g_signal_connect (project->priv->session,
+	                               "output-changed",
+	                               G_CALLBACK (brasero_project_output_changed),
+	                               dialog);
+
 	gtk_dialog_add_button (GTK_DIALOG (dialog),
 			       _("Burn _Several Copies"),
 			       GTK_RESPONSE_ACCEPT);
@@ -1538,6 +1553,8 @@ brasero_project_drive_properties (BraseroProject *project)
 	answer = gtk_dialog_run (GTK_DIALOG (dialog));
 	gtk_widget_destroy (dialog);
 
+	g_signal_handler_disconnect (project->priv->session, cancel_sig);
+
 	if (answer == GTK_RESPONSE_OK)
 		return BRASERO_BURN_OK;
 



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