aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-27 07:36:56 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-27 23:59:55 +0800
commit4a06e1bb633e392b049942ef28360d3830e78420 (patch)
tree6feec76d0ba79a9e1f75b7d4892ec839492a6fce
parent667585134e2b248e3d93f2f55cdee86b71e5432f (diff)
downloadgsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar.gz
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar.bz2
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar.lz
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar.xz
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.tar.zst
gsoc2013-evolution-4a06e1bb633e392b049942ef28360d3830e78420.zip
Remove emu_free_mail_cache().
No longer needed, since the resources it frees are no longer used.
-rw-r--r--libemail-engine/e-mail-utils.c104
-rw-r--r--libemail-engine/e-mail-utils.h2
-rw-r--r--mail/e-mail-backend.c14
3 files changed, 1 insertions, 119 deletions
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index 74aecf19ec..21d53b65a3 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -608,110 +608,6 @@ em_utils_in_addressbook (ESourceRegistry *registry,
registry, addr, local_only, NULL, NULL, cancellable);
}
-typedef struct _PhotoInfo {
- gchar *address;
- EContactPhoto *photo;
-} PhotoInfo;
-
-static void
-emu_free_photo_info (PhotoInfo *pi)
-{
- if (!pi)
- return;
-
- if (pi->address)
- g_free (pi->address);
- if (pi->photo)
- e_contact_photo_free (pi->photo);
- g_free (pi);
-}
-
-static ECancellableMutex photos_cache_lock;
-static GSList *photos_cache = NULL; /* list of PhotoInfo-s */
-
-struct FreeMailCacheData
-{
- GDestroyNotify done_cb;
- gpointer user_data;
-};
-
-static gboolean
-free_mail_cache_idle (gpointer user_data)
-{
- struct FreeMailCacheData *fmc = user_data;
-
- g_return_val_if_fail (fmc != NULL, FALSE);
-
- if (fmc->done_cb)
- fmc->done_cb (fmc->user_data);
- g_free (fmc);
-
- return FALSE;
-}
-
-static gpointer
-free_mail_cache_thread (gpointer user_data)
-{
- g_return_val_if_fail (user_data != NULL, NULL);
-
- if (e_cancellable_mutex_lock (&contact_cache_lock, NULL)) {
- if (emu_books_hash) {
- g_hash_table_destroy (emu_books_hash);
- emu_books_hash = NULL;
- }
-
- if (emu_broken_books_hash) {
- g_hash_table_destroy (emu_broken_books_hash);
- emu_broken_books_hash = NULL;
- }
-
- if (contact_cache) {
- g_hash_table_destroy (contact_cache);
- contact_cache = NULL;
- }
-
- e_cancellable_mutex_unlock (&contact_cache_lock);
- }
-
- if (e_cancellable_mutex_lock (&photos_cache_lock, NULL)) {
- g_slist_foreach (photos_cache, (GFunc) emu_free_photo_info, NULL);
- g_slist_free (photos_cache);
- photos_cache = NULL;
-
- e_cancellable_mutex_unlock (&photos_cache_lock);
- }
-
- /* Prioritize ahead of GTK+ redraws. */
- g_idle_add_full (
- G_PRIORITY_HIGH_IDLE,
- free_mail_cache_idle, user_data, NULL);
-
- return NULL;
-}
-
-/* frees all data created by call of em_utils_in_addressbook() or
- * em_utils_contact_photo(); done_cb is called when freeing is done,
- * in an idle callback
- */
-void
-emu_free_mail_cache (GDestroyNotify done_cb,
- gpointer user_data)
-{
- struct FreeMailCacheData *fmc;
- GThread *thread;
-
- G_LOCK (search_addressbook_cancellables);
- g_slist_foreach (search_addressbook_cancellables, (GFunc) g_cancellable_cancel, NULL);
- G_UNLOCK (search_addressbook_cancellables);
-
- fmc = g_new0 (struct FreeMailCacheData, 1);
- fmc->done_cb = done_cb;
- fmc->user_data = user_data;
-
- thread = g_thread_new (NULL, free_mail_cache_thread, fmc);
- g_thread_unref (thread);
-}
-
static ESource *
guess_mail_account_from_folder (ESourceRegistry *registry,
CamelFolder *folder,
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 20a5ee0512..95a6bc62ce 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -58,8 +58,6 @@ ESource * em_utils_guess_mail_identity_with_recipients
ESource * em_utils_ref_mail_identity_for_store
(ESourceRegistry *registry,
CamelStore *store);
-void emu_free_mail_cache (GDestroyNotify done_cb,
- gpointer user_data);
void em_utils_uids_free (GPtrArray *uids);
gboolean em_utils_is_local_delivery_mbox_file
(CamelURL *url);
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index fc368f0c8b..cfd6f0a349 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -265,16 +265,6 @@ mail_backend_poll_to_quit (EActivity *activity)
return mail_msg_active ();
}
-/* Helper for mail_backend_prepare_for_quit_cb() */
-static void
-mail_backend_ready_to_quit (EActivity *activity)
-{
- emu_free_mail_cache (g_object_unref, g_object_ref (activity));
-
- /* Do this last. It may terminate the process. */
- g_object_unref (activity);
-}
-
static gboolean
mail_backend_service_is_enabled (ESourceRegistry *registry,
CamelService *service)
@@ -368,9 +358,7 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL,
(GSourceFunc) mail_backend_poll_to_quit,
g_object_ref (activity),
- (GDestroyNotify) mail_backend_ready_to_quit);
- else
- mail_backend_ready_to_quit (g_object_ref (activity));
+ (GDestroyNotify) g_object_unref);
}
static void