[evolution-data-server/wip/camel-more-gobject] Seal CamelFolder properties
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/camel-more-gobject] Seal CamelFolder properties
- Date: Wed, 2 Nov 2016 22:19:39 +0000 (UTC)
commit 2d3ec887a2a55da9f132a29be9f39eadd7836443
Author: Milan Crha <mcrha redhat com>
Date: Wed Nov 2 23:19:25 2016 +0100
Seal CamelFolder properties
src/camel/camel-folder-search.c | 20 +-
src/camel/camel-folder-thread.c | 4 +-
src/camel/camel-folder.c | 181 ++++++++++++++------
src/camel/camel-folder.h | 13 +-
src/camel/camel-store.c | 4 +-
src/camel/camel-vee-folder.c | 49 +++---
src/camel/camel-vee-summary.c | 46 +++---
src/camel/camel-vee-summary.h | 4 +-
src/camel/camel-vtrash-folder.c | 2 +-
.../providers/imapx/camel-imapx-conn-manager.c | 2 +-
src/camel/providers/imapx/camel-imapx-folder.c | 84 ++++++----
src/camel/providers/imapx/camel-imapx-search.c | 4 +-
src/camel/providers/imapx/camel-imapx-server.c | 124 +++++++-------
src/camel/providers/imapx/camel-imapx-store.c | 16 +-
src/camel/providers/imapx/camel-imapx-utils.c | 10 +-
src/camel/providers/local/camel-local-folder.c | 42 +++--
src/camel/providers/local/camel-maildir-folder.c | 28 ++--
src/camel/providers/local/camel-mbox-folder.c | 28 ++--
src/camel/providers/local/camel-mh-folder.c | 6 +-
src/camel/providers/local/camel-spool-folder.c | 5 +-
src/camel/providers/nntp/camel-nntp-folder.c | 20 +-
src/camel/providers/nntp/camel-nntp-summary.c | 4 +-
22 files changed, 402 insertions(+), 294 deletions(-)
---
diff --git a/src/camel/camel-folder-search.c b/src/camel/camel-folder-search.c
index 4e358fe..3aa9fc4 100644
--- a/src/camel/camel-folder-search.c
+++ b/src/camel/camel-folder-search.c
@@ -882,13 +882,13 @@ folder_search_match_all (CamelSExp *sexp,
v = search->summary_set ? search->summary_set : search->summary;
if (!CAMEL_IS_VEE_FOLDER (search->folder)) {
- camel_folder_summary_prepare_fetch_all (search->folder->summary, search->priv->error);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (search->folder),
search->priv->error);
}
for (i = 0; i < v->len && !g_cancellable_is_cancelled (search->priv->cancellable); i++) {
const gchar *uid;
- search->current = camel_folder_summary_get (search->folder->summary, v->pdata[i]);
+ search->current = camel_folder_summary_get (camel_folder_get_folder_summary (search->folder),
v->pdata[i]);
if (!search->current)
continue;
uid = camel_message_info_get_uid (search->current);
@@ -1817,8 +1817,8 @@ do_search_in_memory (CamelFolder *search_in_folder,
gint i;
if (search_in_folder &&
- search_in_folder->summary &&
- (search_in_folder->summary->flags & CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY) != 0)
+ camel_folder_get_folder_summary (search_in_folder) &&
+ (camel_folder_get_folder_summary (search_in_folder)->flags & CAMEL_FOLDER_SUMMARY_IN_MEMORY_ONLY)
!= 0)
return TRUE;
if (!expr)
@@ -1900,8 +1900,8 @@ camel_folder_search_count (CamelFolderSearch *search,
if (do_search_in_memory (search->folder, expr, &sql_query)) {
/* setup our search list only contains those we're interested in */
search->summary = camel_folder_get_summary (search->folder);
- if (search->folder->summary)
- camel_folder_summary_prepare_fetch_all (search->folder->summary, NULL);
+ if (camel_folder_get_folder_summary (search->folder))
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary
(search->folder), NULL);
summary_set = search->summary;
@@ -1959,7 +1959,7 @@ camel_folder_search_count (CamelFolderSearch *search,
parent_store = camel_folder_get_parent_store (search->folder);
/* Sync the db, so that we search the db for changes */
- camel_folder_summary_save_to_db (search->folder->summary, error);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (search->folder), error);
dd (printf ("sexp is : [%s]\n", expr));
tmp1 = camel_db_sqlize_string (full_name);
@@ -2072,8 +2072,8 @@ camel_folder_search_search (CamelFolderSearch *search,
g_ptr_array_add (search->summary_set, search->summary->pdata[i]);
g_hash_table_destroy (uids_hash);
} else {
- if (search->folder->summary)
- camel_folder_summary_prepare_fetch_all (search->folder->summary, NULL);
+ if (camel_folder_get_folder_summary (search->folder))
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary
(search->folder), NULL);
summary_set = search->summary;
}
@@ -2133,7 +2133,7 @@ camel_folder_search_search (CamelFolderSearch *search,
parent_store = camel_folder_get_parent_store (search->folder);
/* Sync the db, so that we search the db for changes */
- camel_folder_summary_save_to_db (search->folder->summary, error);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (search->folder), error);
dd (printf ("sexp is : [%s]\n", expr));
tmp1 = camel_db_sqlize_string (full_name);
diff --git a/src/camel/camel-folder-thread.c b/src/camel/camel-folder-thread.c
index b3183f5..2b3d78e 100644
--- a/src/camel/camel-folder-thread.c
+++ b/src/camel/camel-folder-thread.c
@@ -685,12 +685,12 @@ camel_folder_thread_messages_new (CamelFolder *folder,
thread->node_chunks = camel_memchunk_new (32, sizeof (CamelFolderThreadNode));
thread->folder = g_object_ref (folder);
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
thread->summary = summary = g_ptr_array_new ();
/* prefer given order from the summary order */
if (!uids) {
- fsummary = camel_folder_summary_get_array (folder->summary);
+ fsummary = camel_folder_summary_get_array (camel_folder_get_folder_summary (folder));
uids = fsummary;
}
diff --git a/src/camel/camel-folder.c b/src/camel/camel-folder.c
index d297527..d036519 100644
--- a/src/camel/camel-folder.c
+++ b/src/camel/camel-folder.c
@@ -50,6 +50,9 @@ typedef struct _SignalClosure SignalClosure;
typedef struct _FolderFilterData FolderFilterData;
struct _CamelFolderPrivate {
+ CamelFolderSummary *summary;
+ CamelFolderFlags folder_flags;
+
GRecMutex lock;
GMutex change_lock;
/* must require the 'change_lock' to access this */
@@ -247,7 +250,7 @@ folder_filter_data_free_thread (gpointer user_data)
camel_folder_free_deep (data->folder, data->notjunk);
/* XXX Too late to pass a GError here. */
- camel_folder_summary_save_to_db (data->folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (data->folder), NULL);
camel_folder_thaw (data->folder);
g_object_unref (data->folder);
@@ -294,7 +297,7 @@ folder_filter (CamelSession *session,
/* Reset junk learn flag so that we don't process it again */
if (data->junk) {
for (i = 0; i < data->junk->len; i++) {
- info = camel_folder_summary_get (data->folder->summary, data->junk->pdata[i]);
+ info = camel_folder_summary_get (camel_folder_get_folder_summary (data->folder),
data->junk->pdata[i]);
if (!info)
continue;
@@ -305,7 +308,7 @@ folder_filter (CamelSession *session,
if (data->notjunk) {
for (i = 0; i < data->notjunk->len; i++) {
- info = camel_folder_summary_get (data->folder->summary, data->notjunk->pdata[i]);
+ info = camel_folder_summary_get (camel_folder_get_folder_summary (data->folder),
data->notjunk->pdata[i]);
if (!info)
continue;
@@ -482,6 +485,7 @@ folder_transfer_message_to (CamelFolder *source,
{
CamelMimeMessage *msg;
CamelMessageInfo *minfo, *info;
+ guint32 source_folder_flags;
GError *local_error = NULL;
/* Default implementation. */
@@ -490,19 +494,21 @@ folder_transfer_message_to (CamelFolder *source,
if (!msg)
return;
+ source_folder_flags = camel_folder_get_flags (source);
+
/* if its deleted we poke the flags, so we need to copy the messageinfo */
- if ((source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
- && (minfo = camel_folder_get_message_info (source, uid))) {
+ if ((source_folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
+ && (minfo = camel_folder_get_message_info (source, uid))) {
info = camel_message_info_clone (minfo, NULL);
g_clear_object (&minfo);
} else
info = camel_message_info_new_from_header (NULL, ((CamelMimePart *) msg)->headers);
/* unset deleted flag when transferring from trash folder */
- if ((source->folder_flags & CAMEL_FOLDER_IS_TRASH) != 0)
+ if ((source_folder_flags & CAMEL_FOLDER_IS_TRASH) != 0)
camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED, 0);
/* unset junk flag when transferring from junk folder */
- if ((source->folder_flags & CAMEL_FOLDER_IS_JUNK) != 0)
+ if ((source_folder_flags & CAMEL_FOLDER_IS_JUNK) != 0)
camel_message_info_set_flags (info, CAMEL_MESSAGE_JUNK, 0);
camel_folder_append_message_sync (
@@ -664,10 +670,7 @@ folder_dispose (GObject *object)
folder->priv->parent_store = NULL;
}
- if (folder->summary) {
- g_object_unref (folder->summary);
- folder->summary = NULL;
- }
+ g_clear_object (&folder->priv->summary);
/* Chain up to parent's dispose () method. */
G_OBJECT_CLASS (camel_folder_parent_class)->dispose (object);
@@ -701,15 +704,15 @@ folder_finalize (GObject *object)
static gint
folder_get_message_count (CamelFolder *folder)
{
- g_return_val_if_fail (folder->summary != NULL, -1);
+ g_return_val_if_fail (folder->priv->summary != NULL, -1);
- return camel_folder_summary_count (folder->summary);
+ return camel_folder_summary_count (folder->priv->summary);
}
static guint32
folder_get_permanent_flags (CamelFolder *folder)
{
- return folder->permanent_flags;
+ return 0;
}
static guint32
@@ -719,9 +722,9 @@ folder_get_message_flags (CamelFolder *folder,
CamelMessageInfo *info;
guint32 flags;
- g_return_val_if_fail (folder->summary != NULL, 0);
+ g_return_val_if_fail (folder->priv->summary != NULL, 0);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return 0;
@@ -740,9 +743,9 @@ folder_set_message_flags (CamelFolder *folder,
CamelMessageInfo *info;
gint res;
- g_return_val_if_fail (folder->summary != NULL, FALSE);
+ g_return_val_if_fail (folder->priv->summary != NULL, FALSE);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return FALSE;
@@ -760,9 +763,9 @@ folder_get_message_user_flag (CamelFolder *folder,
CamelMessageInfo *info;
gboolean ret;
- g_return_val_if_fail (folder->summary != NULL, FALSE);
+ g_return_val_if_fail (folder->priv->summary != NULL, FALSE);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return FALSE;
@@ -780,9 +783,9 @@ folder_set_message_user_flag (CamelFolder *folder,
{
CamelMessageInfo *info;
- g_return_if_fail (folder->summary != NULL);
+ g_return_if_fail (folder->priv->summary != NULL);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return;
@@ -798,9 +801,9 @@ folder_get_message_user_tag (CamelFolder *folder,
CamelMessageInfo *info;
const gchar *ret;
- g_return_val_if_fail (folder->summary != NULL, NULL);
+ g_return_val_if_fail (folder->priv->summary != NULL, NULL);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return NULL;
@@ -818,9 +821,9 @@ folder_set_message_user_tag (CamelFolder *folder,
{
CamelMessageInfo *info;
- g_return_if_fail (folder->summary != NULL);
+ g_return_if_fail (folder->priv->summary != NULL);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (folder->priv->summary, uid);
if (info == NULL)
return;
@@ -831,9 +834,9 @@ folder_set_message_user_tag (CamelFolder *folder,
static GPtrArray *
folder_get_uids (CamelFolder *folder)
{
- g_return_val_if_fail (folder->summary != NULL, NULL);
+ g_return_val_if_fail (folder->priv->summary != NULL, NULL);
- return camel_folder_summary_get_array (folder->summary);
+ return camel_folder_summary_get_array (folder->priv->summary);
}
static GPtrArray *
@@ -884,9 +887,9 @@ folder_sort_uids (CamelFolder *folder,
static GPtrArray *
folder_get_summary (CamelFolder *folder)
{
- g_return_val_if_fail (folder->summary != NULL, NULL);
+ g_return_val_if_fail (folder->priv->summary != NULL, NULL);
- return camel_folder_summary_get_array (folder->summary);
+ return camel_folder_summary_get_array (folder->priv->summary);
}
static void
@@ -911,16 +914,16 @@ static CamelMessageInfo *
folder_get_message_info (CamelFolder *folder,
const gchar *uid)
{
- g_return_val_if_fail (folder->summary != NULL, NULL);
+ g_return_val_if_fail (folder->priv->summary != NULL, NULL);
- return camel_folder_summary_get (folder->summary, uid);
+ return camel_folder_summary_get (folder->priv->summary, uid);
}
static void
folder_delete (CamelFolder *folder)
{
- if (folder->summary)
- camel_folder_summary_clear (folder->summary, NULL);
+ if (folder->priv->summary)
+ camel_folder_summary_clear (folder->priv->summary, NULL);
}
static void
@@ -945,8 +948,8 @@ folder_freeze (CamelFolder *folder)
g_mutex_lock (&folder->priv->change_lock);
folder->priv->frozen++;
- if (folder->summary)
- g_object_freeze_notify (G_OBJECT (folder->summary));
+ if (folder->priv->summary)
+ g_object_freeze_notify (G_OBJECT (folder->priv->summary));
d (printf ("freeze (%p '%s') = %d\n", folder, folder->full_name, folder->priv->frozen));
g_mutex_unlock (&folder->priv->change_lock);
@@ -962,8 +965,8 @@ folder_thaw (CamelFolder *folder)
g_mutex_lock (&folder->priv->change_lock);
folder->priv->frozen--;
- if (folder->summary)
- g_object_thaw_notify (G_OBJECT (folder->summary));
+ if (folder->priv->summary)
+ g_object_thaw_notify (G_OBJECT (folder->priv->summary));
d (printf ("thaw (%p '%s') = %d\n", folder, folder->full_name, folder->priv->frozen));
@@ -979,8 +982,8 @@ folder_thaw (CamelFolder *folder)
camel_folder_changed (folder, info);
camel_folder_change_info_free (info);
- if (folder->summary)
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ if (folder->priv->summary)
+ camel_folder_summary_save_to_db (folder->priv->summary, NULL);
}
}
@@ -1116,7 +1119,7 @@ folder_changed (CamelFolder *folder,
guint32 flags;
for (i = 0; i < info->uid_changed->len; i++) {
- flags = camel_folder_summary_get_info_flags (folder->summary,
info->uid_changed->pdata[i]);
+ flags = camel_folder_summary_get_info_flags (folder->priv->summary,
info->uid_changed->pdata[i]);
if (flags != (~0) && (flags & CAMEL_MESSAGE_JUNK_LEARN) != 0) {
if (flags & CAMEL_MESSAGE_JUNK) {
if (!junk)
@@ -1133,11 +1136,11 @@ folder_changed (CamelFolder *folder,
}
}
- if ((folder->folder_flags & (CAMEL_FOLDER_FILTER_RECENT | CAMEL_FOLDER_FILTER_JUNK))
+ if ((camel_folder_get_flags (folder) & (CAMEL_FOLDER_FILTER_RECENT | CAMEL_FOLDER_FILTER_JUNK))
&& p->uid_filter->len > 0)
driver = camel_session_get_filter_driver (
session,
- (folder->folder_flags & CAMEL_FOLDER_FILTER_RECENT)
+ (camel_folder_get_flags (folder) & CAMEL_FOLDER_FILTER_RECENT)
? "incoming" : "junktest", NULL);
if (driver) {
@@ -1644,6 +1647,46 @@ camel_folder_get_parent_store (CamelFolder *folder)
}
/**
+ * camel_folder_get_folder_summary:
+ * @folder: a #CamelFolder
+ *
+ * Returns: (transfer none): a #CamelFolderSummary of the folder
+ *
+ * Since: 3.24
+ **/
+CamelFolderSummary *
+camel_folder_get_folder_summary (CamelFolder *folder)
+{
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
+
+ return folder->priv->summary;
+}
+
+/**
+ * camel_folder_take_folder_summary:
+ * @folder: a #CamelFolder
+ * @summary: (transfer full): a #CamelFolderSummary
+ *
+ * Sets a #CamelFolderSummary of the folder. It consumes the @summary.
+ *
+ * This is supposed to be called only by the descendants of
+ * the #CamelFolder and only at the construction time. Calling
+ * this function twice yeilds to an error.
+ *
+ * Since: 3.24
+ **/
+void
+camel_folder_take_folder_summary (CamelFolder *folder,
+ CamelFolderSummary *summary)
+{
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
+ g_return_if_fail (folder->priv->summary == NULL);
+
+ folder->priv->summary = summary;
+}
+
+/**
* camel_folder_get_message_count:
* @folder: a #CamelFolder
*
@@ -1675,9 +1718,9 @@ gint
camel_folder_get_unread_message_count (CamelFolder *folder)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
- g_return_val_if_fail (folder->summary != NULL, -1);
+ g_return_val_if_fail (folder->priv->summary != NULL, -1);
- return camel_folder_summary_get_unread_count (folder->summary);
+ return camel_folder_summary_get_unread_count (folder->priv->summary);
}
/**
@@ -1691,9 +1734,43 @@ gint
camel_folder_get_deleted_message_count (CamelFolder *folder)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
- g_return_val_if_fail (folder->summary != NULL, -1);
+ g_return_val_if_fail (folder->priv->summary != NULL, -1);
+
+ return camel_folder_summary_get_deleted_count (folder->priv->summary);
+}
+
+/**
+ * camel_folder_get_flags:
+ * @folder: a #CamelFolder
+ *
+ * Returns: Folder flags (bit-or of #CamelFolderFlags) of the @folder
+ *
+ * Since: 3.24
+ **/
+guint32
+camel_folder_get_flags (CamelFolder *folder)
+{
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0);
+
+ return folder->priv->folder_flags;
+}
+
+/**
+ * camel_folder_set_flags:
+ * @folder: a #CamelFolder
+ * @folder_flags: flags (bit-or of #CamelFolderFlags) to set
+ *
+ * Sets folder flags (bit-or of #CamelFolderFlags) for the @folder.
+ *
+ * Since: 3.24
+ **/
+void
+camel_folder_set_flags (CamelFolder *folder,
+ guint32 folder_flags)
+{
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
- return camel_folder_summary_get_deleted_count (folder->summary);
+ folder->priv->folder_flags = folder_flags;
}
/**
@@ -1940,7 +2017,7 @@ camel_folder_has_summary_capability (CamelFolder *folder)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
- return folder->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
+ return (camel_folder_get_flags (folder) & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) != 0;
}
/* UIDs stuff */
@@ -2278,12 +2355,12 @@ camel_folder_delete (CamelFolder *folder)
g_return_if_fail (class->delete_ != NULL);
camel_folder_lock (folder);
- if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED) {
+ if (camel_folder_get_flags (folder) & CAMEL_FOLDER_HAS_BEEN_DELETED) {
camel_folder_unlock (folder);
return;
}
- folder->folder_flags |= CAMEL_FOLDER_HAS_BEEN_DELETED;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) | CAMEL_FOLDER_HAS_BEEN_DELETED);
class->delete_ (folder);
@@ -2910,7 +2987,7 @@ camel_folder_expunge_sync (CamelFolder *folder,
camel_service_get_display_name (CAMEL_SERVICE (camel_folder_get_parent_store (folder))),
camel_folder_get_full_name (folder));
- if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
+ if (!(camel_folder_get_flags (folder) & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
success = class->expunge_sync (folder, cancellable, error);
CAMEL_CHECK_GERROR (folder, expunge_sync, success, error);
@@ -3669,7 +3746,7 @@ camel_folder_synchronize_sync (CamelFolder *folder,
return FALSE;
}
- if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
+ if (!(camel_folder_get_flags (folder) & CAMEL_FOLDER_HAS_BEEN_DELETED)) {
success = class->synchronize_sync (
folder, expunge, cancellable, error);
CAMEL_CHECK_GERROR (folder, synchronize_sync, success, error);
diff --git a/src/camel/camel-folder.h b/src/camel/camel-folder.h
index 86fadd8..a8188c8 100644
--- a/src/camel/camel-folder.h
+++ b/src/camel/camel-folder.h
@@ -122,11 +122,6 @@ struct _CamelFolderQuotaInfo {
struct _CamelFolder {
CamelObject parent;
CamelFolderPrivate *priv;
-
- CamelFolderSummary *summary;
-
- CamelFolderFlags folder_flags;
- guint32 permanent_flags; /* bit-or of CamelMessageFlags */
};
struct _CamelFolderClass {
@@ -270,6 +265,11 @@ void camel_folder_set_lock_async (CamelFolder *folder,
gboolean skip_folder_lock);
struct _CamelStore *
camel_folder_get_parent_store (CamelFolder *folder);
+CamelFolderSummary *
+ camel_folder_get_folder_summary (CamelFolder *folder);
+void camel_folder_take_folder_summary
+ (CamelFolder *folder,
+ CamelFolderSummary *summary);
const gchar * camel_folder_get_full_name (CamelFolder *folder);
gchar * camel_folder_dup_full_name (CamelFolder *folder);
void camel_folder_set_full_name (CamelFolder *folder,
@@ -282,6 +282,9 @@ const gchar * camel_folder_get_description (CamelFolder *folder);
gchar * camel_folder_dup_description (CamelFolder *folder);
void camel_folder_set_description (CamelFolder *folder,
const gchar *description);
+guint32 camel_folder_get_flags (CamelFolder *folder);
+void camel_folder_set_flags (CamelFolder *folder,
+ guint32 folder_flags);
guint32 camel_folder_get_permanent_flags
(CamelFolder *folder);
#ifndef CAMEL_DISABLE_DEPRECATED
diff --git a/src/camel/camel-store.c b/src/camel/camel-store.c
index dfc11c6..82d2017 100644
--- a/src/camel/camel-store.c
+++ b/src/camel/camel-store.c
@@ -451,8 +451,8 @@ store_synchronize_sync (CamelStore *store,
for (ii = 0; ii < folders->len; ii++) {
CamelFolder *folder = folders->pdata[ii];
- if (folder->summary)
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ if (camel_folder_get_folder_summary (folder))
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
if (!CAMEL_IS_VEE_FOLDER (folder) && local_error == NULL) {
camel_folder_synchronize_sync (
diff --git a/src/camel/camel-vee-folder.c b/src/camel/camel-vee-folder.c
index d82b276..9fbd480 100644
--- a/src/camel/camel-vee-folder.c
+++ b/src/camel/camel-vee-folder.c
@@ -137,7 +137,7 @@ vee_folder_note_added_uid (CamelVeeFolder *vfolder,
const gchar *vuid;
vuid = camel_vee_message_info_data_get_vee_message_uid (added_mi_data);
- if (!camel_folder_summary_check_uid (&vsummary->summary, vuid)) {
+ if (!camel_folder_summary_check_uid (CAMEL_FOLDER_SUMMARY (vsummary), vuid)) {
/* add it only if it wasn't in yet */
CamelVeeMessageInfo *vmi;
@@ -168,7 +168,7 @@ vee_folder_note_unmatch_uid (CamelVeeFolder *vfolder,
const gchar *vuid;
vuid = camel_vee_message_info_data_get_vee_message_uid (unmatched_mi_data);
- if (camel_folder_summary_check_uid (&vsummary->summary, vuid)) {
+ if (camel_folder_summary_check_uid (CAMEL_FOLDER_SUMMARY (vsummary), vuid)) {
g_object_ref (unmatched_mi_data);
/* this one doesn't belong to us anymore */
@@ -263,7 +263,7 @@ vee_folder_merge_matching (CamelVeeFolder *vfolder,
folder = CAMEL_FOLDER (vfolder);
g_return_if_fail (folder != NULL);
- vsummary = CAMEL_VEE_SUMMARY (folder->summary);
+ vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (folder));
g_return_if_fail (vsummary != NULL);
data_cache = vee_folder_get_data_cache (vfolder);
@@ -323,7 +323,7 @@ vee_folder_rebuild_folder_with_changes (CamelVeeFolder *vfolder,
if (!g_cancellable_is_cancelled (cancellable)) {
GHashTable *all_uids;
- all_uids = camel_folder_summary_get_hash (subfolder->summary);
+ all_uids = camel_folder_summary_get_hash (camel_folder_get_folder_summary (subfolder));
vee_folder_merge_matching (vfolder, subfolder, all_uids, match, changes, FALSE);
g_hash_table_destroy (all_uids);
}
@@ -394,7 +394,7 @@ vee_folder_subfolder_changed (CamelVeeFolder *vfolder,
changes = camel_folder_change_info_new ();
v_folder = CAMEL_FOLDER (vfolder);
- vsummary = CAMEL_VEE_SUMMARY (v_folder->summary);
+ vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (v_folder));
camel_folder_freeze (v_folder);
@@ -434,7 +434,7 @@ vee_folder_subfolder_changed (CamelVeeFolder *vfolder,
continue;
vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
- if (camel_folder_summary_check_uid (v_folder->summary, vuid))
+ if (camel_folder_summary_check_uid (camel_folder_get_folder_summary
(v_folder), vuid))
g_ptr_array_add (match, (gpointer) camel_pstring_strdup
(test_uids->pdata[ii]));
g_object_unref (mi_data);
}
@@ -557,7 +557,7 @@ vee_folder_dispose (GObject *object)
folder = CAMEL_FOLDER (object);
/* parent's class frees summary on dispose, thus depend on it */
- if (folder->summary) {
+ if (camel_folder_get_folder_summary (folder)) {
CamelVeeFolder *vfolder;
vfolder = CAMEL_VEE_FOLDER (object);
@@ -679,7 +679,7 @@ vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
changes = camel_folder_change_info_new ();
v_folder = CAMEL_FOLDER (vf);
- vsummary = CAMEL_VEE_SUMMARY (v_folder->summary);
+ vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (v_folder));
/* first remove ... */
g_hash_table_iter_init (&iter, vf->priv->unmatched_remove_changed);
@@ -727,6 +727,17 @@ vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
}
}
+static guint32
+vee_folder_get_permanent_flags (CamelFolder *folder)
+{
+ /* FIXME: what to do about user flags if the subfolder doesn't support them? */
+ return CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN;
+}
+
static GPtrArray *
vee_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
@@ -902,7 +913,7 @@ vee_folder_get_message_sync (CamelFolder *folder,
CamelVeeMessageInfo *mi;
CamelMimeMessage *msg = NULL;
- mi = (CamelVeeMessageInfo *) camel_folder_summary_get (folder->summary, uid);
+ mi = (CamelVeeMessageInfo *) camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid);
if (mi) {
msg = camel_folder_get_message_sync (
camel_vee_message_info_get_original_folder (mi), camel_message_info_get_uid
(CAMEL_MESSAGE_INFO (mi)) + 8,
@@ -1081,12 +1092,12 @@ vee_folder_remove_folder (CamelVeeFolder *vfolder,
camel_folder_freeze (v_folder);
- uids = camel_vee_summary_get_uids_for_subfolder (CAMEL_VEE_SUMMARY (v_folder->summary), subfolder);
+ uids = camel_vee_summary_get_uids_for_subfolder (CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary
(v_folder)), subfolder);
if (uids) {
struct RemoveUnmatchedData rud;
rud.vfolder = vfolder;
- rud.vsummary = CAMEL_VEE_SUMMARY (v_folder->summary);
+ rud.vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (v_folder));
rud.subfolder = subfolder;
rud.data_cache = vee_folder_get_data_cache (vfolder);
rud.changes = changes;
@@ -1190,6 +1201,7 @@ camel_vee_folder_class_init (CamelVeeFolderClass *class)
object_class->set_property = vee_folder_set_property;
folder_class = CAMEL_FOLDER_CLASS (class);
+ folder_class->get_permanent_flags = vee_folder_get_permanent_flags;
folder_class->search_by_expression = vee_folder_search_by_expression;
folder_class->search_by_uids = vee_folder_search_by_uids;
folder_class->count_by_expression = vee_folder_count_by_expression;
@@ -1229,14 +1241,7 @@ camel_vee_folder_init (CamelVeeFolder *vee_folder)
vee_folder->priv = CAMEL_VEE_FOLDER_GET_PRIVATE (vee_folder);
- folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
-
- /* FIXME: what to do about user flags if the subfolder doesn't support them? */
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY);
g_rec_mutex_init (&vee_folder->priv->subfolder_lock);
g_rec_mutex_init (&vee_folder->priv->changed_lock);
@@ -1268,7 +1273,7 @@ camel_vee_folder_construct (CamelVeeFolder *vf,
else
vf->priv->vee_data_cache = camel_vee_data_cache_new ();
- folder->summary = camel_vee_summary_new (folder);
+ camel_folder_take_folder_summary (folder, camel_vee_summary_new (folder));
/* only for subfolders of vee-store */
if (vf->priv->parent_vee_store) {
@@ -1579,7 +1584,7 @@ camel_vee_folder_add_vuid (CamelVeeFolder *vfolder,
g_rec_mutex_unlock (&vfolder->priv->changed_lock);
- vsummary = CAMEL_VEE_SUMMARY (CAMEL_FOLDER (vfolder)->summary);
+ vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (CAMEL_FOLDER (vfolder)));
vee_folder_note_added_uid (vfolder, vsummary, mi_data, changes, FALSE);
}
@@ -1634,7 +1639,7 @@ camel_vee_folder_remove_vuid (CamelVeeFolder *vfolder,
g_rec_mutex_unlock (&vfolder->priv->changed_lock);
- vsummary = CAMEL_VEE_SUMMARY (CAMEL_FOLDER (vfolder)->summary);
+ vsummary = CAMEL_VEE_SUMMARY (camel_folder_get_folder_summary (CAMEL_FOLDER (vfolder)));
data_cache = vee_folder_get_data_cache (vfolder);
/* It can be NULL on dispose of the CamelVeeStore */
diff --git a/src/camel/camel-vee-summary.c b/src/camel/camel-vee-summary.c
index a99ed0a..721c784 100644
--- a/src/camel/camel-vee-summary.c
+++ b/src/camel/camel-vee-summary.c
@@ -77,7 +77,7 @@ message_info_from_uid (CamelFolderSummary *s,
g_return_val_if_fail (orig_folder != NULL, NULL);
/* Create the info and load it, its so easy. */
- info = camel_vee_message_info_new (s, orig_folder->summary, uid);
+ info = camel_vee_message_info_new (s, camel_folder_get_folder_summary (orig_folder), uid);
camel_message_info_set_dirty (info, FALSE);
@@ -181,7 +181,7 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (summary), NULL);
g_return_val_if_fail (CAMEL_IS_FOLDER (subfolder), NULL);
- camel_folder_summary_lock (&summary->summary);
+ camel_folder_summary_lock (CAMEL_FOLDER_SUMMARY (summary));
/* uses direct hash, because strings are supposed to be from the string pool */
known_uids = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify)
camel_pstring_free, NULL);
@@ -191,14 +191,14 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
g_hash_table_foreach (vuids, get_uids_for_subfolder, known_uids);
}
- camel_folder_summary_unlock (&summary->summary);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
return known_uids;
}
/**
* camel_vee_summary_add:
- * @s: the CamelVeeSummary
+ * @summary: the CamelVeeSummary
* @mi_data: (type CamelVeeMessageInfoData): the #CamelVeeMessageInfoData to add
*
* Unref returned pointer with g_object_unref()
@@ -206,7 +206,7 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
* Returns: (transfer full): A new #CamelVeeMessageInfo object.
**/
CamelVeeMessageInfo *
-camel_vee_summary_add (CamelVeeSummary *s,
+camel_vee_summary_add (CamelVeeSummary *summary,
CamelVeeMessageInfoData *mi_data)
{
CamelVeeMessageInfo *vmi;
@@ -215,39 +215,39 @@ camel_vee_summary_add (CamelVeeSummary *s,
CamelFolder *orig_folder;
GHashTable *vuids;
- g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (s), NULL);
+ g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (summary), NULL);
g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO_DATA (mi_data), NULL);
- camel_folder_summary_lock (&s->summary);
+ camel_folder_summary_lock (CAMEL_FOLDER_SUMMARY (summary));
sf_data = camel_vee_message_info_data_get_subfolder_data (mi_data);
vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
orig_folder = camel_vee_subfolder_data_get_folder (sf_data);
- vmi = (CamelVeeMessageInfo *) camel_folder_summary_peek_loaded (&s->summary, vuid);
+ vmi = (CamelVeeMessageInfo *) camel_folder_summary_peek_loaded (CAMEL_FOLDER_SUMMARY (summary), vuid);
if (vmi) {
/* Possible that the entry is loaded, see if it has the summary */
d (g_message ("%s - already there\n", vuid));
g_warn_if_fail (camel_vee_message_info_get_original_summary (vmi) != NULL);
- camel_folder_summary_unlock (&s->summary);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
return vmi;
}
- vmi = (CamelVeeMessageInfo *) camel_vee_message_info_new (CAMEL_FOLDER_SUMMARY (s),
orig_folder->summary, vuid);
+ vmi = (CamelVeeMessageInfo *) camel_vee_message_info_new (CAMEL_FOLDER_SUMMARY (summary),
camel_folder_get_folder_summary (orig_folder), vuid);
- vuids = g_hash_table_lookup (s->priv->vuids_by_subfolder, orig_folder);
+ vuids = g_hash_table_lookup (summary->priv->vuids_by_subfolder, orig_folder);
if (vuids) {
g_hash_table_insert (vuids, (gpointer) camel_pstring_strdup (vuid), GINT_TO_POINTER (1));
} else {
vuids = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify)
camel_pstring_free, NULL);
g_hash_table_insert (vuids, (gpointer) camel_pstring_strdup (vuid), GINT_TO_POINTER (1));
- g_hash_table_insert (s->priv->vuids_by_subfolder, orig_folder, vuids);
+ g_hash_table_insert (summary->priv->vuids_by_subfolder, orig_folder, vuids);
}
- camel_folder_summary_add (&s->summary, (CamelMessageInfo *) vmi, TRUE);
- camel_folder_summary_unlock (&s->summary);
+ camel_folder_summary_add (CAMEL_FOLDER_SUMMARY (summary), (CamelMessageInfo *) vmi, TRUE);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
return vmi;
}
@@ -271,7 +271,7 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
g_return_if_fail (vuid != NULL);
g_return_if_fail (subfolder != NULL);
- camel_folder_summary_lock (&summary->summary);
+ camel_folder_summary_lock (CAMEL_FOLDER_SUMMARY (summary));
vuids = g_hash_table_lookup (summary->priv->vuids_by_subfolder, subfolder);
if (vuids) {
@@ -280,9 +280,9 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
g_hash_table_remove (summary->priv->vuids_by_subfolder, subfolder);
}
- mi = camel_folder_summary_peek_loaded (&summary->summary, vuid);
+ mi = camel_folder_summary_peek_loaded (CAMEL_FOLDER_SUMMARY (summary), vuid);
- camel_folder_summary_remove_uid (&summary->summary, vuid);
+ camel_folder_summary_remove_uid (CAMEL_FOLDER_SUMMARY (summary), vuid);
if (mi) {
/* under twice, the first for camel_folder_summary_peek_loaded(),
@@ -291,7 +291,7 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
g_clear_object (&mi);
}
- camel_folder_summary_unlock (&summary->summary);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
}
/**
@@ -314,16 +314,16 @@ camel_vee_summary_replace_flags (CamelVeeSummary *summary,
g_return_if_fail (CAMEL_IS_VEE_SUMMARY (summary));
g_return_if_fail (uid != NULL);
- camel_folder_summary_lock (&summary->summary);
+ camel_folder_summary_lock (CAMEL_FOLDER_SUMMARY (summary));
- mi = camel_folder_summary_get (&summary->summary, uid);
+ mi = camel_folder_summary_get (CAMEL_FOLDER_SUMMARY (summary), uid);
if (!mi) {
- camel_folder_summary_unlock (&summary->summary);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
return;
}
- camel_folder_summary_replace_flags (&summary->summary, mi);
+ camel_folder_summary_replace_flags (CAMEL_FOLDER_SUMMARY (summary), mi);
g_clear_object (&mi);
- camel_folder_summary_unlock (&summary->summary);
+ camel_folder_summary_unlock (CAMEL_FOLDER_SUMMARY (summary));
}
diff --git a/src/camel/camel-vee-summary.h b/src/camel/camel-vee-summary.h
index 2fcf352..5bdfdac 100644
--- a/src/camel/camel-vee-summary.h
+++ b/src/camel/camel-vee-summary.h
@@ -57,7 +57,7 @@ typedef struct _CamelVeeSummaryClass CamelVeeSummaryClass;
typedef struct _CamelVeeSummaryPrivate CamelVeeSummaryPrivate;
struct _CamelVeeSummary {
- CamelFolderSummary summary;
+ CamelFolderSummary parent;
CamelVeeSummaryPrivate *priv;
};
@@ -73,7 +73,7 @@ GType camel_vee_summary_get_type (void);
CamelFolderSummary *
camel_vee_summary_new (CamelFolder *parent);
CamelVeeMessageInfo *
- camel_vee_summary_add (CamelVeeSummary *s,
+ camel_vee_summary_add (CamelVeeSummary *summary,
struct _CamelVeeMessageInfoData *mi_data);
void camel_vee_summary_remove (CamelVeeSummary *summary,
const gchar *vuid,
diff --git a/src/camel/camel-vtrash-folder.c b/src/camel/camel-vtrash-folder.c
index 6b0888d..e3194af 100644
--- a/src/camel/camel-vtrash-folder.c
+++ b/src/camel/camel-vtrash-folder.c
@@ -257,7 +257,7 @@ camel_vtrash_folder_new (CamelStore *parent_store,
CAMEL_STORE_FOLDER_PRIVATE |
CAMEL_STORE_FOLDER_CREATE);
- ((CamelFolder *) vtrash)->folder_flags |= vdata[type].flags;
+ camel_folder_set_flags (CAMEL_FOLDER (vtrash), camel_folder_get_flags (CAMEL_FOLDER (vtrash)) |
vdata[type].flags);
camel_vee_folder_set_expression ((CamelVeeFolder *) vtrash, vdata[type].expr);
vtrash->bit = vdata[type].bit;
vtrash->type = type;
diff --git a/src/camel/providers/imapx/camel-imapx-conn-manager.c
b/src/camel/providers/imapx/camel-imapx-conn-manager.c
index 983c69b..e82de56 100644
--- a/src/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/src/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -1654,7 +1654,7 @@ imapx_conn_manager_move_to_real_trash_sync (CamelIMAPXConnManager *conn_man,
destination = camel_imapx_folder_list_mailbox (
CAMEL_IMAPX_FOLDER (folder),
cancellable, error);
- folder_deleted_count = camel_folder_summary_get_deleted_count (folder->summary);
+ folder_deleted_count = camel_folder_summary_get_deleted_count
(camel_folder_get_folder_summary (folder));
g_object_unref (folder);
}
diff --git a/src/camel/providers/imapx/camel-imapx-folder.c b/src/camel/providers/imapx/camel-imapx-folder.c
index b3424f0..e171c86 100644
--- a/src/camel/providers/imapx/camel-imapx-folder.c
+++ b/src/camel/providers/imapx/camel-imapx-folder.c
@@ -207,7 +207,7 @@ imapx_folder_dispose (GObject *object)
if (store != NULL) {
camel_store_summary_disconnect_folder_summary (
CAMEL_IMAPX_STORE (store)->summary,
- CAMEL_FOLDER (folder)->summary);
+ camel_folder_get_folder_summary (CAMEL_FOLDER (folder)));
}
g_weak_ref_set (&folder->priv->mailbox, NULL);
@@ -442,7 +442,7 @@ imapx_append_message_sync (CamelFolder *folder,
goto exit;
success = camel_imapx_conn_manager_append_message_sync (
- conn_man, mailbox, folder->summary,
+ conn_man, mailbox, camel_folder_get_folder_summary (folder),
CAMEL_IMAPX_FOLDER (folder)->cache, message,
info, appended_uid, cancellable, error);
@@ -484,25 +484,27 @@ imapx_expunge_sync (CamelFolder *folder,
trash = camel_store_get_trash_folder_sync (store, cancellable, &local_error);
if (local_error == NULL && trash && (folder == trash || g_ascii_strcasecmp (full_name,
camel_folder_get_full_name (trash)) == 0)) {
+ CamelFolderSummary *folder_summary;
CamelMessageInfo *info;
GPtrArray *known_uids;
gint ii;
- camel_folder_summary_lock (folder->summary);
+ folder_summary = camel_folder_get_folder_summary (folder);
+ camel_folder_summary_lock (folder_summary);
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
- known_uids = camel_folder_summary_get_array (folder->summary);
+ camel_folder_summary_prepare_fetch_all (folder_summary, NULL);
+ known_uids = camel_folder_summary_get_array (folder_summary);
/* it's a real trash folder, thus delete all mails from there */
for (ii = 0; known_uids && ii < known_uids->len; ii++) {
- info = camel_folder_summary_get (folder->summary, g_ptr_array_index
(known_uids, ii));
+ info = camel_folder_summary_get (camel_folder_get_folder_summary (folder),
g_ptr_array_index (known_uids, ii));
if (info) {
camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED,
CAMEL_MESSAGE_DELETED);
g_clear_object (&info);
}
}
- camel_folder_summary_unlock (folder->summary);
+ camel_folder_summary_unlock (folder_summary);
camel_folder_summary_free_array (known_uids);
}
@@ -609,7 +611,7 @@ imapx_get_message_sync (CamelFolder *folder,
return NULL;
stream = camel_imapx_conn_manager_get_message_sync (
- conn_man, mailbox, folder->summary,
+ conn_man, mailbox, camel_folder_get_folder_summary (folder),
CAMEL_IMAPX_FOLDER (folder)->cache, uid,
cancellable, error);
@@ -635,7 +637,7 @@ imapx_get_message_sync (CamelFolder *folder,
if (msg != NULL) {
CamelMessageInfo *mi;
- mi = camel_folder_summary_get (folder->summary, uid);
+ mi = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid);
if (mi != NULL) {
CamelMessageFlags flags;
gboolean has_attachment;
@@ -781,7 +783,7 @@ imapx_synchronize_sync (CamelFolder *folder,
success = mailbox != NULL;
} else {
success = camel_imapx_conn_manager_sync_changes_sync (conn_man, mailbox, cancellable, error);
- if (success && expunge && camel_folder_summary_get_deleted_count (folder->summary) > 0) {
+ if (success && expunge && camel_folder_summary_get_deleted_count
(camel_folder_get_folder_summary (folder)) > 0) {
success = camel_imapx_conn_manager_expunge_sync (conn_man, mailbox, cancellable,
error);
}
}
@@ -815,7 +817,7 @@ imapx_synchronize_message_sync (CamelFolder *folder,
goto exit;
success = camel_imapx_conn_manager_sync_message_sync (
- conn_man, mailbox, folder->summary,
+ conn_man, mailbox, camel_folder_get_folder_summary (folder),
CAMEL_IMAPX_FOLDER (folder)->cache, uid,
cancellable, error);
@@ -900,6 +902,17 @@ imapx_folder_changed (CamelFolder *folder,
CAMEL_FOLDER_CLASS (camel_imapx_folder_parent_class)->changed (folder, info);
}
+static guint32
+imapx_get_permanent_flags (CamelFolder *folder)
+{
+ return CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN |
+ CAMEL_MESSAGE_USER;
+}
+
static void
imapx_rename (CamelFolder *folder,
const gchar *new_name)
@@ -912,7 +925,7 @@ imapx_rename (CamelFolder *folder,
imapx_store = CAMEL_IMAPX_STORE (store);
camel_store_summary_disconnect_folder_summary (
- imapx_store->summary, folder->summary);
+ imapx_store->summary, camel_folder_get_folder_summary (folder));
/* Chain up to parent's rename() method. */
CAMEL_FOLDER_CLASS (camel_imapx_folder_parent_class)->
@@ -921,7 +934,7 @@ imapx_rename (CamelFolder *folder,
folder_name = camel_folder_get_full_name (folder);
camel_store_summary_connect_folder_summary (
- imapx_store->summary, folder_name, folder->summary);
+ imapx_store->summary, folder_name, camel_folder_get_folder_summary (folder));
}
static void
@@ -939,6 +952,7 @@ camel_imapx_folder_class_init (CamelIMAPXFolderClass *class)
object_class->finalize = imapx_folder_finalize;
folder_class = CAMEL_FOLDER_CLASS (class);
+ folder_class->get_permanent_flags = imapx_get_permanent_flags;
folder_class->rename = imapx_rename;
folder_class->search_by_expression = imapx_search_by_expression;
folder_class->search_by_uids = imapx_search_by_uids;
@@ -1012,15 +1026,7 @@ camel_imapx_folder_init (CamelIMAPXFolder *imapx_folder)
imapx_folder->priv = CAMEL_IMAPX_FOLDER_GET_PRIVATE (imapx_folder);
- folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
-
- folder->permanent_flags =
- CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN |
- CAMEL_MESSAGE_USER;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY);
camel_folder_set_lock_async (folder, TRUE);
@@ -1043,6 +1049,7 @@ camel_imapx_folder_new (CamelStore *store,
GError **error)
{
CamelFolder *folder;
+ CamelFolderSummary *folder_summary;
CamelService *service;
CamelSettings *settings;
CamelIMAPXFolder *imapx_folder;
@@ -1052,6 +1059,7 @@ camel_imapx_folder_new (CamelStore *store,
gboolean filter_inbox;
gboolean filter_junk;
gboolean filter_junk_inbox;
+ guint32 add_folder_flags = 0;
d ("opening imap folder '%s'\n", folder_dir);
@@ -1081,21 +1089,25 @@ camel_imapx_folder_new (CamelStore *store,
"full_name", folder_name,
"parent-store", store, NULL);
- folder->summary = camel_imapx_summary_new (folder);
- if (folder->summary == NULL) {
+ folder_summary = camel_imapx_summary_new (folder);
+ if (!folder_summary) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Could not create folder summary for %s"),
short_name);
+ g_object_unref (folder);
return NULL;
}
+ camel_folder_take_folder_summary (folder, folder_summary);
+
imapx_folder = CAMEL_IMAPX_FOLDER (folder);
imapx_folder->cache = camel_data_cache_new (folder_dir, error);
if (imapx_folder->cache == NULL) {
g_prefix_error (
error, _("Could not create cache for %s: "),
short_name);
+ g_object_unref (folder);
return NULL;
}
@@ -1118,25 +1130,27 @@ camel_imapx_folder_new (CamelStore *store,
imapx_folder->search = camel_imapx_search_new (CAMEL_IMAPX_STORE (store));
if (filter_all)
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ add_folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
if (camel_imapx_mailbox_is_inbox (folder_name)) {
if (filter_inbox)
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ add_folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
if (filter_junk)
- folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
+ add_folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
} else {
if (filter_junk && !filter_junk_inbox)
- folder->folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
+ add_folder_flags |= CAMEL_FOLDER_FILTER_JUNK;
if (imapx_folder_get_apply_filters (imapx_folder))
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ add_folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
}
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) | add_folder_flags);
+
camel_store_summary_connect_folder_summary (
CAMEL_IMAPX_STORE (store)->summary,
- folder_name, folder->summary);
+ folder_name, camel_folder_get_folder_summary (folder));
return folder;
}
@@ -1188,7 +1202,7 @@ camel_imapx_folder_set_mailbox (CamelIMAPXFolder *folder,
g_weak_ref_set (&folder->priv->mailbox, mailbox);
- imapx_summary = CAMEL_IMAPX_SUMMARY (CAMEL_FOLDER (folder)->summary);
+ imapx_summary = CAMEL_IMAPX_SUMMARY (camel_folder_get_folder_summary (CAMEL_FOLDER (folder)));
uidvalidity = camel_imapx_mailbox_get_uidvalidity (mailbox);
if (uidvalidity > 0 && uidvalidity != imapx_summary->validity)
@@ -1330,7 +1344,7 @@ camel_imapx_folder_copy_message_map (CamelIMAPXFolder *folder)
g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), NULL);
- summary = CAMEL_FOLDER (folder)->summary;
+ summary = camel_folder_get_folder_summary (CAMEL_FOLDER (folder));
array = camel_folder_summary_get_array (summary);
camel_folder_sort_uids (CAMEL_FOLDER (folder), array);
@@ -1366,7 +1380,7 @@ camel_imapx_folder_add_move_to_real_junk (CamelIMAPXFolder *folder,
{
g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
g_return_if_fail (message_uid != NULL);
- g_return_if_fail (camel_folder_summary_check_uid (CAMEL_FOLDER (folder)->summary, message_uid));
+ g_return_if_fail (camel_folder_summary_check_uid (camel_folder_get_folder_summary (CAMEL_FOLDER
(folder)), message_uid));
g_mutex_lock (&folder->priv->move_to_hash_table_lock);
@@ -1397,7 +1411,7 @@ camel_imapx_folder_add_move_to_real_trash (CamelIMAPXFolder *folder,
{
g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
g_return_if_fail (message_uid != NULL);
- g_return_if_fail (camel_folder_summary_check_uid (CAMEL_FOLDER (folder)->summary, message_uid));
+ g_return_if_fail (camel_folder_summary_check_uid (camel_folder_get_folder_summary (CAMEL_FOLDER
(folder)), message_uid));
g_mutex_lock (&folder->priv->move_to_hash_table_lock);
@@ -1434,7 +1448,7 @@ camel_imapx_folder_invalidate_local_cache (CamelIMAPXFolder *folder,
g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
g_return_if_fail (new_uidvalidity > 0);
- summary = CAMEL_FOLDER (folder)->summary;
+ summary = camel_folder_get_folder_summary (CAMEL_FOLDER (folder));
changes = camel_folder_change_info_new ();
array = camel_folder_summary_get_array (summary);
diff --git a/src/camel/providers/imapx/camel-imapx-search.c b/src/camel/providers/imapx/camel-imapx-search.c
index 48e6760..3535dfc 100644
--- a/src/camel/providers/imapx/camel-imapx-search.c
+++ b/src/camel/providers/imapx/camel-imapx-search.c
@@ -250,11 +250,11 @@ imapx_search_match_all (CamelSExp *sexp,
summary = search->summary_set ? search->summary_set : search->summary;
if (!CAMEL_IS_VEE_FOLDER (search->folder)) {
- camel_folder_summary_prepare_fetch_all (search->folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (search->folder),
NULL);
}
for (ii = 0; ii < summary->len; ii++) {
- search->current = camel_folder_summary_get (search->folder->summary, summary->pdata[ii]);
+ search->current = camel_folder_summary_get (camel_folder_get_folder_summary (search->folder),
summary->pdata[ii]);
if (search->current) {
result = camel_sexp_term_eval (sexp, argv[0]);
camel_sexp_result_free (sexp, result);
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 4b3dcba..5d643fb 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -761,7 +761,7 @@ imapx_expunge_uid_from_summary (CamelIMAPXServer *is,
g_return_if_fail (is->priv->changes != NULL);
- camel_folder_summary_remove_uid (folder->summary, uid);
+ camel_folder_summary_remove_uid (camel_folder_get_folder_summary (folder), uid);
g_mutex_lock (&is->priv->changes_lock);
@@ -775,7 +775,7 @@ imapx_expunge_uid_from_summary (CamelIMAPXServer *is,
g_mutex_unlock (&is->priv->changes_lock);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
imapx_update_store_summary (folder);
camel_folder_changed (folder, changes);
@@ -970,7 +970,7 @@ imapx_untagged_vanished (CamelIMAPXServer *is,
g_mutex_unlock (&is->priv->changes_lock);
uid_list = g_list_reverse (uid_list);
- camel_folder_summary_remove_uids (folder->summary, uid_list);
+ camel_folder_summary_remove_uids (camel_folder_get_folder_summary (folder), uid_list);
/* If the response is truly unsolicited (e.g. via NOTIFY)
* then go ahead and emit the change notification now. */
@@ -988,7 +988,7 @@ imapx_untagged_vanished (CamelIMAPXServer *is,
g_mutex_unlock (&is->priv->changes_lock);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
imapx_update_store_summary (folder);
camel_folder_changed (folder, changes);
@@ -1070,7 +1070,7 @@ imapx_untagged_exists (CamelIMAPXServer *is,
if (camel_imapx_server_is_in_idle (is)) {
guint count;
- count = camel_folder_summary_count (folder->summary);
+ count = camel_folder_summary_count (camel_folder_get_folder_summary (folder));
if (count < exists)
g_signal_emit (is, signals[REFRESH_MAILBOX], 0, mailbox);
}
@@ -1244,7 +1244,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
}
if (uid) {
- mi = camel_folder_summary_get (select_folder->summary, uid);
+ mi = camel_folder_summary_get (camel_folder_get_folder_summary
(select_folder), uid);
if (mi) {
/* It's unsolicited _unless_ select_pending (i.e. during
* a QRESYNC SELECT */
@@ -1272,7 +1272,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
g_free (uid);
if (changed && camel_imapx_server_is_in_idle (is)) {
- camel_folder_summary_save_to_db (select_folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary
(select_folder), NULL);
imapx_update_store_summary (select_folder);
g_mutex_lock (&is->priv->changes_lock);
@@ -1332,7 +1332,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
mp = camel_mime_parser_new ();
camel_mime_parser_init_with_bytes (mp, finfo->header);
- mi = camel_folder_summary_info_new_from_parser (folder->summary, mp);
+ mi = camel_folder_summary_info_new_from_parser (camel_folder_get_folder_summary (folder), mp);
g_object_unref (mp);
if (mi != NULL) {
@@ -1381,11 +1381,11 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
camel_message_info_set_size (mi, finfo->size);
camel_message_info_set_abort_notifications (mi, FALSE);
- camel_folder_summary_lock (folder->summary);
+ camel_folder_summary_lock (camel_folder_get_folder_summary (folder));
- if (!camel_folder_summary_check_uid (folder->summary, finfo->uid)) {
+ if (!camel_folder_summary_check_uid (camel_folder_get_folder_summary (folder),
finfo->uid)) {
imapx_set_message_info_flags_for_new_message (mi, server_flags,
server_user_flags, FALSE, NULL, camel_imapx_mailbox_get_permanentflags (mailbox));
- camel_folder_summary_add (folder->summary, mi, FALSE);
+ camel_folder_summary_add (camel_folder_get_folder_summary (folder), mi,
FALSE);
g_mutex_lock (&is->priv->changes_lock);
@@ -1395,14 +1395,14 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
g_mutex_unlock (&is->priv->changes_lock);
if (messages > 0) {
- gint cnt = (camel_folder_summary_count (folder->summary) * 100) /
messages;
+ gint cnt = (camel_folder_summary_count
(camel_folder_get_folder_summary (folder)) * 100) / messages;
camel_operation_progress (cancellable, cnt ? cnt : 1);
}
}
g_clear_object (&mi);
- camel_folder_summary_unlock (folder->summary);
+ camel_folder_summary_unlock (camel_folder_get_folder_summary (folder));
if (free_user_flags)
camel_named_flags_free (server_user_flags);
@@ -2330,7 +2330,7 @@ imapx_completion (CamelIMAPXServer *is,
folder = imapx_server_ref_folder (is, mailbox);
g_return_val_if_fail (folder != NULL, FALSE);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
imapx_update_store_summary (folder);
camel_folder_changed (folder, changes);
@@ -4301,8 +4301,8 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
folder = imapx_server_ref_folder (is, mailbox);
g_return_val_if_fail (folder != NULL, FALSE);
- remove_deleted_flags = remove_deleted_flags || (folder->folder_flags & CAMEL_FOLDER_IS_TRASH) != 0;
- remove_junk_flags = (folder->folder_flags & CAMEL_FOLDER_IS_JUNK) != 0;
+ remove_deleted_flags = remove_deleted_flags || (camel_folder_get_flags (folder) &
CAMEL_FOLDER_IS_TRASH) != 0;
+ remove_junk_flags = (camel_folder_get_flags (folder) & CAMEL_FOLDER_IS_JUNK) != 0;
/* If we're moving messages, prefer "UID MOVE" if supported. */
if (delete_originals) {
@@ -4323,7 +4323,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
gchar *uid = (gchar *) camel_pstring_strdup (uids->pdata[ii]);
g_ptr_array_add (data_uids, uid);
- g_hash_table_insert (source_infos, uid, camel_folder_summary_get (folder->summary, uid));
+ g_hash_table_insert (source_infos, uid, camel_folder_summary_get
(camel_folder_get_folder_summary (folder), uid));
}
g_ptr_array_sort (data_uids, (GCompareFunc) imapx_uids_array_cmp);
@@ -4391,11 +4391,11 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
continue;
uid = g_strdup_printf ("%d", g_array_index
(copyuid_status->u.copyuid.copied_uids, guint32, ii));
- destination_info = camel_folder_summary_get (folder->summary,
uid);
+ destination_info = camel_folder_summary_get
(camel_folder_get_folder_summary (folder), uid);
if (!destination_info) {
is_new = TRUE;
- destination_info = camel_message_info_clone
(source_info, destination_folder->summary);
+ destination_info = camel_message_info_clone
(source_info, camel_folder_get_folder_summary (destination_folder));
camel_message_info_set_uid (destination_info, uid);
}
@@ -4415,7 +4415,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
if (remove_junk_flags)
camel_message_info_set_flags (destination_info,
CAMEL_MESSAGE_JUNK, 0);
if (is_new)
- camel_folder_summary_add
(destination_folder->summary, destination_info, FALSE);
+ camel_folder_summary_add
(camel_folder_get_folder_summary (destination_folder), destination_info, FALSE);
camel_folder_change_info_add_uid (changes,
camel_message_info_get_uid (destination_info));
camel_message_info_property_unlock (source_info);
@@ -4424,8 +4424,8 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
}
if (camel_folder_change_info_changed (changes)) {
- camel_folder_summary_touch (destination_folder->summary);
- camel_folder_summary_save_to_db (destination_folder->summary,
NULL);
+ camel_folder_summary_touch (camel_folder_get_folder_summary
(destination_folder));
+ camel_folder_summary_save_to_db
(camel_folder_get_folder_summary (destination_folder), NULL);
camel_folder_changed (destination_folder, changes);
}
@@ -4446,7 +4446,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
if (delete_originals) {
camel_folder_delete_message (folder, uid);
} else {
- if (camel_folder_summary_remove_uid (folder->summary, uid)) {
+ if (camel_folder_summary_remove_uid
(camel_folder_get_folder_summary (folder), uid)) {
if (!changes)
changes = camel_folder_change_info_new ();
@@ -4456,8 +4456,8 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
}
if (changes && camel_folder_change_info_changed (changes)) {
- camel_folder_summary_touch (folder->summary);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_touch (camel_folder_get_folder_summary (folder));
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary
(folder), NULL);
camel_folder_changed (folder, changes);
}
@@ -4701,7 +4701,7 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
camel_message_info_get_user_tags (info),
camel_imapx_mailbox_get_permanentflags (mailbox));
- camel_folder_summary_add (folder->summary, mi, FALSE);
+ camel_folder_summary_add (camel_folder_get_folder_summary (folder), mi,
FALSE);
g_mutex_lock (&is->priv->changes_lock);
camel_folder_change_info_add_uid (is->priv->changes,
camel_message_info_get_uid (mi));
@@ -4822,7 +4822,7 @@ imapx_server_process_fetch_changes_infos (CamelIMAPXServer *is,
if (out_fetch_summary_uids)
g_return_if_fail (*out_fetch_summary_uids == NULL);
- summary = folder->summary;
+ summary = camel_folder_get_folder_summary (folder);
g_hash_table_iter_init (&iter, infos);
while (g_hash_table_iter_next (&iter, &key, &value)) {
@@ -5022,20 +5022,20 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
folder = imapx_server_ref_folder (is, mailbox);
g_return_val_if_fail (folder != NULL, FALSE);
- imapx_summary = CAMEL_IMAPX_SUMMARY (folder->summary);
+ imapx_summary = CAMEL_IMAPX_SUMMARY (camel_folder_get_folder_summary (folder));
messages = camel_imapx_mailbox_get_messages (mailbox);
unseen = camel_imapx_mailbox_get_unseen (mailbox);
uidnext = camel_imapx_mailbox_get_uidnext (mailbox);
uidvalidity = camel_imapx_mailbox_get_uidvalidity (mailbox);
highestmodseq = camel_imapx_mailbox_get_highestmodseq (mailbox);
- total = camel_folder_summary_count (folder->summary);
+ total = camel_folder_summary_count (camel_folder_get_folder_summary (folder));
need_rescan =
(uidvalidity > 0 && uidvalidity != imapx_summary->validity) ||
total != messages ||
imapx_summary->uidnext != uidnext ||
- camel_folder_summary_get_unread_count (folder->summary) != unseen ||
+ camel_folder_summary_get_unread_count (camel_folder_get_folder_summary (folder)) != unseen ||
imapx_summary->modseq != highestmodseq;
if (!need_rescan) {
@@ -5051,7 +5051,7 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
if (is->priv->use_qresync && imapx_summary->modseq > 0 && uidvalidity > 0) {
imapx_summary->modseq = highestmodseq;
if (total != messages ||
- camel_folder_summary_get_unread_count (folder->summary) != unseen ||
+ camel_folder_summary_get_unread_count (camel_folder_get_folder_summary (folder)) !=
unseen ||
imapx_summary->modseq != highestmodseq) {
c (
is->priv->tagprefix,
@@ -5059,7 +5059,7 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
"total %u / %u, unread %u / %u, modseq %"
G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
total, messages,
- camel_folder_summary_get_unread_count (folder->summary),
+ camel_folder_summary_get_unread_count (camel_folder_get_folder_summary
(folder)),
unseen,
imapx_summary->modseq,
highestmodseq);
@@ -5070,7 +5070,7 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
"total %u / %u, unread %u / %u, modseq %"
G_GUINT64_FORMAT " / %" G_GUINT64_FORMAT "\n",
total, messages,
- camel_folder_summary_get_unread_count (folder->summary),
+ camel_folder_summary_get_unread_count (camel_folder_get_folder_summary
(folder)),
unseen,
imapx_summary->modseq,
highestmodseq);
@@ -5092,7 +5092,7 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
uidl = 1;
}
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
known_uids = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) camel_pstring_free,
NULL);
@@ -5106,11 +5106,11 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
GPtrArray *array;
gint ii;
- camel_folder_summary_lock (folder->summary);
+ camel_folder_summary_lock (camel_folder_get_folder_summary (folder));
changes = camel_folder_change_info_new ();
- array = camel_folder_summary_get_array (folder->summary);
+ array = camel_folder_summary_get_array (camel_folder_get_folder_summary (folder));
for (ii = 0; array && ii < array->len; ii++) {
const gchar *uid = array->pdata[ii];
@@ -5123,18 +5123,18 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
}
}
- camel_folder_summary_unlock (folder->summary);
+ camel_folder_summary_unlock (camel_folder_get_folder_summary (folder));
if (removed != NULL) {
- camel_folder_summary_remove_uids (folder->summary, removed);
- camel_folder_summary_touch (folder->summary);
+ camel_folder_summary_remove_uids (camel_folder_get_folder_summary (folder), removed);
+ camel_folder_summary_touch (camel_folder_get_folder_summary (folder));
/* Shares UIDs with the 'array'. */
g_list_free (removed);
}
if (camel_folder_change_info_changed (changes)) {
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
imapx_update_store_summary (folder);
camel_folder_changed (folder, changes);
}
@@ -5244,7 +5244,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
* one for each flag being turned off, including each
* info being turned off, and one for each flag being turned on.
*/
- changed_uids = camel_folder_summary_get_changed (folder->summary);
+ changed_uids = camel_folder_summary_get_changed (camel_folder_get_folder_summary (folder));
if (changed_uids->len == 0) {
camel_folder_free_uids (folder, changed_uids);
@@ -5282,7 +5282,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
}
if (changed_uids->len > 20)
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
off_orset = on_orset = 0;
for (i = 0; i < changed_uids->len; i++) {
@@ -5294,7 +5294,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
uid = g_ptr_array_index (changed_uids, i);
- info = camel_folder_summary_get (folder->summary, uid);
+ info = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid);
xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
if (!info || !xinfo) {
@@ -5422,7 +5422,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
if (nothing_to_do) {
imapx_sync_free_user (on_user);
imapx_sync_free_user (off_user);
- imapx_unset_folder_flagged_flag (folder->summary, changed_uids, remove_deleted_flags);
+ imapx_unset_folder_flagged_flag (camel_folder_get_folder_summary (folder), changed_uids,
remove_deleted_flags);
camel_folder_free_uids (folder, changed_uids);
g_hash_table_destroy (stamps);
g_object_unref (folder);
@@ -5462,7 +5462,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
guint32 sflags;
gint send;
- info = camel_folder_summary_get (folder->summary, changed_uids->pdata[i]);
+ info = camel_folder_summary_get (camel_folder_get_folder_summary (folder),
changed_uids->pdata[i]);
xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
if (!info || !xinfo) {
@@ -5562,12 +5562,14 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
}
if (success) {
+ CamelFolderSummary *folder_summary;
CamelStore *parent_store;
guint32 unseen;
parent_store = camel_folder_get_parent_store (folder);
+ folder_summary = camel_folder_get_folder_summary (folder);
- camel_folder_summary_lock (folder->summary);
+ camel_folder_summary_lock (folder_summary);
for (i = 0; i < changed_uids->len; i++) {
CamelMessageInfo *info;
@@ -5576,7 +5578,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
guint32 has_flags, set_server_flags;
gboolean changed_meanwhile;
- info = camel_folder_summary_get (folder->summary, changed_uids->pdata[i]);
+ info = camel_folder_summary_get (folder_summary, changed_uids->pdata[i]);
xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
if (!info || !xinfo) {
@@ -5612,11 +5614,11 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
camel_message_info_set_folder_flagged (info, set_folder_flagged);
camel_message_info_property_unlock (info);
- camel_folder_summary_touch (folder->summary);
+ camel_folder_summary_touch (folder_summary);
g_clear_object (&info);
}
- camel_folder_summary_unlock (folder->summary);
+ camel_folder_summary_unlock (folder_summary);
/* Apply the changes to server-side unread count; it won't tell
* us of these changes, of course. */
@@ -5624,16 +5626,16 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
unseen += unread_change;
camel_imapx_mailbox_set_unseen (mailbox, unseen);
- if (folder->summary && (folder->summary->flags & CAMEL_FOLDER_SUMMARY_DIRTY) != 0) {
+ if ((folder_summary->flags & CAMEL_FOLDER_SUMMARY_DIRTY) != 0) {
CamelStoreInfo *si;
/* ... and store's summary when folder's summary is dirty */
si = camel_store_summary_path (CAMEL_IMAPX_STORE (parent_store)->summary,
camel_folder_get_full_name (folder));
if (si) {
- if (si->total != camel_folder_summary_get_saved_count (folder->summary) ||
- si->unread != camel_folder_summary_get_unread_count (folder->summary)) {
- si->total = camel_folder_summary_get_saved_count (folder->summary);
- si->unread = camel_folder_summary_get_unread_count (folder->summary);
+ if (si->total != camel_folder_summary_get_saved_count (folder_summary) ||
+ si->unread != camel_folder_summary_get_unread_count (folder_summary)) {
+ si->total = camel_folder_summary_get_saved_count (folder_summary);
+ si->unread = camel_folder_summary_get_unread_count (folder_summary);
camel_store_summary_touch (CAMEL_IMAPX_STORE (parent_store)->summary);
}
@@ -5641,7 +5643,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
}
}
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (folder_summary, NULL);
camel_store_summary_save (CAMEL_IMAPX_STORE (parent_store)->summary);
}
@@ -5680,14 +5682,16 @@ camel_imapx_server_expunge_sync (CamelIMAPXServer *is,
if (success) {
GPtrArray *uids;
CamelStore *parent_store;
+ CamelFolderSummary *folder_summary;
const gchar *full_name;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
+ folder_summary = camel_folder_get_folder_summary (folder);
- camel_folder_summary_lock (folder->summary);
+ camel_folder_summary_lock (folder_summary);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (folder_summary, NULL);
uids = camel_db_get_folder_deleted_uids (camel_store_get_db (parent_store),
full_name, NULL);
if (uids && uids->len) {
@@ -5701,8 +5705,8 @@ camel_imapx_server_expunge_sync (CamelIMAPXServer *is,
removed = g_list_prepend (removed, (gpointer) uids->pdata[i]);
}
- camel_folder_summary_remove_uids (folder->summary, removed);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_remove_uids (folder_summary, removed);
+ camel_folder_summary_save_to_db (folder_summary, NULL);
camel_folder_changed (folder, changes);
camel_folder_change_info_free (changes);
@@ -5714,7 +5718,7 @@ camel_imapx_server_expunge_sync (CamelIMAPXServer *is,
if (uids)
g_ptr_array_free (uids, TRUE);
- camel_folder_summary_unlock (folder->summary);
+ camel_folder_summary_unlock (folder_summary);
}
camel_imapx_command_unref (ic);
diff --git a/src/camel/providers/imapx/camel-imapx-store.c b/src/camel/providers/imapx/camel-imapx-store.c
index 858a1bd..9a8282e 100644
--- a/src/camel/providers/imapx/camel-imapx-store.c
+++ b/src/camel/providers/imapx/camel-imapx-store.c
@@ -567,7 +567,7 @@ imapx_store_process_mailbox_status (CamelIMAPXStore *imapx_store,
guint32 uidvalidity;
imapx_folder = CAMEL_IMAPX_FOLDER (folder);
- imapx_summary = CAMEL_IMAPX_SUMMARY (folder->summary);
+ imapx_summary = CAMEL_IMAPX_SUMMARY (camel_folder_get_folder_summary (folder));
uidvalidity = camel_imapx_mailbox_get_uidvalidity (mailbox);
@@ -954,8 +954,8 @@ fill_fi (CamelStore *store,
CamelIMAPXSummary *ims;
CamelIMAPXMailbox *mailbox;
- if (folder->summary)
- ims = (CamelIMAPXSummary *) folder->summary;
+ if (camel_folder_get_folder_summary (folder))
+ ims = CAMEL_IMAPX_SUMMARY (camel_folder_get_folder_summary (folder));
else
ims = (CamelIMAPXSummary *) camel_imapx_summary_new (folder);
@@ -967,7 +967,7 @@ fill_fi (CamelStore *store,
g_clear_object (&mailbox);
- if (!folder->summary)
+ if (!camel_folder_get_folder_summary (folder))
g_object_unref (ims);
g_object_unref (folder);
}
@@ -1048,8 +1048,8 @@ get_folder_info_offline (CamelStore *store,
return NULL;
fi = imapx_store_build_folder_info (imapx_store, top, 0);
- fi->unread = camel_folder_summary_get_unread_count (vfolder->summary);
- fi->total = camel_folder_summary_get_saved_count (vfolder->summary);
+ fi->unread = camel_folder_summary_get_unread_count (camel_folder_get_folder_summary
(vfolder));
+ fi->total = camel_folder_summary_get_saved_count (camel_folder_get_folder_summary (vfolder));
if (g_strcmp0 (top, CAMEL_VTRASH_NAME) == 0)
fi->flags = (fi->flags & ~CAMEL_FOLDER_TYPE_MASK) |
@@ -1792,7 +1792,7 @@ imapx_store_get_folder_sync (CamelStore *store,
real_junk_path = g_strdup ("");
if (g_ascii_strcasecmp (real_junk_path, folder_name) == 0)
- folder->folder_flags |= CAMEL_FOLDER_IS_JUNK;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_IS_JUNK);
g_free (real_junk_path);
}
@@ -1809,7 +1809,7 @@ imapx_store_get_folder_sync (CamelStore *store,
real_trash_path = g_strdup ("");
if (g_ascii_strcasecmp (real_trash_path, folder_name) == 0)
- folder->folder_flags |= CAMEL_FOLDER_IS_TRASH;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_IS_TRASH);
g_free (real_trash_path);
}
diff --git a/src/camel/providers/imapx/camel-imapx-utils.c b/src/camel/providers/imapx/camel-imapx-utils.c
index 6522db4..3d981f4 100644
--- a/src/camel/providers/imapx/camel-imapx-utils.c
+++ b/src/camel/providers/imapx/camel-imapx-utils.c
@@ -410,8 +410,8 @@ imapx_update_store_summary (CamelFolder *folder)
if (si == NULL)
return;
- total = camel_folder_summary_count (folder->summary);
- unread = camel_folder_summary_get_unread_count (folder->summary);
+ total = camel_folder_summary_count (camel_folder_get_folder_summary (folder));
+ unread = camel_folder_summary_get_unread_count (camel_folder_get_folder_summary (folder));
if (si->unread != unread || si->total != total) {
si->unread = unread;
@@ -432,7 +432,7 @@ camel_imapx_dup_uid_from_summary_index (CamelFolder *folder,
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- summary = folder->summary;
+ summary = camel_folder_get_folder_summary (folder);
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), NULL);
array = camel_folder_summary_get_array (summary);
@@ -2647,7 +2647,7 @@ camel_imapx_command_add_qresync_parameter (CamelIMAPXCommand *ic,
g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), FALSE);
imapx_folder = CAMEL_IMAPX_FOLDER (folder);
- imapx_summary = CAMEL_IMAPX_SUMMARY (folder->summary);
+ imapx_summary = CAMEL_IMAPX_SUMMARY (camel_folder_get_folder_summary (folder));
mailbox = camel_imapx_folder_ref_mailbox (imapx_folder);
if (!mailbox)
@@ -2659,7 +2659,7 @@ camel_imapx_command_add_qresync_parameter (CamelIMAPXCommand *ic,
/* XXX This should return an unsigned integer to
* avoid the possibility of a negative count. */
- summary_total = camel_folder_summary_count (folder->summary);
+ summary_total = camel_folder_summary_count (camel_folder_get_folder_summary (folder));
g_return_val_if_fail (summary_total >= 0, FALSE);
if (summary_total > 0) {
diff --git a/src/camel/providers/local/camel-local-folder.c b/src/camel/providers/local/camel-local-folder.c
index 47ba761..1b451aa 100644
--- a/src/camel/providers/local/camel-local-folder.c
+++ b/src/camel/providers/local/camel-local-folder.c
@@ -102,17 +102,16 @@ local_folder_dispose (GObject *object)
folder = CAMEL_FOLDER (object);
local_folder = CAMEL_LOCAL_FOLDER (object);
- if (folder->summary) {
+ if (camel_folder_get_folder_summary (folder)) {
/* Something can hold the reference to the folder longer than
the parent store is alive, thus count with it. */
if (camel_folder_get_parent_store (folder)) {
camel_local_summary_sync (
- CAMEL_LOCAL_SUMMARY (folder->summary),
+ CAMEL_LOCAL_SUMMARY (camel_folder_get_folder_summary (folder)),
FALSE, local_folder->changes, NULL, NULL);
}
}
- g_clear_object (&folder->summary);
g_clear_object (&local_folder->search);
g_clear_object (&local_folder->index);
@@ -223,6 +222,18 @@ local_folder_constructed (GObject *object)
g_free (path);
}
+static guint32
+local_folder_get_permanent_flags (CamelFolder *folder)
+{
+ return CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN |
+ CAMEL_MESSAGE_ANSWERED_ALL |
+ CAMEL_MESSAGE_USER;
+}
+
static GPtrArray *
local_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
@@ -331,8 +342,8 @@ local_folder_rename (CamelFolder *folder,
g_free (statepath);
/* FIXME: Poke some internals, sigh */
- g_free (((CamelLocalSummary *) folder->summary)->folder_path);
- ((CamelLocalSummary *) folder->summary)->folder_path = g_strdup (lf->folder_path);
+ g_free (((CamelLocalSummary *) camel_folder_get_folder_summary (folder))->folder_path);
+ ((CamelLocalSummary *) camel_folder_get_folder_summary (folder))->folder_path = g_strdup
(lf->folder_path);
CAMEL_FOLDER_CLASS (camel_local_folder_parent_class)->rename (folder, newname);
}
@@ -399,7 +410,7 @@ local_folder_refresh_info_sync (CamelFolder *folder,
CAMEL_LOCAL_STORE (parent_store));
if (need_summary_check &&
- camel_local_summary_check ((CamelLocalSummary *) folder->summary, lf->changes, cancellable,
error) == -1)
+ camel_local_summary_check ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
lf->changes, cancellable, error) == -1)
return FALSE;
if (camel_folder_change_info_changed (lf->changes)) {
@@ -428,7 +439,7 @@ local_folder_synchronize_sync (CamelFolder *folder,
/* if sync fails, we'll pass it up on exit through ex */
success = (camel_local_summary_sync (
- (CamelLocalSummary *) folder->summary,
+ (CamelLocalSummary *) camel_folder_get_folder_summary (folder),
expunge, lf->changes, cancellable, error) == 0);
camel_local_folder_unlock (lf);
@@ -470,6 +481,7 @@ camel_local_folder_class_init (CamelLocalFolderClass *class)
object_class->constructed = local_folder_constructed;
folder_class = CAMEL_FOLDER_CLASS (class);
+ folder_class->get_permanent_flags = local_folder_get_permanent_flags;
folder_class->search_by_expression = local_folder_search_by_expression;
folder_class->search_by_uids = local_folder_search_by_uids;
folder_class->search_free = local_folder_search_free;
@@ -504,14 +516,8 @@ camel_local_folder_init (CamelLocalFolder *local_folder)
local_folder->priv = CAMEL_LOCAL_FOLDER_GET_PRIVATE (local_folder);
g_mutex_init (&local_folder->priv->search_lock);
- folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
-
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN |
- CAMEL_MESSAGE_ANSWERED_ALL | CAMEL_MESSAGE_USER;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY);
- folder->summary = NULL;
local_folder->search = NULL;
}
@@ -622,13 +628,13 @@ camel_local_folder_construct (CamelLocalFolder *lf,
forceindex = FALSE;
}
- folder->summary = (CamelFolderSummary *) CAMEL_LOCAL_FOLDER_GET_CLASS (lf)->create_summary (lf,
lf->folder_path, lf->index);
- if (!(flags & CAMEL_STORE_IS_MIGRATING) && !camel_local_summary_load ((CamelLocalSummary *)
folder->summary, forceindex, NULL)) {
+ camel_folder_take_folder_summary (folder, CAMEL_FOLDER_SUMMARY (CAMEL_LOCAL_FOLDER_GET_CLASS
(lf)->create_summary (lf, lf->folder_path, lf->index)));
+ if (!(flags & CAMEL_STORE_IS_MIGRATING) && !camel_local_summary_load ((CamelLocalSummary *)
camel_folder_get_folder_summary (folder), forceindex, NULL)) {
/* ? */
if (need_summary_check &&
- camel_local_summary_check ((CamelLocalSummary *) folder->summary, lf->changes,
cancellable, error) == 0) {
+ camel_local_summary_check ((CamelLocalSummary *) camel_folder_get_folder_summary
(folder), lf->changes, cancellable, error) == 0) {
/* we sync here so that any hard work setting up the folder isn't lost */
- if (camel_local_summary_sync ((CamelLocalSummary *) folder->summary, FALSE,
lf->changes, cancellable, error) == -1) {
+ if (camel_local_summary_sync ((CamelLocalSummary *) camel_folder_get_folder_summary
(folder), FALSE, lf->changes, cancellable, error) == -1) {
g_object_unref (folder);
return NULL;
}
diff --git a/src/camel/providers/local/camel-maildir-folder.c
b/src/camel/providers/local/camel-maildir-folder.c
index cfc9656..494b6fb 100644
--- a/src/camel/providers/local/camel-maildir-folder.c
+++ b/src/camel/providers/local/camel-maildir-folder.c
@@ -48,10 +48,10 @@ maildir_folder_cmp_uids (CamelFolder *folder,
time_t tma, tmb;
g_return_val_if_fail (folder != NULL, 0);
- g_return_val_if_fail (folder->summary != NULL, 0);
+ g_return_val_if_fail (camel_folder_get_folder_summary (folder) != NULL, 0);
- a = camel_folder_summary_get (folder->summary, uid1);
- b = camel_folder_summary_get (folder->summary, uid2);
+ a = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid1);
+ b = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid2);
if (!a || !b) {
/* It's not a problem when one of the messages is not in the summary */
@@ -84,7 +84,7 @@ maildir_folder_sort_uids (CamelFolder *folder,
g_return_if_fail (folder != NULL);
if (uids && uids->len > 1)
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
/* Chain up to parent's sort_uids() method. */
CAMEL_FOLDER_CLASS (camel_maildir_folder_parent_class)->sort_uids (folder, uids);
@@ -101,7 +101,7 @@ maildir_folder_get_filename (CamelFolder *folder,
gchar *res;
/* get the message summary info */
- if ((info = camel_folder_summary_get (folder->summary, uid)) == NULL) {
+ if ((info = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid)) == NULL) {
set_cannot_get_message_ex (
error, CAMEL_FOLDER_ERROR_INVALID_UID,
uid, lf->folder_path, _("No such message"));
@@ -175,7 +175,7 @@ maildir_folder_append_message_sync (CamelFolder *folder,
/* add it to the summary/assign the uid, etc */
mi = camel_local_summary_add (
- CAMEL_LOCAL_SUMMARY (folder->summary),
+ CAMEL_LOCAL_SUMMARY (camel_folder_get_folder_summary (folder)),
message, info, lf->changes, error);
if (mi == NULL)
goto check_changed;
@@ -226,7 +226,7 @@ maildir_folder_append_message_sync (CamelFolder *folder,
fail_write:
/* remove the summary info so we are not out-of-sync with the mh folder */
- camel_folder_summary_remove (CAMEL_FOLDER_SUMMARY (folder->summary), mi);
+ camel_folder_summary_remove (CAMEL_FOLDER_SUMMARY (camel_folder_get_folder_summary (folder)), mi);
g_prefix_error (
error, _("Cannot append message to maildir folder: %s: "),
@@ -338,7 +338,7 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
CamelMaildirMessageInfo *mdi;
CamelMessageInfo *info;
- if ((info = camel_folder_summary_get (source->summary, uid)) == NULL) {
+ if ((info = camel_folder_summary_get (camel_folder_get_folder_summary (source), uid))
== NULL) {
set_cannot_get_message_ex (
error, CAMEL_FOLDER_ERROR_INVALID_UID,
uid, lf->folder_path, _("No such message"));
@@ -370,16 +370,16 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
} else {
CamelMessageInfo *clone;
- clone = camel_message_info_clone (info, dest->summary);
+ clone = camel_message_info_clone (info, camel_folder_get_folder_summary
(dest));
camel_maildir_message_info_set_filename (CAMEL_MAILDIR_MESSAGE_INFO (clone),
new_filename);
/* unset deleted flag when transferring from trash folder */
- if ((source->folder_flags & CAMEL_FOLDER_IS_TRASH) != 0)
+ if ((camel_folder_get_flags (source) & CAMEL_FOLDER_IS_TRASH) != 0)
camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED, 0);
/* unset junk flag when transferring from junk folder */
- if ((source->folder_flags & CAMEL_FOLDER_IS_JUNK) != 0)
+ if ((camel_folder_get_flags (source) & CAMEL_FOLDER_IS_JUNK) != 0)
camel_message_info_set_flags (info, CAMEL_MESSAGE_JUNK, 0);
- camel_folder_summary_add (dest->summary, clone, FALSE);
+ camel_folder_summary_add (camel_folder_get_folder_summary (dest), clone,
FALSE);
camel_folder_change_info_add_uid (df->changes, camel_message_info_get_uid
(clone));
@@ -387,7 +387,7 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
source, uid, CAMEL_MESSAGE_DELETED |
CAMEL_MESSAGE_SEEN, ~0);
camel_folder_change_info_remove_uid (lf->changes, camel_message_info_get_uid
(info));
- camel_folder_summary_remove (source->summary, info);
+ camel_folder_summary_remove (camel_folder_get_folder_summary (source), info);
g_clear_object (&clone);
}
@@ -496,7 +496,7 @@ camel_maildir_folder_new (CamelStore *parent_store,
g_object_unref (settings);
if (filter_inbox && (g_str_equal (full_name, ".") || g_ascii_strcasecmp (full_name, "Inbox") == 0))
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) | CAMEL_FOLDER_FILTER_RECENT);
folder = (CamelFolder *) camel_local_folder_construct (
CAMEL_LOCAL_FOLDER (folder), flags, cancellable, error);
diff --git a/src/camel/providers/local/camel-mbox-folder.c b/src/camel/providers/local/camel-mbox-folder.c
index f222a13..3425433 100644
--- a/src/camel/providers/local/camel-mbox-folder.c
+++ b/src/camel/providers/local/camel-mbox-folder.c
@@ -55,10 +55,10 @@ mbox_folder_cmp_uids (CamelFolder *folder,
gint res;
g_return_val_if_fail (folder != NULL, 0);
- g_return_val_if_fail (folder->summary != NULL, 0);
+ g_return_val_if_fail (camel_folder_get_folder_summary (folder) != NULL, 0);
- a = (CamelMboxMessageInfo *) camel_folder_summary_get (folder->summary, uid1);
- b = (CamelMboxMessageInfo *) camel_folder_summary_get (folder->summary, uid2);
+ a = (CamelMboxMessageInfo *) camel_folder_summary_get (camel_folder_get_folder_summary (folder),
uid1);
+ b = (CamelMboxMessageInfo *) camel_folder_summary_get (camel_folder_get_folder_summary (folder),
uid2);
if (!a || !b) {
/* It's not a problem when one of the messages is not in the summary */
@@ -93,7 +93,7 @@ mbox_folder_sort_uids (CamelFolder *folder,
g_return_if_fail (folder != NULL);
if (uids && uids->len > 1)
- camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
CAMEL_FOLDER_CLASS (camel_mbox_folder_parent_class)->sort_uids (folder, uids);
}
@@ -114,13 +114,13 @@ mbox_folder_get_filename (CamelFolder *folder,
return NULL;
/* check for new messages always */
- if (camel_local_summary_check ((CamelLocalSummary *) folder->summary, lf->changes, NULL, error) ==
-1) {
+ if (camel_local_summary_check ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
lf->changes, NULL, error) == -1) {
camel_local_folder_unlock (lf);
return NULL;
}
/* get the message summary info */
- info = (CamelMboxMessageInfo *) camel_folder_summary_get (folder->summary, uid);
+ info = (CamelMboxMessageInfo *) camel_folder_summary_get (camel_folder_get_folder_summary (folder),
uid);
if (info == NULL) {
set_cannot_get_message_ex (
@@ -153,7 +153,7 @@ mbox_folder_append_message_sync (CamelFolder *folder,
CamelLocalFolder *lf = (CamelLocalFolder *) folder;
CamelStream *output_stream = NULL, *filter_stream = NULL;
CamelMimeFilter *filter_from;
- CamelMboxSummary *mbs = (CamelMboxSummary *) folder->summary;
+ CamelMboxSummary *mbs = (CamelMboxSummary *) camel_folder_get_folder_summary (folder);
CamelMessageInfo *mi = NULL;
gchar *fromline = NULL;
struct stat st;
@@ -169,12 +169,12 @@ mbox_folder_append_message_sync (CamelFolder *folder,
d (printf ("Appending message\n"));
/* first, check the summary is correct (updates folder_size too) */
- retval = camel_local_summary_check ((CamelLocalSummary *) folder->summary, lf->changes, cancellable,
error);
+ retval = camel_local_summary_check ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
lf->changes, cancellable, error);
if (retval == -1)
goto fail;
/* add it to the summary/assign the uid, etc */
- mi = camel_local_summary_add ((CamelLocalSummary *) folder->summary, message, info, lf->changes,
error);
+ mi = camel_local_summary_add ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
message, info, lf->changes, error);
if (mi == NULL)
goto fail;
@@ -199,7 +199,7 @@ mbox_folder_append_message_sync (CamelFolder *folder,
/* and we need to set the frompos/XEV explicitly */
camel_mbox_message_info_set_offset (CAMEL_MBOX_MESSAGE_INFO (mi), mbs->folder_size);
#if 0
- xev = camel_local_summary_encode_x_evolution ((CamelLocalSummary *) folder->summary, mi);
+ xev = camel_local_summary_encode_x_evolution ((CamelLocalSummary *) camel_folder_get_folder_summary
(folder), mi);
if (xev) {
/* the x-ev header should match the 'current' flags, no problem, so store as much */
camel_medium_set_header ((CamelMedium *) message, "X-Evolution", xev);
@@ -321,14 +321,14 @@ mbox_folder_get_message_sync (CamelFolder *folder,
return NULL;
/* check for new messages always */
- if (camel_local_summary_check ((CamelLocalSummary *) folder->summary, lf->changes, cancellable,
error) == -1) {
+ if (camel_local_summary_check ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
lf->changes, cancellable, error) == -1) {
camel_local_folder_unlock (lf);
return NULL;
}
retry:
/* get the message summary info */
- info = (CamelMboxMessageInfo *) camel_folder_summary_get (folder->summary, uid);
+ info = (CamelMboxMessageInfo *) camel_folder_summary_get (camel_folder_get_folder_summary (folder),
uid);
if (info == NULL) {
set_cannot_get_message_ex (
@@ -375,8 +375,8 @@ retry:
if (!retried) {
retried = TRUE;
- camel_local_summary_check_force ((CamelLocalSummary *) folder->summary);
- retval = camel_local_summary_check ((CamelLocalSummary *) folder->summary,
lf->changes, cancellable, error);
+ camel_local_summary_check_force ((CamelLocalSummary *)
camel_folder_get_folder_summary (folder));
+ retval = camel_local_summary_check ((CamelLocalSummary *)
camel_folder_get_folder_summary (folder), lf->changes, cancellable, error);
if (retval != -1)
goto retry;
}
diff --git a/src/camel/providers/local/camel-mh-folder.c b/src/camel/providers/local/camel-mh-folder.c
index fa56572..f3cc140 100644
--- a/src/camel/providers/local/camel-mh-folder.c
+++ b/src/camel/providers/local/camel-mh-folder.c
@@ -71,7 +71,7 @@ mh_folder_append_message_sync (CamelFolder *folder,
return FALSE;
/* add it to the summary/assign the uid, etc */
- mi = camel_local_summary_add ((CamelLocalSummary *) folder->summary, message, info, lf->changes,
error);
+ mi = camel_local_summary_add ((CamelLocalSummary *) camel_folder_get_folder_summary (folder),
message, info, lf->changes, error);
if (mi == NULL)
goto check_changed;
@@ -108,7 +108,7 @@ mh_folder_append_message_sync (CamelFolder *folder,
fail_write:
/* remove the summary info so we are not out-of-sync with the mh folder */
- camel_folder_summary_remove (CAMEL_FOLDER_SUMMARY (folder->summary), mi);
+ camel_folder_summary_remove (camel_folder_get_folder_summary (folder), mi);
g_prefix_error (
error, _("Cannot append message to mh folder: %s: "), name);
@@ -151,7 +151,7 @@ mh_folder_get_message_sync (CamelFolder *folder,
return NULL;
/* get the message summary info */
- if ((info = camel_folder_summary_get (folder->summary, uid)) == NULL) {
+ if ((info = camel_folder_summary_get (camel_folder_get_folder_summary (folder), uid)) == NULL) {
set_cannot_get_message_ex (
error, CAMEL_FOLDER_ERROR_INVALID_UID,
uid, lf->folder_path, _("No such message"));
diff --git a/src/camel/providers/local/camel-spool-folder.c b/src/camel/providers/local/camel-spool-folder.c
index af8c064..d98d3b2 100644
--- a/src/camel/providers/local/camel-spool-folder.c
+++ b/src/camel/providers/local/camel-spool-folder.c
@@ -159,15 +159,14 @@ camel_spool_folder_new (CamelStore *parent_store,
"parent-store", parent_store, NULL);
if (filter_inbox && strcmp (full_name, "INBOX") == 0)
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) | CAMEL_FOLDER_FILTER_RECENT);
flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX;
folder = (CamelFolder *) camel_local_folder_construct (
(CamelLocalFolder *) folder, flags, cancellable, error);
if (folder != NULL && use_xstatus_headers)
- camel_mbox_summary_xstatus (
- CAMEL_MBOX_SUMMARY (folder->summary), TRUE);
+ camel_mbox_summary_xstatus (CAMEL_MBOX_SUMMARY (camel_folder_get_folder_summary (folder)),
TRUE);
g_free (basename);
diff --git a/src/camel/providers/nntp/camel-nntp-folder.c b/src/camel/providers/nntp/camel-nntp-folder.c
index 868ad45..2ce8baa 100644
--- a/src/camel/providers/nntp/camel-nntp-folder.c
+++ b/src/camel/providers/nntp/camel-nntp-folder.c
@@ -114,7 +114,7 @@ nntp_folder_dispose (GObject *object)
CamelStore *store;
folder = CAMEL_FOLDER (object);
- camel_folder_summary_save_to_db (folder->summary, NULL);
+ camel_folder_summary_save_to_db (camel_folder_get_folder_summary (folder), NULL);
store = camel_folder_get_parent_store (folder);
if (store != NULL) {
@@ -124,7 +124,7 @@ nntp_folder_dispose (GObject *object)
CAMEL_NNTP_STORE (store));
camel_store_summary_disconnect_folder_summary (
CAMEL_STORE_SUMMARY (nntp_store_summary),
- folder->summary);
+ camel_folder_get_folder_summary (folder));
g_clear_object (&nntp_store_summary);
}
@@ -163,7 +163,7 @@ camel_nntp_folder_selected (CamelNNTPFolder *nntp_folder,
parent_store = camel_folder_get_parent_store (folder);
res = camel_nntp_summary_check (
- CAMEL_NNTP_SUMMARY (folder->summary),
+ CAMEL_NNTP_SUMMARY (camel_folder_get_folder_summary (folder)),
CAMEL_NNTP_STORE (parent_store),
line, nntp_folder->changes,
cancellable, error);
@@ -521,7 +521,7 @@ nntp_folder_expunge_sync (CamelFolder *folder,
GPtrArray *known_uids;
guint ii;
- summary = folder->summary;
+ summary = camel_folder_get_folder_summary (folder);
camel_folder_summary_prepare_fetch_all (summary, NULL);
known_uids = camel_folder_summary_get_array (summary);
@@ -689,7 +689,7 @@ nntp_folder_synchronize_sync (CamelFolder *folder,
return FALSE;
}
- summary = folder->summary;
+ summary = camel_folder_get_folder_summary (folder);
changed = camel_folder_summary_get_changed (summary);
if (changed != NULL) {
@@ -807,7 +807,7 @@ camel_nntp_folder_new (CamelStore *parent,
"parent-store", parent, NULL);
nntp_folder = (CamelNNTPFolder *) folder;
- folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) |
CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY);
storage_path = g_build_filename (user_cache_dir, folder_name, NULL);
root = g_strdup_printf ("%s.cmeta", storage_path);
@@ -816,12 +816,12 @@ camel_nntp_folder_new (CamelStore *parent,
g_free (root);
g_free (storage_path);
- folder->summary = (CamelFolderSummary *) camel_nntp_summary_new (folder);
+ camel_folder_take_folder_summary (folder, (CamelFolderSummary *) camel_nntp_summary_new (folder));
if (filter_all || nntp_folder_get_apply_filters (nntp_folder))
- folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ camel_folder_set_flags (folder, camel_folder_get_flags (folder) | CAMEL_FOLDER_FILTER_RECENT);
- camel_folder_summary_load_from_db (folder->summary, NULL);
+ camel_folder_summary_load_from_db (camel_folder_get_folder_summary (folder), NULL);
nntp_store = CAMEL_NNTP_STORE (parent);
nntp_store_summary = camel_nntp_store_ref_summary (nntp_store);
@@ -837,7 +837,7 @@ camel_nntp_folder_new (CamelStore *parent,
camel_store_summary_connect_folder_summary (
CAMEL_STORE_SUMMARY (nntp_store_summary),
- folder_name, folder->summary);
+ folder_name, camel_folder_get_folder_summary (folder));
g_clear_object (&nntp_store_summary);
diff --git a/src/camel/providers/nntp/camel-nntp-summary.c b/src/camel/providers/nntp/camel-nntp-summary.c
index 3964205..8170be0 100644
--- a/src/camel/providers/nntp/camel-nntp-summary.c
+++ b/src/camel/providers/nntp/camel-nntp-summary.c
@@ -175,7 +175,7 @@ add_range_xover (CamelNNTPSummary *cns,
s = (CamelFolderSummary *) cns;
folder_filter_recent = camel_folder_summary_get_folder (s) &&
- (camel_folder_summary_get_folder (s)->folder_flags & CAMEL_FOLDER_FILTER_RECENT) != 0;
+ (camel_folder_get_flags (camel_folder_summary_get_folder (s)) & CAMEL_FOLDER_FILTER_RECENT)
!= 0;
service = CAMEL_SERVICE (nntp_store);
@@ -314,7 +314,7 @@ add_range_head (CamelNNTPSummary *cns,
s = (CamelFolderSummary *) cns;
folder_filter_recent = camel_folder_summary_get_folder (s) &&
- (camel_folder_summary_get_folder (s)->folder_flags & CAMEL_FOLDER_FILTER_RECENT) != 0;
+ (camel_folder_get_flags (camel_folder_summary_get_folder (s)) & CAMEL_FOLDER_FILTER_RECENT)
!= 0;
mp = camel_mime_parser_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]