From f86da998ff2ef6ee67a7825ddd73c0298a0956ae Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 19 Jul 2000 18:15:37 +0000 Subject: If the folder's message count is not the same as the number of summaries, 2000-07-19 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (imap_get_summary): If the folder's message count is not the same as the number of summaries, free the old summary and create a new summary. svn path=/trunk/; revision=4223 --- camel/ChangeLog | 6 ++++++ camel/providers/imap/camel-imap-folder.c | 29 ++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index bf4c3b7374..8429605a23 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2000-07-19 Jeffrey Stedfast + + * providers/imap/camel-imap-folder.c (imap_get_summary): If the folder's + message count is not the same as the number of summaries, free the old + summary and create a new summary. + 2000-07-18 Jeffrey Stedfast * providers/imap/camel-imap-folder.c (camel_imap_folder_class_init): Added diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index f5235c5a30..bf0f1ff03b 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -189,16 +189,12 @@ camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex return folder; } -static void -imap_finalize (GtkObject *object) +static void +imap_summary_free (CamelImapFolder *imap_folder) { - /* TODO: do we need to do more here? */ - CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object); CamelMessageInfo *info; gint i, max; - GTK_OBJECT_CLASS (parent_class)->finalize (object); - g_return_if_fail (imap_folder->summary != NULL); max = imap_folder->summary->len; @@ -219,6 +215,15 @@ imap_finalize (GtkObject *object) imap_folder->summary = NULL; } +static void +imap_finalize (GtkObject *object) +{ + /* TODO: do we need to do more here? */ + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object); + + imap_summary_free (imap_folder); +} + static void imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder, const gchar *name, gchar *separator, gboolean path_begins_with_sep, CamelException *ex) @@ -1059,7 +1064,7 @@ static char *header_fields[] = { "subject", "from", "to", "cc", "date", a2 OK FETCH completed */ -GPtrArray * +static GPtrArray * imap_get_summary (CamelFolder *folder, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); @@ -1069,10 +1074,16 @@ imap_get_summary (CamelFolder *folder, CamelException *ex) const char *received; struct _header_raw *h, *tail = NULL; - if (imap_folder->summary) - return imap_folder->summary; + /*if (imap_folder->summary) + return imap_folder->summary;*/ num = imap_get_message_count (folder, ex); + + if (imap_folder->summary && imap_folder->summary->len == num) + return imap_folder->summary; + + /* clean up any previous summary data */ + imap_summary_free (imap_folder); summary = g_ptr_array_new (); -- cgit v1.2.3