diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-15 21:45:22 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-18 00:08:46 +0800 |
commit | 4de572679748a0586b9a9c3bf34c40ea5102e826 (patch) | |
tree | fa6815753e6fc1fd8f922b0a42c42a373256598c /libemail-engine/mail-folder-cache.c | |
parent | 079fc1a78d35d79350b7390ca3a76f65f9f22841 (diff) | |
download | gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar.gz gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar.bz2 gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar.lz gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar.xz gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.tar.zst gsoc2013-evolution-4de572679748a0586b9a9c3bf34c40ea5102e826.zip |
Add mail_folder_cache_has_folder_info().
Returns whether MailFolderCache has information about the folder
described by the CamelStore and folder name. This does not necessarily
mean it has the CamelFolder instance, but it at least has some meta-data
about it.
You can use this function as a folder existence test.
Diffstat (limited to 'libemail-engine/mail-folder-cache.c')
-rw-r--r-- | libemail-engine/mail-folder-cache.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c index 7c778cae2a..bf4e8b3fdb 100644 --- a/libemail-engine/mail-folder-cache.c +++ b/libemail-engine/mail-folder-cache.c @@ -1628,6 +1628,44 @@ mail_folder_cache_note_folder (MailFolderCache *cache, } /** + * mail_folder_cache_has_folder_info: + * @cache: a #MailFolderCache + * @store: a #CamelStore + * @folder_name: a folder name + * + * Returns whether @cache has information about the folder described by + * @store and @folder_name. This does not necessarily mean it has the + * #CamelFolder instance, but it at least has some meta-data about it. + * + * You can use this function as a folder existence test. + * + * Returns: %TRUE if @cache has folder info, %FALSE otherwise + **/ +gboolean +mail_folder_cache_has_folder_info (MailFolderCache *cache, + CamelStore *store, + const gchar *folder_name) +{ + StoreInfo *si; + gboolean has_info = FALSE; + + g_return_val_if_fail (MAIL_IS_FOLDER_CACHE (cache), FALSE); + g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE); + g_return_val_if_fail (folder_name != NULL, FALSE); + + if (cache->priv->stores == NULL) + return FALSE; + + g_rec_mutex_lock (&cache->priv->stores_mutex); + si = g_hash_table_lookup (cache->priv->stores, store); + if (si != NULL) + has_info = g_hash_table_contains (si->folders, folder_name); + g_rec_mutex_unlock (&cache->priv->stores_mutex); + + return has_info; +} + +/** * mail_folder_cache_get_folder_from_uri: * * Gets the #CamelFolder for the supplied @uri. |