From 147c817dd31ddee0ee097aa58ac3489c4d918f64 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 08 Feb 2013 19:08:00 +0000 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. (cherry picked from commit 820dcf6cfc43265c6376f15d983381c3087a5d20) --- diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index c54011a..fcb8e9e 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -1151,8 +1151,10 @@ async_report_idle (ECal *ecal, data->ecal = g_object_ref (ecal); data->error = error; - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - g_idle_add_full (G_PRIORITY_DEFAULT, idle_async_error_reply_cb, data, NULL); + /* Prioritize ahead of GTK+ redraws. */ + g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, + idle_async_error_reply_cb, data, NULL); } /** diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 8c2a31c..677f147 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -2782,7 +2782,7 @@ camel_folder_search_free (CamelFolder *folder, * Marks @folder as deleted and performs any required cleanup. * * This also emits the #CamelFolder::deleted signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. **/ void camel_folder_delete (CamelFolder *folder) @@ -2822,10 +2822,9 @@ camel_folder_delete (CamelFolder *folder) signal_data = g_slice_new0 (SignalData); signal_data->folder = g_object_ref (folder); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, folder_emit_deleted_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -2838,7 +2837,7 @@ camel_folder_delete (CamelFolder *folder) * Marks @folder as renamed. * * This also emits the #CamelFolder::renamed signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * NOTE: This is an internal function used by camel stores, no locking * is performed on the folder. @@ -2874,10 +2873,9 @@ camel_folder_rename (CamelFolder *folder, signal_data->folder = g_object_ref (folder); signal_data->folder_name = old_name; /* transfer ownership */ - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, folder_emit_renamed_cb, signal_data, (GDestroyNotify) signal_data_free); } diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c index 1d16189..b522df1 100644 --- a/camel/camel-imapx-server.c +++ b/camel/camel-imapx-server.c @@ -6284,8 +6284,10 @@ imapx_server_dispose (GObject *object) if (server->parser_thread) { if (server->parser_thread == g_thread_self ()) - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE) */ - g_idle_add_full (G_PRIORITY_HIGH, &join_helper, server->parser_thread, NULL); + /* Prioritize ahead of GTK+ redraws. */ + g_idle_add_full ( + G_PRIORITY_HIGH_IDLE, + &join_helper, server->parser_thread, NULL); else g_thread_join (server->parser_thread); server->parser_thread = NULL; diff --git a/camel/camel-service.c b/camel/camel-service.c index e23cb31..1fa28dd 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -408,10 +408,9 @@ service_queue_notify_connection_status (CamelService *service) session = camel_service_get_session (service); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, service_notify_connection_status_cb, g_object_ref (service), (GDestroyNotify) g_object_unref); diff --git a/camel/camel-session.c b/camel/camel-session.c index 48c39fb..7feaeb5 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -53,9 +53,8 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), CAMEL_TYPE_SESSION, CamelSessionPrivate)) -/* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ -#define JOB_PRIORITY G_PRIORITY_DEFAULT +/* Prioritize ahead of GTK+ redraws. */ +#define JOB_PRIORITY G_PRIORITY_HIGH_IDLE #define d(x) diff --git a/camel/camel-store.c b/camel/camel-store.c index 7015fd2..e03ed2c 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -1268,7 +1268,7 @@ camel_store_error_quark (void) * @folder_info: information about the created folder * * Emits the #CamelStore::folder-created signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -1290,10 +1290,9 @@ camel_store_folder_created (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder_info = camel_folder_info_clone (folder_info); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, store_emit_folder_created_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1304,7 +1303,7 @@ camel_store_folder_created (CamelStore *store, * @folder_info: information about the deleted folder * * Emits the #CamelStore::folder-deleted signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -1326,10 +1325,9 @@ camel_store_folder_deleted (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder_info = camel_folder_info_clone (folder_info); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, store_emit_folder_deleted_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1340,7 +1338,7 @@ camel_store_folder_deleted (CamelStore *store, * @folder: the #CamelFolder that was opened * * Emits the #CamelStore::folder-opened signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -1362,10 +1360,9 @@ camel_store_folder_opened (CamelStore *store, signal_data->store = g_object_ref (store); signal_data->folder = g_object_ref (folder); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, store_emit_folder_opened_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -1377,7 +1374,7 @@ camel_store_folder_opened (CamelStore *store, * @folder_info: information about the renamed folder * * Emits the #CamelStore::folder-renamed signal from an idle source on - * the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -1402,10 +1399,9 @@ camel_store_folder_renamed (CamelStore *store, signal_data->folder_info = camel_folder_info_clone (folder_info); signal_data->folder_name = g_strdup (old_name); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, store_emit_folder_renamed_cb, signal_data, (GDestroyNotify) signal_data_free); } diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c index 470a4e0..ef14132 100644 --- a/camel/camel-subscribable.c +++ b/camel/camel-subscribable.c @@ -611,7 +611,7 @@ camel_subscribable_unsubscribe_folder_finish (CamelSubscribable *subscribable, * @folder_info: information about the subscribed folder * * Emits the #CamelSubscribable::folder-subscribed signal from an idle source - * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * on the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -635,10 +635,9 @@ camel_subscribable_folder_subscribed (CamelSubscribable *subscribable, signal_data->subscribable = g_object_ref (subscribable); signal_data->folder_info = camel_folder_info_clone (folder_info); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, subscribable_emit_folder_subscribed_cb, signal_data, (GDestroyNotify) signal_data_free); } @@ -649,7 +648,7 @@ camel_subscribable_folder_subscribed (CamelSubscribable *subscribable, * @folder_info: information about the unsubscribed folder * * Emits the #CamelSubscribable::folder-unsubscribed signal from an idle source - * on the main loop. The idle source's priority is #G_PRIORITY_DEFAULT. + * on the main loop. The idle source's priority is #G_PRIORITY_HIGH_IDLE. * * This function is only intended for Camel providers. * @@ -673,10 +672,9 @@ camel_subscribable_folder_unsubscribed (CamelSubscribable *subscribable, signal_data->subscribable = g_object_ref (subscribable); signal_data->folder_info = camel_folder_info_clone (folder_info); - /* schedule with priority higher than gtk+ uses for animations (check docs for G_PRIORITY_HIGH_IDLE), - same as GAsyncResult, where this operation is quite similar to it anyway */ + /* Prioritize ahead of GTK+ redraws. */ camel_session_idle_add ( - session, G_PRIORITY_DEFAULT, + session, G_PRIORITY_HIGH_IDLE, subscribable_emit_folder_unsubscribed_cb, signal_data, (GDestroyNotify) signal_data_free); } -- cgit v0.9.0.2