[evolution-data-server] Bug #632676 - Only "Checking for new mail" in status bar and nothing else
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #632676 - Only "Checking for new mail" in status bar and nothing else
- Date: Tue, 9 Nov 2010 11:44:42 +0000 (UTC)
commit 4d754e77bb1be0782bf02b989bdb1da695bd151a
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 9 12:44:07 2010 +0100
Bug #632676 - Only "Checking for new mail" in status bar and nothing else
camel/camel-folder.c | 11 ++++++++++-
camel/camel-operation.c | 15 ++++++++++-----
2 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 828a78c..43b30d0 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -864,12 +864,18 @@ folder_transfer_messages_to_sync (CamelFolder *source,
gchar **ret_uid = NULL;
gint i;
GError *local_error = NULL;
+ GCancellable *local_cancellable = camel_operation_new ();
+ gulong handler_id = 0;
if (transferred_uids) {
*transferred_uids = g_ptr_array_new ();
g_ptr_array_set_size (*transferred_uids, uids->len);
}
+ /* to not propagate status messages from sub-functions into UI */
+ if (cancellable)
+ handler_id = g_signal_connect_swapped (cancellable, "cancelled", G_CALLBACK (g_cancellable_cancel), local_cancellable);
+
if (delete_originals)
camel_operation_push_message (
cancellable, _("Moving messages"));
@@ -888,7 +894,7 @@ folder_transfer_messages_to_sync (CamelFolder *source,
ret_uid = (gchar **)&((*transferred_uids)->pdata[i]);
folder_transfer_message_to (
source, uids->pdata[i], dest, ret_uid,
- delete_originals, cancellable, &local_error);
+ delete_originals, local_cancellable, &local_error);
camel_operation_progress (
cancellable, i * 100 / uids->len);
}
@@ -903,6 +909,9 @@ folder_transfer_messages_to_sync (CamelFolder *source,
if (local_error != NULL)
g_propagate_error (error, local_error);
+ g_object_unref (local_cancellable);
+ if (cancellable)
+ g_signal_handler_disconnect (cancellable, handler_id);
return TRUE;
}
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index 7850bab..13626d9 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -36,7 +36,8 @@
((obj), CAMEL_TYPE_OPERATION, CamelOperationPrivate))
#define PROGRESS_DELAY 250 /* milliseconds */
-#define TRANSIENT_DELAY 4 /* seconds */
+#define TRANSIENT_DELAY 250 /* milliseconds */
+#define POP_MESSAGE_DELAY 999 /* milliseconds */
typedef struct _StatusNode StatusNode;
@@ -425,7 +426,7 @@ camel_operation_push_message (GCancellable *cancellable,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
else
- node->source_id = g_timeout_add_seconds_full (
+ node->source_id = g_timeout_add_full (
G_PRIORITY_DEFAULT, TRANSIENT_DELAY,
(GSourceFunc) operation_emit_status_cb,
status_node_ref (node),
@@ -477,12 +478,16 @@ camel_operation_pop_message (GCancellable *cancellable)
node = g_queue_peek_head (&operation->priv->status_stack);
- if (node != NULL && node->source_id == 0)
- node->source_id = g_idle_add_full (
- G_PRIORITY_DEFAULT_IDLE,
+ if (node != NULL) {
+ if (node->source_id != 0)
+ g_source_remove (node->source_id);
+
+ node->source_id = g_timeout_add_full (
+ G_PRIORITY_DEFAULT, POP_MESSAGE_DELAY,
(GSourceFunc) operation_emit_status_cb,
status_node_ref (node),
(GDestroyNotify) status_node_unref);
+ }
UNLOCK ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]