[brasero] Allow jobs to reset the progress to a pulsing bar so that if a new operation does not provide progre



commit aab8be0cb43626bec0919a5ac21eada683be22dd
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Mon Aug 24 15:41:22 2009 +0200

    Allow jobs to reset the progress to a pulsing bar so that if a new operation does not provide progress the progress bar does not stop

 libbrasero-burn/burn-job.c              |   12 +++++++++++
 libbrasero-burn/burn-job.h              |    2 +
 libbrasero-burn/burn-task-ctx.c         |   34 +++++++++++++++++++++++++++++++
 libbrasero-burn/burn-task-ctx.h         |    3 +-
 plugins/libburnia/burn-libburn-common.c |    6 +++-
 5 files changed, 54 insertions(+), 3 deletions(-)
---
diff --git a/libbrasero-burn/burn-job.c b/libbrasero-burn/burn-job.c
index 307c5c9..216a9a8 100644
--- a/libbrasero-burn/burn-job.c
+++ b/libbrasero-burn/burn-job.c
@@ -1805,6 +1805,18 @@ brasero_job_start_progress (BraseroJob *self,
 	return brasero_task_ctx_start_progress (priv->ctx, force);
 }
 
+BraseroBurnResult
+brasero_job_reset_progress (BraseroJob *self)
+{
+	BraseroJobPrivate *priv;
+
+	priv = BRASERO_JOB_PRIVATE (self);
+	if (priv->next)
+		return BRASERO_BURN_ERR;
+
+	return brasero_task_ctx_reset_progress (priv->ctx);
+}
+
 /**
  * these should be used to set the different values of the task by the jobs
  */
diff --git a/libbrasero-burn/burn-job.h b/libbrasero-burn/burn-job.h
index a87d039..de19bdd 100644
--- a/libbrasero-burn/burn-job.h
+++ b/libbrasero-burn/burn-job.h
@@ -272,6 +272,8 @@ BraseroBurnResult
 brasero_job_set_progress (BraseroJob *job,
 			  gdouble progress);
 BraseroBurnResult
+brasero_job_reset_progress (BraseroJob *job);
+BraseroBurnResult
 brasero_job_set_current_action (BraseroJob *job,
 				BraseroBurnAction action,
 				const gchar *string,
diff --git a/libbrasero-burn/burn-task-ctx.c b/libbrasero-burn/burn-task-ctx.c
index 4913b10..98b03d7 100644
--- a/libbrasero-burn/burn-task-ctx.c
+++ b/libbrasero-burn/burn-task-ctx.c
@@ -655,6 +655,40 @@ brasero_task_ctx_set_progress (BraseroTaskCtx *self,
 }
 
 BraseroBurnResult
+brasero_task_ctx_reset_progress (BraseroTaskCtx *self)
+{
+	BraseroTaskCtxPrivate *priv;
+
+	g_return_val_if_fail (BRASERO_IS_TASK_CTX (self), BRASERO_BURN_ERR);
+
+	priv = BRASERO_TASK_CTX_PRIVATE (self);
+
+	priv->progress_changed = 1;
+
+	if (priv->timer) {
+		g_timer_destroy (priv->timer);
+		priv->timer = NULL;
+	}
+
+	priv->dangerous = 0;
+	priv->progress = -1.0;
+	priv->track_bytes = -1;
+	priv->session_bytes = -1;
+
+	priv->current_elapsed = 0;
+	priv->last_written = 0;
+	priv->last_elapsed = 0;
+	priv->last_progress = 0;
+
+	if (priv->times) {
+		g_slist_free (priv->times);
+		priv->times = NULL;
+	}
+
+	return BRASERO_BURN_OK;
+}
+
+BraseroBurnResult
 brasero_task_ctx_set_current_action (BraseroTaskCtx *self,
 				     BraseroBurnAction action,
 				     const gchar *string,
diff --git a/libbrasero-burn/burn-task-ctx.h b/libbrasero-burn/burn-task-ctx.h
index 3df80c8..304478b 100644
--- a/libbrasero-burn/burn-task-ctx.h
+++ b/libbrasero-burn/burn-task-ctx.h
@@ -158,7 +158,8 @@ brasero_task_ctx_set_written_session (BraseroTaskCtx *ctx,
 BraseroBurnResult
 brasero_task_ctx_set_written_track (BraseroTaskCtx *ctx,
 				    gint64 written);
-
+BraseroBurnResult
+brasero_task_ctx_reset_progress (BraseroTaskCtx *ctx);
 BraseroBurnResult
 brasero_task_ctx_set_progress (BraseroTaskCtx *ctx,
 			       gdouble progress);
diff --git a/plugins/libburnia/burn-libburn-common.c b/plugins/libburnia/burn-libburn-common.c
index 72e2c93..d2289c0 100644
--- a/plugins/libburnia/burn-libburn-common.c
+++ b/plugins/libburnia/burn-libburn-common.c
@@ -417,14 +417,16 @@ brasero_libburn_common_status (BraseroJob *self,
 								TRUE);
 				g_free (string);
 			}
-			else
+			else {
+				brasero_job_reset_progress (self);
 				brasero_job_set_current_action (self,
 				                                BRASERO_BURN_ACTION_FIXATING,
 								NULL,
 								FALSE);
+			}
 		}
 		else
-			brasero_job_set_current_action (self,
+			     brasero_job_set_current_action (self,
 							BRASERO_BURN_ACTION_START_RECORDING,
 							NULL,
 							FALSE);



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