diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-08 12:47:40 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-12-08 13:32:22 +0800 |
commit | e3b8f3fbb3f1cbd981e8a6382365cd699a95c149 (patch) | |
tree | 801149129483001b9c322e264919a16466e9471b /modules/mail | |
parent | 60978976388e00a611f2aeb87c9b27e67a2b0f05 (diff) | |
download | gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar.gz gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar.bz2 gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar.lz gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar.xz gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.tar.zst gsoc2013-evolution-e3b8f3fbb3f1cbd981e8a6382365cd699a95c149.zip |
Move folder URI caching to MailFolderCache.
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 74a69a9127..02a31c20de 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -224,6 +224,7 @@ mail_shell_view_execute_search (EShellView *shell_view) EActionComboBox *combo_box; EMailBackend *backend; EMailSession *session; + MailFolderCache *cache; EMFolderTree *folder_tree; GtkWidget *message_list; EFilterRule *rule; @@ -240,6 +241,7 @@ mail_shell_view_execute_search (EShellView *shell_view) GString *string; GList *list, *iter; GSList *search_strings = NULL; + GQueue queue = G_QUEUE_INIT; const gchar *text; gboolean valid; gchar *query; @@ -564,26 +566,14 @@ all_accounts: CAMEL_STORE_VEE_FOLDER_AUTO); priv->search_account_all = search_folder; - /* Add local folders. */ - iter = mail_vfolder_get_sources_local (); - while (iter != NULL) { - const gchar *folder_uri = iter->data; - /* FIXME Not passing a GCancellable or GError here. */ - folder = e_mail_session_uri_to_folder_sync ( - E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL); + cache = e_mail_session_get_folder_cache (session); + mail_folder_cache_get_local_folder_uris (cache, &queue); + mail_folder_cache_get_remote_folder_uris (cache, &queue); - if (folder != NULL) - list = g_list_append (list, folder); - else - g_warning ("Could not open vfolder source: %s", folder_uri); - - iter = g_list_next (iter); - } + /* Add all available local and remote folders. */ + while (!g_queue_is_empty (&queue)) { + gchar *folder_uri = g_queue_pop_head (&queue); - /* Add remote folders. */ - iter = mail_vfolder_get_sources_remote (); - while (iter != NULL) { - const gchar *folder_uri = iter->data; /* FIXME Not passing a GCancellable or GError here. */ folder = e_mail_session_uri_to_folder_sync ( E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL); @@ -593,7 +583,7 @@ all_accounts: else g_warning ("Could not open vfolder source: %s", folder_uri); - iter = g_list_next (iter); + g_free (folder_uri); } camel_vee_folder_set_expression (search_folder, query); |