aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-14 01:41:18 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-14 01:41:18 +0800
commitec22bcd92061fcf6ce599d5fd777a9159beaff02 (patch)
treee0eef90af8229dd7a1453ab72a3403ceaea8db5b /camel/camel-folder.c
parentc232c3eeaaf85c3e92a1c6bf7a802f7ffee30451 (diff)
downloadgsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.gz
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.tar.zst
gsoc2013-evolution-ec22bcd92061fcf6ce599d5fd777a9159beaff02.zip
New field (message_list) which will hold a reference on each message
1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-folder.h (struct _CamelFolder): New field (message_list) which will hold a reference on each message obtained by the folder, which is necessary in order for the caching procedure to work (Getting the same message from a folder twice will return the same CamelMimeMessage object). * camel/camel-folder.c (camel_folder_get_message): When the store retreives a message put it in its message list. (_finalize): free message list. * ChangeLog: fix typo (parmanent) svn path=/trunk/; revision=1112
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r--camel/camel-folder.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 271b5e1644..8c4824168b 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -128,12 +128,22 @@ static void
_finalize (GtkObject *object)
{
CamelFolder *camel_folder = CAMEL_FOLDER (object);
+ GList *message_node;
+
CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n");
if (camel_folder->name) g_free (camel_folder->name);
if (camel_folder->full_name) g_free (camel_folder->full_name);
if (camel_folder->permanent_flags) g_free (camel_folder->permanent_flags);
-
+ if (camel_folder->message_list) {
+ /* unref all messages got from the folder */
+ message_node = camel_folder->message_list;
+ while (message_node) {
+ gtk_object_unref (GTK_OBJECT (message_node->data));
+ g_list_next (message_node);
+ }
+ g_list_free (camel_folder->message_list);
+ }
GTK_OBJECT_CLASS (parent_class)->finalize (object);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
}
@@ -745,10 +755,10 @@ _expunge (CamelFolder *folder)
/**
- * camel_folder_expunge: physically delete messages marked as DELETED
+ * camel_folder_expunge: physically delete messages marked as "DELETED"
* @folder: the folder
*
- * Delete messages which have been marked as deleted.
+ * Delete messages which have been marked as "DELETED"
*
*
* Return value: list of expunged message objects.
@@ -761,10 +771,10 @@ camel_folder_expunge (CamelFolder *folder)
-
static CamelMimeMessage *
_get_message (CamelFolder *folder, gint number)
{
+
return NULL;
}
@@ -783,7 +793,19 @@ _get_message (CamelFolder *folder, gint number)
CamelMimeMessage *
camel_folder_get_message (CamelFolder *folder, gint number)
{
- return CF_CLASS (folder)->get_message (folder, number);
+ CamelMimeMessage *new_message;
+ new_message = CF_CLASS (folder)->get_message (folder, number);
+
+
+ /* now put the new message in the list of messages got from
+ * this folder. If people show concerns about this code being
+ * here, we will let the providers do it by themself */
+ if (!new_message) return NULL;
+ /* if the message has not been already put in
+ * this folder message list, put it in */
+ if (!g_list_find (folder->message_list, new_message))
+ folder->message_list = g_list_append (folder->message_list, new_message);
+ return new_message;
}