[brasero/gnome-2-28] Some minor code enhancements



commit 4fbdc7c1cc4bee68c62beb247ecdc993e40915f6
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Fri Oct 2 20:34:22 2009 +0200

    Some minor code enhancements

 libbrasero-burn/burn-task-ctx.c         |    7 ++++---
 libbrasero-media/brasero-drive.c        |   13 ++++++++-----
 plugins/libburnia/burn-libburn-common.c |    6 +-----
 3 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/libbrasero-burn/burn-task-ctx.c b/libbrasero-burn/burn-task-ctx.c
index e7bcd88..6680d75 100644
--- a/libbrasero-burn/burn-task-ctx.c
+++ b/libbrasero-burn/burn-task-ctx.c
@@ -482,8 +482,6 @@ brasero_task_ctx_report_progress (BraseroTaskCtx *self)
 	priv = BRASERO_TASK_CTX_PRIVATE (self);
 
 	if (priv->action_changed) {
-		goffset total = 0;
-
 		/* Give a last progress-changed signal
 		 * setting previous action as completely
 		 * finished only if the plugin set any
@@ -491,9 +489,12 @@ brasero_task_ctx_report_progress (BraseroTaskCtx *self)
 		 * This helps having the tray icon or the
 		 * taskbar icon set to be full on quick
 		 * burns. */
-		if (priv->progress >= 0
+
+		if (priv->progress >= 0.0
 		||  priv->track_bytes >= 0
 		||  priv->session_bytes >= 0) {
+			goffset total = 0;
+
 			priv->progress = 1.0;
 			priv->track_bytes = 0;
 			brasero_task_ctx_get_session_output_size (self, NULL, &total);
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
index 3ad7a9d..f21a65e 100644
--- a/libbrasero-media/brasero-drive.c
+++ b/libbrasero-media/brasero-drive.c
@@ -205,6 +205,7 @@ brasero_drive_cancel_probing (BraseroDrive *drive)
 
 	g_mutex_lock (priv->mutex);
 	if (priv->probe) {
+
 		/* This to signal that we are cancelling */
 		priv->probe_cancelled = TRUE;
 
@@ -217,6 +218,8 @@ brasero_drive_cancel_probing (BraseroDrive *drive)
 	}
 	g_mutex_unlock (priv->mutex);
 
+	priv->probed = TRUE;
+
 	if (priv->probe_id) {
 		g_source_remove (priv->probe_id);
 		priv->probe_id = 0;
@@ -825,6 +828,8 @@ brasero_drive_probed_inside (gpointer data)
 	priv->probe_id = 0;
 	g_mutex_unlock (priv->mutex);
 
+	priv->probed = TRUE;
+
 	if (priv->has_medium) {
 		if (priv->medium) {
 			priv->probed = TRUE;
@@ -834,6 +839,7 @@ brasero_drive_probed_inside (gpointer data)
 
 		BRASERO_MEDIA_LOG ("Probing new medium");
 
+		priv->probed = FALSE;
 		priv->medium = g_object_new (BRASERO_TYPE_VOLUME,
 					     "drive", self,
 					     NULL);
@@ -857,10 +863,7 @@ brasero_drive_probed_inside (gpointer data)
 			       medium);
 
 		g_object_unref (medium);
-		priv->probed = TRUE;
 	}
-	else
-		priv->probed = TRUE;
 
 	return FALSE;
 }
@@ -883,6 +886,8 @@ brasero_drive_probe_inside_thread (gpointer data)
 	device = brasero_drive_get_device (drive);
 	BRASERO_MEDIA_LOG ("Trying to open device %s", device);
 
+	priv->has_medium = FALSE;
+
 	handle = brasero_device_handle_open (device, FALSE, &code);
 	while (!handle && counter <= BRASERO_DRIVE_OPEN_ATTEMPTS) {
 		sleep (1);
@@ -912,8 +917,6 @@ brasero_drive_probe_inside_thread (gpointer data)
 		if (code == BRASERO_SCSI_NO_MEDIUM) {
 			BRASERO_MEDIA_LOG ("No medium inserted");
 
-			priv->has_medium = FALSE;
-
 			brasero_device_handle_close (handle);
 			goto end;
 		}
diff --git a/plugins/libburnia/burn-libburn-common.c b/plugins/libburnia/burn-libburn-common.c
index e6754c4..097696c 100644
--- a/plugins/libburnia/burn-libburn-common.c
+++ b/plugins/libburnia/burn-libburn-common.c
@@ -411,13 +411,11 @@ brasero_libburn_common_status (BraseroJob *self,
 								TRUE);
 				g_free (string);
 			}
-			else {
-				brasero_job_reset_progress (self);
+			else
 				brasero_job_set_current_action (self,
 				                                BRASERO_BURN_ACTION_FIXATING,
 								NULL,
 								FALSE);
-			}
 		}
 		else
 			     brasero_job_set_current_action (self,
@@ -440,8 +438,6 @@ brasero_libburn_common_status (BraseroJob *self,
 		brasero_job_set_progress (self, fraction);
 		brasero_job_start_progress (self, FALSE);
 	}
-	else
-		brasero_job_reset_progress (self);
 
 	return BRASERO_BURN_RETRY;
 }



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