[brasero] Improvements to medium choosing combo



commit c92d67b474f3dc3fc075c2197de26d1fecfe6178
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Fri May 29 20:15:18 2009 +0200

    Improvements to medium choosing combo
    Only display the space that would remain after a burn
    Display at least 1 percent as soon as there is some data
---
 libbrasero-burn/brasero-dest-selection.c    |   15 ++++++++++-----
 libbrasero-media/brasero-medium-selection.c |    2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libbrasero-burn/brasero-dest-selection.c b/libbrasero-burn/brasero-dest-selection.c
index ee0a8d3..be3121a 100644
--- a/libbrasero-burn/brasero-dest-selection.c
+++ b/libbrasero-burn/brasero-dest-selection.c
@@ -451,6 +451,7 @@ brasero_dest_selection_format_medium_string (BraseroMediumSelection *selection,
 	BraseroBurnFlag flags;
 	goffset size_bytes = 0;
 	goffset data_blocks = 0;
+	goffset session_bytes = 0;
 	BraseroTrackType *input = NULL;
 	BraseroDestSelectionPrivate *priv;
 
@@ -513,7 +514,7 @@ brasero_dest_selection_format_medium_string (BraseroMediumSelection *selection,
 	flags = brasero_burn_session_get_flags (priv->session);
 	brasero_burn_session_get_size (priv->session,
 				       &data_blocks,
-				       NULL);
+				       &session_bytes);
 
 	if (flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND)) {
 		brasero_medium_get_free_space (medium,
@@ -537,6 +538,9 @@ brasero_dest_selection_format_medium_string (BraseroMediumSelection *selection,
 
 	if (blocks) {
 		used = data_blocks * 100 / blocks;
+		if (data_blocks && !used)
+			used = 1;
+
 		used = MIN (100, used);
 	}
 	else
@@ -545,11 +549,12 @@ brasero_dest_selection_format_medium_string (BraseroMediumSelection *selection,
 	brasero_medium_selection_update_used_space (BRASERO_MEDIUM_SELECTION (selection),
 						    medium,
 						    used);
-	if (!blocks) {
+	blocks -= data_blocks;
+	if (blocks <= 0) {
 		brasero_track_type_free (input);
 
 		/* NOTE for translators, the first %s is the medium name */
-		label = g_strdup_printf (_("%s: no free space"), medium_name);
+		label = g_strdup_printf (_("%s: not enough free space"), medium_name);
 		g_free (medium_name);
 		return label;
 	}
@@ -558,11 +563,11 @@ brasero_dest_selection_format_medium_string (BraseroMediumSelection *selection,
 	if (brasero_track_type_get_has_stream (input)
 	|| (brasero_track_type_get_has_medium (input)
 	&& (brasero_track_type_get_medium_type (input) & BRASERO_MEDIUM_HAS_AUDIO)))
-		size_string = brasero_units_get_time_string (BRASERO_BYTES_TO_DURATION (size_bytes),
+		size_string = brasero_units_get_time_string (BRASERO_BYTES_TO_DURATION (size_bytes - session_bytes),
 							     TRUE,
 							     TRUE);
 	else
-		size_string = g_format_size_for_display (size_bytes);
+		size_string = g_format_size_for_display (size_bytes - session_bytes);
 
 	brasero_track_type_free (input);
 
diff --git a/libbrasero-media/brasero-medium-selection.c b/libbrasero-media/brasero-medium-selection.c
index e2e484b..1b32d45 100644
--- a/libbrasero-media/brasero-medium-selection.c
+++ b/libbrasero-media/brasero-medium-selection.c
@@ -231,7 +231,7 @@ brasero_medium_selection_set_show_used_space (BraseroMediumSelection *selector)
 					NULL);
 
 	renderer = gtk_cell_renderer_progress_new ();
-	g_object_set (renderer, "xpad", 8, NULL);
+	g_object_set (renderer, "xpad", 8, "text-xalign", 0.0, NULL);
 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (selector), renderer, TRUE);
 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (selector), renderer,
 					"text", NAME_COL,



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