aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
author9 <NotZed@Ximian.com>2001-10-10 07:36:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-10 07:36:31 +0800
commitb457da9a980ac545fbb051bf6b7f80bfb070c867 (patch)
treed098bf7d5b90d3a20315e5726ff785315ba444e4 /camel
parentf989a757a1986a7b1337b3cc553241345c852f34 (diff)
downloadgsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar.gz
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar.bz2
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar.lz
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar.xz
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.tar.zst
gsoc2013-evolution-b457da9a980ac545fbb051bf6b7f80bfb070c867.zip
Another go at getting the logic right again. Make transients only update
2001-10-09 <NotZed@Ximian.com> * camel-operation.c (camel_operation_progress): Another go at getting the logic right again. Make transients only update after 5 seconds (CAMEL_OPERATION_TRANSIENT_DELAY) (camel_operation_end): Likewise. svn path=/trunk/; revision=13536
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-operation.c21
2 files changed, 21 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index ded2ff8b35..b33a6c5110 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,10 @@
2001-10-09 <NotZed@Ximian.com>
+ * camel-operation.c (camel_operation_progress): Another go at
+ getting the logic right again. Make transients only update after
+ 5 seconds (CAMEL_OPERATION_TRANSIENT_DELAY)
+ (camel_operation_end): Likewise.
+
* providers/local/camel-spool-folder.c (spool_search_by_uids):
Implement.
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index e44d7ffde9..9f007d79f6 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -48,6 +48,9 @@ struct _CamelOperation {
#define CAMEL_OPERATION_CANCELLED (1<<0)
#define CAMEL_OPERATION_TRANSIENT (1<<1)
+/* Delay before a transient operation has any effect on the status */
+#define CAMEL_OPERATION_TRANSIENT_DELAY (5)
+
#ifdef ENABLE_THREADS
#define CAMEL_ACTIVE_LOCK() pthread_mutex_lock(&operation_active_lock)
#define CAMEL_ACTIVE_UNLOCK() pthread_mutex_unlock(&operation_active_lock)
@@ -562,12 +565,20 @@ void camel_operation_progress(CamelOperation *cc, int pc)
s = cc->status_stack->data;
s->pc = pc;
+ /* Transient messages dont start updating till 4 seconds after
+ they started, then they update every second */
now = stamp();
- if (cc->status_update == now
- || (s->flags & CAMEL_OPERATION_TRANSIENT
- && s->stamp/16 > now/16))
+ if (cc->status_update == now) {
cc = NULL;
- else {
+ } else if (s->flags & CAMEL_OPERATION_TRANSIENT) {
+ if (s->stamp + CAMEL_OPERATION_TRANSIENT_DELAY > now) {
+ cc = NULL;
+ } else {
+ cc->status_update = now;
+ cc->lastreport = s;
+ msg = g_strdup(s->msg);
+ }
+ } else {
s->stamp = cc->status_update = now;
cc->lastreport = s;
msg = g_strdup(s->msg);
@@ -627,7 +638,7 @@ void camel_operation_end(CamelOperation *cc)
while (l) {
p = l->data;
if (p->flags & CAMEL_OPERATION_TRANSIENT) {
- if (p->stamp/16 < now/16) {
+ if (p->stamp + CAMEL_OPERATION_TRANSIENT_DELAY < now) {
msg = g_strdup(p->msg);
pc = p->pc;
cc->lastreport = p;