[brasero] Don't cancel and terminate a burning/copying/... process if blanking failed. Ask the user if he want
- From: Philippe Rouquier <philippr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [brasero] Don't cancel and terminate a burning/copying/... process if blanking failed. Ask the user if he want
- Date: Fri, 21 May 2010 09:30:38 +0000 (UTC)
commit 714b9d2b74c4187134ce4b37439fddbc524e701a
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Fri May 21 13:23:32 2010 +0200
Don't cancel and terminate a burning/copying/... process if blanking failed. Ask the user if he want to insert another disc instead.
libbrasero-burn/brasero-burn-dialog.c | 42 +++++++++++++++++++++----
libbrasero-burn/brasero-burn.c | 53 ++++++++++++++++++++++++++-------
libbrasero-burn/brasero-burn.h | 6 ++-
3 files changed, 81 insertions(+), 20 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn-dialog.c b/libbrasero-burn/brasero-burn-dialog.c
index 4287e0d..aada0aa 100644
--- a/libbrasero-burn/brasero-burn-dialog.c
+++ b/libbrasero-burn/brasero-burn-dialog.c
@@ -1039,8 +1039,10 @@ brasero_burn_dialog_eject_failure_cb (BraseroBurn *burn,
}
static BraseroBurnResult
-brasero_burn_dialog_disable_joliet_cb (BraseroBurn *burn,
- BraseroBurnDialog *dialog)
+brasero_burn_dialog_continue_question (BraseroBurnDialog *dialog,
+ const gchar *primary_message,
+ const gchar *secondary_message,
+ const gchar *button_message)
{
gint result;
GtkWidget *button;
@@ -1060,16 +1062,18 @@ brasero_burn_dialog_disable_joliet_cb (BraseroBurn *burn,
message = brasero_burn_dialog_create_message (dialog,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
- _("Do you want to continue with full Windows compatibility disabled?"));
+ primary_message);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
- _("Some files don't have a suitable name for a fully Windows-compatible CD."));
+ "%s",
+ secondary_message);
gtk_dialog_add_button (GTK_DIALOG (message),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL);
button = gtk_dialog_add_button (GTK_DIALOG (message),
- _("_Continue"),
+ button_message,
GTK_RESPONSE_OK);
gtk_button_set_image (GTK_BUTTON (button),
gtk_image_new_from_stock (GTK_STOCK_OK,
@@ -1086,7 +1090,27 @@ brasero_burn_dialog_disable_joliet_cb (BraseroBurn *burn,
if (result != GTK_RESPONSE_OK)
return BRASERO_BURN_CANCEL;
- return BRASERO_BURN_OK;
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_burn_dialog_blank_failure_cb (BraseroBurn *burn,
+ BraseroBurnDialog *dialog)
+{
+ return brasero_burn_dialog_continue_question (dialog,
+ _("Do you want to replace the disc and continue?"),
+ _("The currently inserted disc could not be blanked."),
+ _("_Replace Disc"));
+}
+
+static BraseroBurnResult
+brasero_burn_dialog_disable_joliet_cb (BraseroBurn *burn,
+ BraseroBurnDialog *dialog)
+{
+ return brasero_burn_dialog_continue_question (dialog,
+ _("Do you want to continue with full Windows compatibility disabled?"),
+ _("Some files don't have a suitable name for a fully Windows-compatible CD."),
+ _("_Continue"));
}
static void
@@ -1540,6 +1564,10 @@ brasero_burn_dialog_setup_session (BraseroBurnDialog *dialog,
G_CALLBACK (brasero_burn_dialog_insert_disc_cb),
dialog);
g_signal_connect (priv->burn,
+ "blank-failure",
+ G_CALLBACK (brasero_burn_dialog_blank_failure_cb),
+ dialog);
+ g_signal_connect (priv->burn,
"eject-failure",
G_CALLBACK (brasero_burn_dialog_eject_failure_cb),
dialog);
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index e459b6a..07addee 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -136,6 +136,7 @@ typedef enum {
ACTION_CHANGED_SIGNAL,
DUMMY_SUCCESS_SIGNAL,
EJECT_FAILURE_SIGNAL,
+ BLANK_FAILURE_SIGNAL,
INSTALL_MISSING_SIGNAL,
LAST_SIGNAL
} BraseroBurnSignalType;
@@ -191,7 +192,9 @@ brasero_burn_log (BraseroBurn *burn,
}
static BraseroBurnResult
-brasero_burn_emit_signal (BraseroBurn *burn, guint signal, BraseroBurnResult default_answer)
+brasero_burn_emit_signal (BraseroBurn *burn,
+ guint signal,
+ BraseroBurnResult default_answer)
{
GValue instance_and_params;
GValue return_value;
@@ -2050,9 +2053,8 @@ brasero_burn_run_tasks (BraseroBurn *burn,
return result;
}
- /* performed some additional tests that can
- * only be performed at this point. They are
- * mere warnings. */
+ /* performed some additional tests that can only be performed at this
+ * point. They are mere warnings. */
result = brasero_burn_check_data_loss (burn, error);
if (result != BRASERO_BURN_OK) {
brasero_burn_session_pop_settings (priv->session);
@@ -2129,8 +2131,10 @@ brasero_burn_run_tasks (BraseroBurn *burn,
if (session_sec > medium_sec) {
BRASERO_BURN_LOG ("Not enough space on medium %"G_GOFFSET_FORMAT"/%"G_GOFFSET_FORMAT, session_sec, medium_sec);
- result = brasero_burn_reload_dest_media (burn, BRASERO_BURN_ERROR_MEDIUM_SPACE, error);
- if (result != BRASERO_BURN_OK)
+ result = brasero_burn_reload_dest_media (burn,
+ BRASERO_BURN_ERROR_MEDIUM_SPACE,
+ error);
+ if (result == BRASERO_BURN_OK)
break;
}
}
@@ -2143,8 +2147,25 @@ brasero_burn_run_tasks (BraseroBurn *burn,
* data on it when we get to the real recording. */
if (erase_allowed) {
result = brasero_burn_run_eraser (burn, error);
- if (result != BRASERO_BURN_OK)
+
+ /* If the erasing process did not work then do
+ * not fail and cancel the entire session but
+ * ask the user if he wants to insert another
+ * disc instead. */
+ if (result != BRASERO_BURN_OK) {
+ result = brasero_burn_emit_signal (burn,
+ BLANK_FAILURE_SIGNAL,
+ BRASERO_BURN_ERR);
+ if (result == BRASERO_BURN_OK) {
+ result = brasero_burn_reload_dest_media (burn,
+ BRASERO_BURN_ERROR_NONE,
+ NULL);
+ if (result == BRASERO_BURN_OK)
+ result = BRASERO_BURN_RETRY;
+ }
+
break;
+ }
/* Since we blanked/formatted we need to recheck the burn
* flags with the new medium type as some flags could have
@@ -2920,9 +2941,9 @@ brasero_burn_blank (BraseroBurn *burn,
goto end;
result = brasero_burn_blank_real (burn, &ret_error);
- while (result == BRASERO_BURN_ERR
- && ret_error
- && ret_error->code == BRASERO_BURN_ERROR_MEDIUM_NOT_REWRITABLE) {
+ while (result == BRASERO_BURN_ERR &&
+ ret_error &&
+ ret_error->code == BRASERO_BURN_ERROR_MEDIUM_NOT_REWRITABLE) {
g_error_free (ret_error);
ret_error = NULL;
@@ -3161,7 +3182,17 @@ brasero_burn_class_init (BraseroBurnClass *klass)
brasero_marshal_INT__OBJECT,
G_TYPE_INT, 1,
BRASERO_TYPE_DRIVE);
- brasero_burn_signals [INSTALL_MISSING_SIGNAL] =
+ brasero_burn_signals [BLANK_FAILURE_SIGNAL] =
+ g_signal_new ("blank_failure",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (BraseroBurnClass,
+ blank_failure),
+ NULL, NULL,
+ brasero_marshal_INT__VOID,
+ G_TYPE_INT, 0,
+ G_TYPE_NONE);
+ brasero_burn_signals [INSTALL_MISSING_SIGNAL] =
g_signal_new ("install_missing",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
diff --git a/libbrasero-burn/brasero-burn.h b/libbrasero-burn/brasero-burn.h
index 333d47a..0ba48bc 100644
--- a/libbrasero-burn/brasero-burn.h
+++ b/libbrasero-burn/brasero-burn.h
@@ -62,8 +62,10 @@ typedef struct {
BraseroBurnError error,
BraseroMedia required_media);
- BraseroBurnResult (*eject_failure) (BraseroBurn *obj,
- BraseroDrive *drive);
+ BraseroBurnResult (*eject_failure) (BraseroBurn *obj,
+ BraseroDrive *drive);
+
+ BraseroBurnResult (*blank_failure) (BraseroBurn *obj);
BraseroBurnResult (*location_request) (BraseroBurn *obj,
GError *error,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]