From cabfd4b9f6c9f5f8deaba750529308de7aafde5d Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Fri, 08 Feb 2013 11:37:46 +0000 Subject: Bug #683867 - Schedule actions with higher idle priority --- diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c index 36e6676..b13ebd9 100644 --- a/em-format/e-mail-parser.c +++ b/em-format/e-mail-parser.c @@ -660,9 +660,10 @@ e_mail_parser_wrap_as_attachment (EMailParser *parser, } /* e_attachment_load_async must be called from main thread */ - g_idle_add ( + g_idle_add_full (G_PRIORITY_HIGH, (GSourceFunc) load_attachment_idle, - g_object_ref (empa->attachment)); + g_object_ref (empa->attachment), + NULL); if (size != 0) { GFileInfo *fileinfo; diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c index f29b2f7..3043e06 100644 --- a/libemail-engine/e-mail-utils.c +++ b/libemail-engine/e-mail-utils.c @@ -883,7 +883,7 @@ free_mail_cache_thread (gpointer user_data) G_UNLOCK (photos_cache); - g_idle_add (free_mail_cache_idle, user_data); + g_idle_add_full (G_PRIORITY_HIGH, 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 5561bb6..9c9c17d 100644 --- a/libemail-engine/mail-folder-cache.c +++ b/libemail-engine/mail-folder-cache.c @@ -304,8 +304,8 @@ flush_updates (MailFolderCache *cache) if (g_queue_is_empty (&cache->priv->updates)) return; - cache->priv->update_id = g_idle_add ( - (GSourceFunc) flush_updates_idle_cb, cache); + cache->priv->update_id = g_idle_add_full (G_PRIORITY_DEFAULT, + (GSourceFunc) flush_updates_idle_cb, cache, NULL); } /* This is how unread counts work (and don't work): diff --git a/libemail-utils/mail-mt.c b/libemail-utils/mail-mt.c index 00b3272..f27a645 100644 --- a/libemail-utils/mail-mt.c +++ b/libemail-utils/mail-mt.c @@ -216,7 +216,7 @@ mail_msg_unref (gpointer msg) /* Destroy the message from an idle callback * so we know we're in the main loop thread. */ - g_idle_add ((GSourceFunc) mail_msg_free, mail_msg); + g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) mail_msg_free, mail_msg, NULL); } } @@ -429,8 +429,8 @@ mail_msg_proxy (MailMsg *msg) G_LOCK (idle_source_id); if (idle_source_id == 0) - idle_source_id = g_idle_add ( - (GSourceFunc) mail_msg_idle_cb, NULL); + idle_source_id = g_idle_add_full (G_PRIORITY_DEFAULT, + (GSourceFunc) mail_msg_idle_cb, NULL, NULL); G_UNLOCK (idle_source_id); } @@ -484,8 +484,8 @@ mail_msg_main_loop_push (gpointer msg) G_LOCK (idle_source_id); if (idle_source_id == 0) - idle_source_id = g_idle_add ( - (GSourceFunc) mail_msg_idle_cb, NULL); + idle_source_id = g_idle_add_full (G_PRIORITY_DEFAULT, + (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 ac72716..6b9d04f 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -306,7 +306,7 @@ mail_browser_message_list_built_cb (EMailBrowser *browser, g_return_if_fail (IS_MESSAGE_LIST (message_list)); if (!message_list_count (message_list)) - g_idle_add (close_on_idle_cb, browser); + g_idle_add_full (G_PRIORITY_DEFAULT, close_on_idle_cb, browser, NULL); } static gboolean diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 9da76863..7430a2e 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -1923,7 +1923,7 @@ e_mail_display_reload (EMailDisplay *display) /* Schedule reloading if neccessary */ display->priv->scheduled_reload = - g_idle_add ((GSourceFunc) do_reload_display, display); + g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) do_reload_display, display, NULL); } GtkAction * diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c index 47eeea2..66057c3 100644 --- a/mail/e-mail-ui-session.c +++ b/mail/e-mail-ui-session.c @@ -599,7 +599,7 @@ mail_ui_session_add_service (CamelSession *session, context->service = g_object_ref (service); g_idle_add_full ( - G_PRIORITY_DEFAULT_IDLE, + G_PRIORITY_DEFAULT, (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 0e9b39f..c15fa5d 100644 --- a/modules/itip-formatter/itip-view.c +++ b/modules/itip-formatter/itip-view.c @@ -5723,7 +5723,7 @@ view_response_cb (ItipView *view, send_item (pitip, view); break; case ITIP_VIEW_RESPONSE_OPEN: - g_idle_add (idle_open_cb, pitip); + g_idle_add_full (G_PRIORITY_DEFAULT, idle_open_cb, pitip, NULL); return; default: break; diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 553955c..1ff2ccc 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -1014,7 +1014,7 @@ 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; - g_idle_add ((GSourceFunc) do_manage_comp_idle, mc); + g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) do_manage_comp_idle, mc, NULL); oldmc = mc; diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c index 7975f74..5c8e050 100644 --- a/shell/e-shell-searchbar.c +++ b/shell/e-shell-searchbar.c @@ -1546,7 +1546,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar) /* Execute the search when we have time. */ g_object_ref (shell_view); searchbar->priv->state_dirty = FALSE; - g_idle_add (idle_execute_search, shell_view); + g_idle_add_full (G_PRIORITY_DEFAULT, idle_execute_search, shell_view, NULL); } void diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index 3d823e6..f9f1b8a 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -1078,7 +1078,7 @@ e_cert_manager_config_init (ECertManagerConfig *ecmc) * fully initialize itself and start its main loop before we * load certificates, since doing so may trigger a password * dialog, and dialogs require a main loop. */ - g_idle_add ((GSourceFunc) populate_ui, ecmc); + g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) populate_ui, ecmc, NULL); /* Disconnect cert-manager-notebook from it's window and attach it * to this ECertManagerConfig */ -- cgit v0.9.0.2 From c364610d5f3939d5ee263615a94626602a35a9ae Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 08 Feb 2013 17:26:30 +0000 Subject: Add comments around g_idle_add() changes --- diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c index b13ebd9..213e324 100644 --- a/em-format/e-mail-parser.c +++ b/em-format/e-mail-parser.c @@ -660,6 +660,7 @@ 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, (GSourceFunc) load_attachment_idle, g_object_ref (empa->attachment), diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c index 3043e06..72a7473 100644 --- a/libemail-engine/e-mail-utils.c +++ b/libemail-engine/e-mail-utils.c @@ -883,6 +883,7 @@ 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); return NULL; diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c index 9c9c17d..5a02340 100644 --- a/libemail-engine/mail-folder-cache.c +++ b/libemail-engine/mail-folder-cache.c @@ -304,6 +304,7 @@ 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, (GSourceFunc) flush_updates_idle_cb, cache, NULL); } diff --git a/libemail-utils/mail-mt.c b/libemail-utils/mail-mt.c index f27a645..38e4d7c 100644 --- a/libemail-utils/mail-mt.c +++ b/libemail-utils/mail-mt.c @@ -216,6 +216,7 @@ mail_msg_unref (gpointer msg) /* 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); } } @@ -429,6 +430,7 @@ 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, (GSourceFunc) mail_msg_idle_cb, NULL, NULL); G_UNLOCK (idle_source_id); @@ -484,6 +486,7 @@ 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, (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 6b9d04f..985beac 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -306,6 +306,7 @@ 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); } diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 7430a2e..9043a45 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -1922,6 +1922,7 @@ e_mail_display_reload (EMailDisplay *display) 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); } diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c index 66057c3..2e4ded6 100644 --- a/mail/e-mail-ui-session.c +++ b/mail/e-mail-ui-session.c @@ -598,6 +598,7 @@ 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) */ g_idle_add_full ( G_PRIORITY_DEFAULT, (GSourceFunc) mail_ui_session_add_service_cb, diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c index c15fa5d..520ea7b 100644 --- a/modules/itip-formatter/itip-view.c +++ b/modules/itip-formatter/itip-view.c @@ -5723,6 +5723,7 @@ 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); return; default: diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 1ff2ccc..6986468 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -1014,6 +1014,7 @@ 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); oldmc = mc; diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c index 5c8e050..4dd8b48 100644 --- a/shell/e-shell-searchbar.c +++ b/shell/e-shell-searchbar.c @@ -1546,6 +1546,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar) /* 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); } diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index f9f1b8a..978e497 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -1077,7 +1077,9 @@ e_cert_manager_config_init (ECertManagerConfig *ecmc) /* Run this in an idle callback so Evolution has a chance to * fully initialize itself and start its main loop before we * load certificates, since doing so may trigger a password - * dialog, and dialogs require a main loop. */ + * dialog, and dialogs require a main loop. + * Schedule with priority higher than gtk+ uses for animations + * (check docs for G_PRIORITY_HIGH_IDLE). */ g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) populate_ui, ecmc, NULL); /* Disconnect cert-manager-notebook from it's window and attach it -- cgit v0.9.0.2