[brasero/gnome-2-26] Make results returned by BraseroIO be serialized for each objects
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero/gnome-2-26] Make results returned by BraseroIO be serialized for each objects
- Date: Wed, 3 Jun 2009 08:23:44 -0400 (EDT)
commit 57eefed3b62d1afd6746d6f19d9670bbfc0167d3
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Wed Jun 3 13:50:06 2009 +0200
Make results returned by BraseroIO be serialized for each objects
Prevent BraseroDataDisc to show multiple dialog boxes at the same time.
---
src/brasero-io.c | 34 ++++++++++++++++++++++++++++------
src/brasero-io.h | 3 +++
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/brasero-io.c b/src/brasero-io.c
index 312e8f5..1ae493c 100644
--- a/src/brasero-io.c
+++ b/src/brasero-io.c
@@ -295,6 +295,8 @@ brasero_io_job_result_free (BraseroIOJobResult *result)
* Used to return the results
*/
+#define NUMBER_OF_RESULTS 25
+
static gboolean
brasero_io_return_result_idle (gpointer callback_data)
{
@@ -303,6 +305,8 @@ brasero_io_return_result_idle (gpointer callback_data)
BraseroIOJobResult *result;
BraseroIOPrivate *priv;
guint results_id;
+ GSList *iter;
+ GSList *next;
int i;
priv = BRASERO_IO_PRIVATE (self);
@@ -317,15 +321,29 @@ brasero_io_return_result_idle (gpointer callback_data)
/* Return several results at a time that can be a huge speed gain.
* What should be the value that provides speed and responsiveness? */
- for (i = 0; priv->results && i < 25; i ++) {
- result = priv->results->data;
+ for (i = 0, iter = priv->results; iter && i < NUMBER_OF_RESULTS; iter = next) {
+ BraseroIOJobBase *base;
+
+ result = iter->data;
+ next = iter->next;
+
+ /* Make sure another result is not returned for this base. This
+ * is to avoid BraseroDataDisc showing multiple dialogs for
+ * various problems; like one dialog for joliet, one for deep,
+ * and one for name collision. */
+ if (result->base->in_use)
+ continue;
+
priv->results = g_slist_remove (priv->results, result);
+ base = (BraseroIOJobBase *) result->base;
+ base->in_use = TRUE;
+
g_mutex_unlock (priv->lock);
data = result->callback_data;
if (result->uri || result->info || result->error)
- result->base->callback (result->base->object,
+ result->base->callback (base->object,
result->error,
result->uri,
result->info,
@@ -333,15 +351,19 @@ brasero_io_return_result_idle (gpointer callback_data)
/* Else this is just to call destroy () for callback data */
brasero_io_unref_result_callback_data (data,
- result->base->object,
- result->base->destroy,
+ base->object,
+ base->destroy,
FALSE);
+
brasero_io_job_result_free (result);
g_mutex_lock (priv->lock);
+
+ i ++;
+ base->in_use = FALSE;
}
- if (!priv->results_id && priv->results) {
+ if (!priv->results_id && iter && i >= NUMBER_OF_RESULTS) {
/* There are still results and no idle call is scheduled so we
* have to restart ourselves to make sure we empty the queue */
priv->results_id = results_id;
diff --git a/src/brasero-io.h b/src/brasero-io.h
index 7c0228e..890f2fa 100644
--- a/src/brasero-io.h
+++ b/src/brasero-io.h
@@ -123,6 +123,9 @@ struct _BraseroIOJobBase {
BraseroIOResultCallback callback;
BraseroIODestroyCallback destroy;
BraseroIOProgressCallback progress;
+
+ /* Whether we are returning something for this base */
+ guint in_use:1;
};
typedef struct _BraseroIOJobBase BraseroIOJobBase;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]