From 60d1c3054aa60d02c763538d6b1f16d9d6ab6ade Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Feb 2013 14:21:42 -0500 Subject: G_PRIORITY_HIGH_IDLE is sufficient to beat GTK+ redraws. GTK+ uses (G_PRIORITY_HIGH_IDLE + 20) for redrawing operations, which is actually a slightly lower priority than G_PRIORITY_HIGH_IDLE. Therefore for our purpose, G_PRIORITY_HIGH_IDLE is sufficient. --- libemail-engine/e-mail-utils.c | 6 ++++-- libemail-engine/mail-folder-cache.c | 5 +++-- libemail-engine/mail-mt.c | 18 +++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'libemail-engine') diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c index e7f414a7d9..6614ecf67b 100644 --- a/libemail-engine/e-mail-utils.c +++ b/libemail-engine/e-mail-utils.c @@ -824,8 +824,10 @@ free_mail_cache_thread (gpointer user_data) e_cancellable_mutex_unlock (&photos_cache_lock); } - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - g_idle_add_full (G_PRIORITY_HIGH, free_mail_cache_idle, user_data, NULL); + /* Prioritize ahead of GTK+ redraws. */ + g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, + free_mail_cache_idle, user_data, NULL); return NULL; } diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c index 89c6a5246a..ad8a5b1764 100644 --- a/libemail-engine/mail-folder-cache.c +++ b/libemail-engine/mail-folder-cache.c @@ -304,8 +304,9 @@ flush_updates (MailFolderCache *cache) if (g_queue_is_empty (&cache->priv->updates)) return; - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - cache->priv->update_id = g_idle_add_full (G_PRIORITY_DEFAULT, + /* Prioritize ahead of GTK+ redraws. */ + cache->priv->update_id = g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, (GSourceFunc) flush_updates_idle_cb, cache, NULL); } diff --git a/libemail-engine/mail-mt.c b/libemail-engine/mail-mt.c index ef443d43e0..4cec5a8b6f 100644 --- a/libemail-engine/mail-mt.c +++ b/libemail-engine/mail-mt.c @@ -215,9 +215,11 @@ mail_msg_unref (gpointer msg) g_mutex_unlock (&mail_msg_lock); /* Destroy the message from an idle callback - * so we know we're in the main loop thread. */ - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) mail_msg_free, mail_msg, NULL); + * so we know we're in the main loop thread. + * Prioritize ahead of GTK+ redraws. */ + g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, + (GSourceFunc) mail_msg_free, mail_msg, NULL); } } @@ -430,8 +432,9 @@ mail_msg_proxy (MailMsg *msg) G_LOCK (idle_source_id); if (idle_source_id == 0) - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - idle_source_id = g_idle_add_full (G_PRIORITY_DEFAULT, + /* Prioritize ahead of GTK+ redraws. */ + idle_source_id = g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, (GSourceFunc) mail_msg_idle_cb, NULL, NULL); G_UNLOCK (idle_source_id); } @@ -486,8 +489,9 @@ mail_msg_main_loop_push (gpointer msg) G_LOCK (idle_source_id); if (idle_source_id == 0) - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - idle_source_id = g_idle_add_full (G_PRIORITY_DEFAULT, + /* Prioritize ahead of GTK+ redraws. */ + idle_source_id = g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, (GSourceFunc) mail_msg_idle_cb, NULL, NULL); G_UNLOCK (idle_source_id); } -- cgit