[evolution/gnome-3-6] G_PRIORITY_HIGH_IDLE is sufficient to beat GTK+ redraws.



commit 51419ff0d41e034dcd59ab860184f5e4ba752708
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.
    
    (cherry picked from commit 60d1c3054aa60d02c763538d6b1f16d9d6ab6ade)

 em-format/e-mail-parser.c           |    5 +++--
 libemail-engine/e-mail-utils.c      |    6 ++++--
 libemail-engine/mail-folder-cache.c |    5 +++--
 libemail-utils/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/mail/e-mail-config-reader.c |    7 ++++---
 plugins/mail-to-task/mail-to-task.c |    6 ++++--
 shell/e-shell-searchbar.c           |    8 ++++++--
 11 files changed, 50 insertions(+), 30 deletions(-)
---
diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c
index 213e324..0a44798 100644
--- a/em-format/e-mail-parser.c
+++ b/em-format/e-mail-parser.c
@@ -660,8 +660,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 72a7473..52c5fb3 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -883,8 +883,10 @@ free_mail_cache_thread (gpointer user_data)
 
 	G_UNLOCK (photos_cache);
 
-	/* 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 5a02340..e6356cb 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-utils/mail-mt.c b/libemail-utils/mail-mt.c
index 38e4d7c..9e7d9d6 100644
--- a/libemail-utils/mail-mt.c
+++ b/libemail-utils/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 985beac..3e82aca 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -306,8 +306,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 9043a45..5594439 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1921,10 +1921,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 2e4ded6..d608b22 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -598,9 +598,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 520ea7b..668b718 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -5723,8 +5723,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/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c
index aacfbd9..3bbf766 100644
--- a/modules/mail/e-mail-config-reader.c
+++ b/modules/mail/e-mail-config-reader.c
@@ -84,10 +84,11 @@ static void
 mail_config_reader_constructed (GObject *object)
 {
 	/* Bind properties to settings from an idle callback so the
-	 * EMailReader interface has a chance to be initialized first. */
+	 * EMailReader interface has a chance to be initialized first.
+	 * Prioritize ahead of GTK+ redraws. */
 	g_idle_add_full (
-		G_PRIORITY_DEFAULT_IDLE,
-		(GSourceFunc) mail_config_reader_idle_cb,
+		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 6986468..add76e9 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -1014,8 +1014,10 @@ do_mail_to_event (AsyncData *data)
 			if (!e_cal_client_get_object_sync (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 4dd8b48..07a38f0 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -1544,10 +1544,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]