[brasero] Fix for #591443 - Multi-session warning should tell about the "import" checkbox
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Fix for #591443 - Multi-session warning should tell about the "import" checkbox
- Date: Fri, 23 Oct 2009 20:40:36 +0000 (UTC)
commit 02d924ddd25c59347c2e082511d32cc0595f4a28
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Fri Oct 23 22:37:50 2009 +0200
Fix for #591443 - Multi-session warning should tell about the "import" checkbox
libbrasero-burn/brasero-burn-dialog.c | 40 ++++-
libbrasero-burn/brasero-burn.c | 263 +++++++++++++++++++--------------
2 files changed, 183 insertions(+), 120 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn-dialog.c b/libbrasero-burn/brasero-burn-dialog.c
index 44093c0..82112d2 100644
--- a/libbrasero-burn/brasero-burn-dialog.c
+++ b/libbrasero-burn/brasero-burn-dialog.c
@@ -774,7 +774,9 @@ brasero_burn_dialog_loss_warnings_cb (BraseroBurnDialog *dialog,
const gchar *main_message,
const gchar *secondary_message,
const gchar *button_text,
- const gchar *button_icon)
+ const gchar *button_icon,
+ const gchar *second_button_text,
+ const gchar *second_button_icon)
{
gint result;
GtkWidget *button;
@@ -799,6 +801,17 @@ brasero_burn_dialog_loss_warnings_cb (BraseroBurnDialog *dialog,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
"%s", secondary_message);
+ if (second_button_text) {
+ button = gtk_dialog_add_button (GTK_DIALOG (message),
+ second_button_text,
+ GTK_RESPONSE_YES);
+
+ if (second_button_icon)
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_icon_name (second_button_icon,
+ GTK_ICON_SIZE_BUTTON));
+ }
+
button = gtk_dialog_add_button (GTK_DIALOG (message),
_("_Replace Disc"),
GTK_RESPONSE_ACCEPT);
@@ -824,6 +837,9 @@ brasero_burn_dialog_loss_warnings_cb (BraseroBurnDialog *dialog,
g_timer_start (priv->total_time);
+ if (result == GTK_RESPONSE_YES)
+ return BRASERO_BURN_RETRY;
+
if (result == GTK_RESPONSE_ACCEPT)
return BRASERO_BURN_NEED_RELOAD;
@@ -842,7 +858,9 @@ brasero_burn_dialog_data_loss_cb (BraseroBurn *burn,
_("The disc in the drive holds data."),
/* Translators: Blank is a verb here */
_("_Blank Disc"),
- "media-optical-blank");
+ "media-optical-blank",
+ NULL,
+ NULL);
}
static BraseroBurnResult
@@ -853,14 +871,14 @@ brasero_burn_dialog_previous_session_loss_cb (BraseroBurn *burn,
BraseroBurnResult result;
secondary = g_strdup_printf ("%s\n%s",
- _("Already burned files will be invisible (though still readable)."),
- _("Do you want to continue anyway?"));
+ _("If you import them you will be able to see and use them once the current selection of files is burned."),
+ _("If you don't, they will be invisible (though still readable)."));
result = brasero_burn_dialog_loss_warnings_cb (dialog,
- _("Appending new files to a multisession disc is not advised."),
+ _("There are files already burned on this disc. Would you like to import them?"),
secondary,
- _("_Continue"),
- "media-optical-burn");
+ _("_Import"), NULL,
+ _("Only _Append"), NULL);
g_free (secondary);
return result;
}
@@ -880,7 +898,9 @@ brasero_burn_dialog_audio_to_appendable_cb (BraseroBurn *burn,
_("Appending audio tracks to a CD is not advised."),
secondary,
_("_Continue"),
- "media-optical-burn");
+ "media-optical-burn",
+ NULL,
+ NULL);
g_free (secondary);
return result;
}
@@ -900,7 +920,9 @@ brasero_burn_dialog_rewritable_cb (BraseroBurn *burn,
_("Recording audio tracks on a rewritable disc is not advised."),
secondary,
_("_Continue"),
- "media-optical-burn");
+ "media-optical-burn",
+ NULL,
+ NULL);
g_free (secondary);
return result;
}
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index c351628..f3b5cc0 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -1656,117 +1656,6 @@ start:
}
static BraseroBurnResult
-brasero_burn_check_data_loss (BraseroBurn *burn,
- GError **error)
-{
- BraseroMedia media;
- BraseroBurnFlag flags;
- BraseroTrackType *input;
- BraseroBurnResult result;
- BraseroTrackType *output;
- BraseroBurnPrivate *priv = BRASERO_BURN_PRIVATE (burn);
-
- output = brasero_track_type_new ();
- brasero_burn_session_get_output_type (priv->session, output);
- if (!brasero_track_type_get_has_medium (output)) {
- brasero_track_type_free (output);
- return BRASERO_BURN_OK;
- }
-
- flags = brasero_burn_session_get_flags (priv->session);
- media = brasero_track_type_get_medium_type (output);
- brasero_track_type_free (output);
-
- input = brasero_track_type_new ();
- brasero_burn_session_get_input_type (priv->session, input);
-
- if (flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
- /* There is an error if APPEND was set since this disc is not
- * supported without a prior blanking. */
-
- /* we warn the user is going to lose data even if in the case of
- * DVD+/-RW we don't really blank the disc we rather overwrite */
- result = brasero_burn_emit_signal (burn,
- WARN_DATA_LOSS_SIGNAL,
- BRASERO_BURN_CANCEL);
- if (result != BRASERO_BURN_OK)
- goto reload;
- }
- else if (media & (BRASERO_MEDIUM_HAS_DATA|BRASERO_MEDIUM_HAS_AUDIO)) {
- /* A few special warnings for the discs with data/audio on them
- * that don't need prior blanking or can't be blanked */
- if ((media & BRASERO_MEDIUM_CD)
- && brasero_track_type_get_has_stream (input)
- && !BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
- /* We'd rather blank and rewrite a disc rather than
- * append audio to appendable disc. That's because audio
- * tracks have little chance to be readable by common CD
- * player as last tracks */
- result = brasero_burn_emit_signal (burn,
- WARN_AUDIO_TO_APPENDABLE_SIGNAL,
- BRASERO_BURN_CANCEL);
- if (result != BRASERO_BURN_OK)
- goto reload;
- }
-
- /* NOTE: if input is AUDIO we don't care since the OS
- * will load the last session of DATA anyway */
- if ((media & BRASERO_MEDIUM_HAS_DATA)
- && brasero_track_type_get_has_data (input)
- && !(flags & BRASERO_BURN_FLAG_MERGE)) {
- /* warn the users that their previous data
- * session (s) will not be mounted by default by
- * the OS and that it'll be invisible */
- result = brasero_burn_emit_signal (burn,
- WARN_PREVIOUS_SESSION_LOSS_SIGNAL,
- BRASERO_BURN_CANCEL);
- if (result != BRASERO_BURN_OK)
- goto reload;
- }
- }
-
- if (media & BRASERO_MEDIUM_REWRITABLE) {
- /* emits a warning for the user if it's a rewritable
- * disc and he wants to write only audio tracks on it */
-
- /* NOTE: no need to error out here since the only thing
- * we are interested in is if it is AUDIO or not or if
- * the disc we are copying has audio tracks only or not */
- if (brasero_track_type_get_has_stream (input)
- && !BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
- result = brasero_burn_emit_signal (burn,
- WARN_REWRITABLE_SIGNAL,
- BRASERO_BURN_CANCEL);
- if (result != BRASERO_BURN_OK)
- goto reload;
- }
-
- if (brasero_track_type_get_has_medium (input)
- && (brasero_track_type_get_medium_type (input) & BRASERO_MEDIUM_HAS_AUDIO)) {
- result = brasero_burn_emit_signal (burn,
- WARN_REWRITABLE_SIGNAL,
- BRASERO_BURN_CANCEL);
- if (result != BRASERO_BURN_OK)
- goto reload;
- }
- }
-
- brasero_track_type_free (input);
-
- return BRASERO_BURN_OK;
-
-reload:
-
- brasero_track_type_free (input);
-
- result = brasero_burn_reload_dest_media (burn, BRASERO_BURN_ERROR_NONE, error);
- if (result != BRASERO_BURN_OK)
- return result;
-
- return BRASERO_BURN_RETRY;
-}
-
-static BraseroBurnResult
brasero_burn_check_session_consistency (BraseroBurn *burn,
BraseroTrackType *output,
GError **error)
@@ -1802,6 +1691,7 @@ brasero_burn_check_session_consistency (BraseroBurn *burn,
/* save then wipe out flags from session to check them one by one */
flags = brasero_burn_session_get_flags (priv->session);
+ flags &= ~BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE;
brasero_burn_session_set_flags (BRASERO_BURN_SESSION (priv->session), BRASERO_BURN_FLAG_NONE);
if (!output || brasero_track_type_get_has_medium (output))
@@ -1882,6 +1772,157 @@ brasero_burn_check_session_consistency (BraseroBurn *burn,
return BRASERO_BURN_OK;
}
+static BraseroBurnResult
+brasero_burn_check_data_loss (BraseroBurn *burn,
+ GError **error)
+{
+ BraseroMedia media;
+ BraseroBurnFlag flags;
+ BraseroTrackType *input;
+ BraseroBurnResult result;
+ BraseroTrackType *output;
+ BraseroBurnPrivate *priv = BRASERO_BURN_PRIVATE (burn);
+
+ output = brasero_track_type_new ();
+ brasero_burn_session_get_output_type (priv->session, output);
+ if (!brasero_track_type_get_has_medium (output)) {
+ brasero_track_type_free (output);
+ return BRASERO_BURN_OK;
+ }
+
+ flags = brasero_burn_session_get_flags (priv->session);
+ media = brasero_track_type_get_medium_type (output);
+ brasero_track_type_free (output);
+
+ input = brasero_track_type_new ();
+ brasero_burn_session_get_input_type (priv->session, input);
+
+ if (flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE) {
+ /* There is an error if APPEND was set since this disc is not
+ * supported without a prior blanking. */
+
+ /* we warn the user is going to lose data even if in the case of
+ * DVD+/-RW we don't really blank the disc we rather overwrite */
+ result = brasero_burn_emit_signal (burn,
+ WARN_DATA_LOSS_SIGNAL,
+ BRASERO_BURN_CANCEL);
+ if (result == BRASERO_BURN_NEED_RELOAD)
+ goto reload;
+
+ if (result != BRASERO_BURN_OK) {
+ brasero_track_type_free (input);
+ return result;
+ }
+ }
+ else if (media & (BRASERO_MEDIUM_HAS_DATA|BRASERO_MEDIUM_HAS_AUDIO)) {
+ /* A few special warnings for the discs with data/audio on them
+ * that don't need prior blanking or can't be blanked */
+ if ((media & BRASERO_MEDIUM_CD)
+ && brasero_track_type_get_has_stream (input)
+ && !BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
+ /* We'd rather blank and rewrite a disc rather than
+ * append audio to appendable disc. That's because audio
+ * tracks have little chance to be readable by common CD
+ * player as last tracks */
+ result = brasero_burn_emit_signal (burn,
+ WARN_AUDIO_TO_APPENDABLE_SIGNAL,
+ BRASERO_BURN_CANCEL);
+ if (result == BRASERO_BURN_NEED_RELOAD)
+ goto reload;
+
+ if (result != BRASERO_BURN_OK) {
+ brasero_track_type_free (input);
+ return result;
+ }
+ }
+
+ /* NOTE: if input is AUDIO we don't care since the OS
+ * will load the last session of DATA anyway */
+ if ((media & BRASERO_MEDIUM_HAS_DATA)
+ && brasero_track_type_get_has_data (input)
+ && !(flags & BRASERO_BURN_FLAG_MERGE)) {
+ /* warn the users that their previous data
+ * session (s) will not be mounted by default by
+ * the OS and that it'll be invisible */
+ result = brasero_burn_emit_signal (burn,
+ WARN_PREVIOUS_SESSION_LOSS_SIGNAL,
+ BRASERO_BURN_CANCEL);
+
+ if (result == BRASERO_BURN_RETRY) {
+ /* Wipe out the current flags,
+ * Add a new one
+ * Recheck the result */
+ brasero_burn_session_pop_settings (priv->session);
+ brasero_burn_session_push_settings (priv->session);
+ brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_MERGE);
+ result = brasero_burn_check_session_consistency (burn, NULL, error);
+ if (result != BRASERO_BURN_OK)
+ return result;
+ }
+
+ if (result == BRASERO_BURN_NEED_RELOAD)
+ goto reload;
+
+ if (result != BRASERO_BURN_OK) {
+ brasero_track_type_free (input);
+ return result;
+ }
+ }
+ }
+
+ if (media & BRASERO_MEDIUM_REWRITABLE) {
+ /* emits a warning for the user if it's a rewritable
+ * disc and he wants to write only audio tracks on it */
+
+ /* NOTE: no need to error out here since the only thing
+ * we are interested in is if it is AUDIO or not or if
+ * the disc we are copying has audio tracks only or not */
+ if (brasero_track_type_get_has_stream (input)
+ && !BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (input))) {
+ result = brasero_burn_emit_signal (burn,
+ WARN_REWRITABLE_SIGNAL,
+ BRASERO_BURN_CANCEL);
+
+ if (result == BRASERO_BURN_NEED_RELOAD)
+ goto reload;
+
+ if (result != BRASERO_BURN_OK) {
+ brasero_track_type_free (input);
+ return result;
+ }
+ }
+
+ if (brasero_track_type_get_has_medium (input)
+ && (brasero_track_type_get_medium_type (input) & BRASERO_MEDIUM_HAS_AUDIO)) {
+ result = brasero_burn_emit_signal (burn,
+ WARN_REWRITABLE_SIGNAL,
+ BRASERO_BURN_CANCEL);
+
+ if (result == BRASERO_BURN_NEED_RELOAD)
+ goto reload;
+
+ if (result != BRASERO_BURN_OK) {
+ brasero_track_type_free (input);
+ return result;
+ }
+ }
+ }
+
+ brasero_track_type_free (input);
+
+ return BRASERO_BURN_OK;
+
+reload:
+
+ brasero_track_type_free (input);
+
+ result = brasero_burn_reload_dest_media (burn, BRASERO_BURN_ERROR_NONE, error);
+ if (result != BRASERO_BURN_OK)
+ return result;
+
+ return BRASERO_BURN_RETRY;
+}
+
/* FIXME: at the moment we don't allow for mixed CD type */
static BraseroBurnResult
brasero_burn_run_tasks (BraseroBurn *burn,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]