[evolution] G_PRIORITY_HIGH_IDLE is sufficient to beat GTK+ redraws.



commit 60d1c3054aa60d02c763538d6b1f16d9d6ab6ade
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Feb 8 14:21:42 2013 -0500

    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.

 em-format/e-mail-parser.c                 |    5 +++--
 libemail-engine/e-mail-utils.c            |    6 ++++--
 libemail-engine/mail-folder-cache.c       |    5 +++--
 libemail-engine/mail-mt.c                 |   18 +++++++++++-------
 mail/e-mail-browser.c                     |    6 ++++--
 mail/e-mail-display.c                     |    9 +++++----
 mail/e-mail-ui-session.c                  |    4 ++--
 modules/itip-formatter/itip-view.c        |    6 ++++--
 modules/settings/e-settings-mail-reader.c |    6 +++---
 plugins/mail-to-task/mail-to-task.c       |    6 ++++--
 shell/e-shell-searchbar.c                 |    8 ++++++--
 11 files changed, 49 insertions(+), 30 deletions(-)
---
diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c
index e569560..294b058 100644
--- a/em-format/e-mail-parser.c
+++ b/em-format/e-mail-parser.c
@@ -723,8 +723,9 @@ e_mail_parser_wrap_as_attachment (EMailParser *parser,
 	}
 
 	/* e_attachment_load_async must be called from main thread */
-	/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-	g_idle_add_full (G_PRIORITY_HIGH,
+	/* Prioritize ahead of GTK+ redraws. */
+	g_idle_add_full (
+		G_PRIORITY_HIGH_IDLE,
 		(GSourceFunc) load_attachment_idle,
 		g_object_ref (empa->attachment),
 		NULL);
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index e7f414a..6614ecf 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 89c6a52..ad8a5b1 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 ef443d4..4cec5a8 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);
 }
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index e708f29..bdebf26 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -302,8 +302,10 @@ mail_browser_message_list_built_cb (EMailBrowser *browser,
 	g_return_if_fail (IS_MESSAGE_LIST (message_list));
 
 	if (!message_list_count (message_list))
-		/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-		g_idle_add_full (G_PRIORITY_DEFAULT, close_on_idle_cb, browser, NULL);
+		/* Prioritize ahead of GTK+ redraws. */
+		g_idle_add_full (
+			G_PRIORITY_HIGH_IDLE,
+			close_on_idle_cb, browser, NULL);
 }
 
 static gboolean
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 26415f2..0a478b0 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1924,10 +1924,11 @@ e_mail_display_reload (EMailDisplay *display)
 	if (display->priv->scheduled_reload > 0)
 		return;
 
-	/* Schedule reloading if neccessary */
-	/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-	display->priv->scheduled_reload =
-		g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) do_reload_display, display, NULL);
+	/* Schedule reloading if neccessary.
+	 * Prioritize ahead of GTK+ redraws. */
+	display->priv->scheduled_reload = g_idle_add_full (
+		G_PRIORITY_HIGH_IDLE,
+		(GSourceFunc) do_reload_display, display, NULL);
 }
 
 GtkAction *
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index 6324a29..b9dc11e 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -596,9 +596,9 @@ mail_ui_session_add_service (CamelSession *session,
 		context->session = g_object_ref (session);
 		context->service = g_object_ref (service);
 
-		/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
+		/* Prioritize ahead of GTK+ redraws. */
 		g_idle_add_full (
-			G_PRIORITY_DEFAULT,
+			G_PRIORITY_HIGH_IDLE,
 			(GSourceFunc) mail_ui_session_add_service_cb,
 			context, (GDestroyNotify) source_context_free);
 	}
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index c1712ab..d282549 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -5705,8 +5705,10 @@ view_response_cb (ItipView *view,
 			send_item (pitip, view);
 			break;
 		case ITIP_VIEW_RESPONSE_OPEN:
-			/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-			g_idle_add_full (G_PRIORITY_DEFAULT, idle_open_cb, pitip, NULL);
+			/* Prioritize ahead of GTK+ redraws. */
+			g_idle_add_full (
+				G_PRIORITY_HIGH_IDLE,
+				idle_open_cb, pitip, NULL);
 			return;
 		default:
 			break;
diff --git a/modules/settings/e-settings-mail-reader.c b/modules/settings/e-settings-mail-reader.c
index 6c88e8f..17ab57b 100644
--- a/modules/settings/e-settings-mail-reader.c
+++ b/modules/settings/e-settings-mail-reader.c
@@ -84,10 +84,10 @@ static void
 settings_mail_reader_constructed (GObject *object)
 {
 	/* Bind properties to settings from an idle callback so the
-	 * EMailReader interface has a chance to be initialized first. */
-	/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
+	 * EMailReader interface has a chance to be initialized first.
+	 * Prioritize ahead of GTK+ redraws. */
 	g_idle_add_full (
-		G_PRIORITY_DEFAULT,
+		G_PRIORITY_HIGH_IDLE,
 		(GSourceFunc) settings_mail_reader_idle_cb,
 		g_object_ref (object),
 		(GDestroyNotify) g_object_unref);
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 5cdb2bf..34473bc 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -1011,8 +1011,10 @@ do_mail_to_event (AsyncData *data)
 			if (!e_cal_client_get_object_sync (E_CAL_CLIENT (client), icalcomponent_get_uid (icalcomp), NULL, &(mc->stored_comp), NULL, NULL))
 				mc->stored_comp = NULL;
 
-			/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-			g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) do_manage_comp_idle, mc, NULL);
+			/* Prioritize ahead of GTK+ redraws. */
+			g_idle_add_full (
+				G_PRIORITY_HIGH_IDLE,
+				(GSourceFunc) do_manage_comp_idle, mc, NULL);
 
 			oldmc = mc;
 
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 107a30a..262b082 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -1733,10 +1733,14 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
 	gtk_action_unblock_activate (action);
 
 	/* Execute the search when we have time. */
+
 	g_object_ref (shell_view);
 	searchbar->priv->state_dirty = FALSE;
-	/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */
-	g_idle_add_full (G_PRIORITY_DEFAULT, idle_execute_search, shell_view, NULL);
+
+	/* Prioritize ahead of GTK+ redraws. */
+	g_idle_add_full (
+		G_PRIORITY_HIGH_IDLE,
+		idle_execute_search, shell_view, NULL);
 }
 
 void


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