[brasero] Before blanking/formatting, check the size of the data to be written to avoid unnecessary blanking
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Before blanking/formatting, check the size of the data to be written to avoid unnecessary blanking
- Date: Tue, 8 Sep 2009 14:07:13 +0000 (UTC)
commit dd14dfdda5e7a244738150e2e9d39d69de221611
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Mon Sep 7 21:54:40 2009 +0200
Before blanking/formatting, check the size of the data to be written to avoid unnecessary blanking
libbrasero-burn/brasero-burn.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index a66605b..42a104a 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -1934,10 +1934,41 @@ brasero_burn_run_tasks (BraseroBurn *burn,
* the disc is not enough. */
action = brasero_task_ctx_get_action (BRASERO_TASK_CTX (priv->task));
if (action == BRASERO_TASK_ACTION_ERASE) {
+ BraseroTrackType *type;
+
/* FIXME: how could it be possible for a drive to test
* with a CLOSED CDRW for example. Maybe we should
* format/blank anyway. */
+ /* This is to avoid blanking a medium without knowing
+ * if the data will fit on it. At this point we do know
+ * what the size of the data is going to be. */
+ type = brasero_track_type_new ();
+ brasero_burn_session_get_input_type (priv->session, type);
+ if (brasero_track_type_get_has_image (type)
+ || brasero_track_type_get_has_medium (type)) {
+ BraseroMedium *medium;
+ goffset session_sec = 0;
+ goffset medium_sec = 0;
+
+ medium = brasero_drive_get_medium (priv->dest);
+ brasero_medium_get_capacity (medium,
+ NULL,
+ &medium_sec);
+
+ brasero_burn_session_get_size (priv->session,
+ &session_sec,
+ NULL);
+
+ 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)
+ break;
+ }
+ }
+ brasero_track_type_free (type);
+
/* This is to avoid a potential problem when running a
* dummy session first. When running dummy session the
* media gets erased if need be. Since it is not
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]