diff options
author | Dan Winship <danw@src.gnome.org> | 2001-10-09 11:07:39 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-10-09 11:07:39 +0800 |
commit | 5931b31034fb4d19482e517f6d8e5508fa1da908 (patch) | |
tree | 51e741ef213cd6af06a263b55df3d5c3d45c27bf | |
parent | c5a91116e208aa02e8412ab778b7c959dc089ddd (diff) | |
download | gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar.gz gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar.bz2 gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar.lz gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar.xz gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.tar.zst gsoc2013-evolution-5931b31034fb4d19482e517f6d8e5508fa1da908.zip |
replace the ever-growing list of gbooleans with a single guint32 for
* camel-folder.h (struct _CamelFolder): replace the ever-growing
list of gbooleans with a single guint32 for flags.
* camel-folder.c: Update folder flag setting/checking.
* providers/pop3/camel-pop3-folder.c (camel_pop3_folder_init):
* providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new):
* providers/local/camel-spool-folder.c (spool_init,
camel_spool_folder_new):
* providers/local/camel-maildir-folder.c (camel_maildir_folder_new):
* providers/local/camel-local-folder.c (local_init):
* providers/imap/camel-imap-folder.c (camel_imap_folder_init,
camel_imap_folder_new):
* camel-vtrash-folder.c (camel_vtrash_folder_init):
* camel-vee-folder.c (camel_vee_folder_init):
* camel-digest-folder.c (camel_digest_folder_init): update folder
flag setting.
svn path=/trunk/; revision=13509
-rw-r--r-- | camel/ChangeLog | 20 | ||||
-rw-r--r-- | camel/camel-digest-folder.c | 3 | ||||
-rw-r--r-- | camel/camel-folder.c | 25 | ||||
-rw-r--r-- | camel/camel-folder.h | 12 | ||||
-rw-r--r-- | camel/camel-vee-folder.c | 4 | ||||
-rw-r--r-- | camel/camel-vtrash-folder.c | 12 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 6 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 4 | ||||
-rw-r--r-- | camel/providers/local/camel-maildir-folder.c | 2 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-folder.c | 6 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-folder.c | 4 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-folder.c | 15 |
12 files changed, 64 insertions, 49 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 7ad271ab6d..0f0bf75ebe 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,23 @@ +2001-10-08 Dan Winship <danw@ximian.com> + + * camel-folder.h (struct _CamelFolder): replace the ever-growing + list of gbooleans with a single guint32 for flags. + + * camel-folder.c: Update folder flag setting/checking. + + * providers/pop3/camel-pop3-folder.c (camel_pop3_folder_init): + * providers/nntp/camel-nntp-folder.c (camel_nntp_folder_new): + * providers/local/camel-spool-folder.c (spool_init, + camel_spool_folder_new): + * providers/local/camel-maildir-folder.c (camel_maildir_folder_new): + * providers/local/camel-local-folder.c (local_init): + * providers/imap/camel-imap-folder.c (camel_imap_folder_init, + camel_imap_folder_new): + * camel-vtrash-folder.c (camel_vtrash_folder_init): + * camel-vee-folder.c (camel_vee_folder_init): + * camel-digest-folder.c (camel_digest_folder_init): update folder + flag setting. + 2001-10-07 Dan Winship <danw@ximian.com> * providers/imap/camel-imap-store.c (get_folder_online): Unlock diff --git a/camel/camel-digest-folder.c b/camel/camel-digest-folder.c index 42d238ade4..0974f5013d 100644 --- a/camel/camel-digest-folder.c +++ b/camel/camel-digest-folder.c @@ -95,8 +95,7 @@ camel_digest_folder_init (gpointer object, gpointer klass) CamelDigestFolder *digest_folder = CAMEL_DIGEST_FOLDER (object); CamelFolder *folder = CAMEL_FOLDER (object); - folder->has_summary_capability = TRUE; - folder->has_search_capability = FALSE; + folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY; digest_folder->priv = g_new0 (struct _CamelDigestFolderPrivate, 1); digest_folder->priv->info_hash = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 60b7c9dcb1..b8868197b1 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -277,7 +277,7 @@ camel_folder_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) CAMEL_FOLDER_LOCK(folder, lock); - if (!folder->deleted) + if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) CF_CLASS (folder)->sync (folder, expunge, ex); CAMEL_FOLDER_UNLOCK(folder, lock); @@ -400,7 +400,7 @@ camel_folder_expunge (CamelFolder *folder, CamelException *ex) CAMEL_FOLDER_LOCK(folder, lock); - if (!folder->deleted) + if (!(folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)) CF_CLASS (folder)->expunge (folder, ex); CAMEL_FOLDER_UNLOCK(folder, lock); @@ -854,7 +854,7 @@ camel_folder_has_summary_capability (CamelFolder *folder) { g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE); - return folder->has_summary_capability; + return folder->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY; } @@ -1037,7 +1037,7 @@ camel_folder_has_search_capability (CamelFolder *folder) { g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE); - return folder->has_search_capability; + return folder->folder_flags & CAMEL_FOLDER_HAS_SEARCH_CAPABILITY; } static GPtrArray * @@ -1072,7 +1072,7 @@ camel_folder_search_by_expression (CamelFolder *folder, const char *expression, GPtrArray *ret; g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); - g_return_val_if_fail (folder->has_search_capability, NULL); + g_return_val_if_fail (folder->folder_flags & CAMEL_FOLDER_HAS_SEARCH_CAPABILITY, NULL); /* NOTE: that it is upto the callee to lock */ @@ -1102,7 +1102,6 @@ void camel_folder_search_free (CamelFolder *folder, GPtrArray *result) { g_return_if_fail (CAMEL_IS_FOLDER (folder)); - g_return_if_fail (folder->has_search_capability); /* NOTE: upto the callee to lock */ CF_CLASS (folder)->search_free (folder, result); @@ -1122,7 +1121,7 @@ copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, CamelE if (!msg) return; - if (source->has_summary_capability) + if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) info = CF_CLASS (source)->get_message_info (source, uid); else info = camel_message_info_new_from_header (((CamelMimePart *)msg)->headers); @@ -1134,7 +1133,7 @@ copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, CamelE camel_folder_append_message (dest, msg, info, ex); camel_object_unref (CAMEL_OBJECT (msg)); if (info) { - if (source->has_summary_capability) + if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) CF_CLASS (source)->free_message_info (source, info); else camel_message_info_free (info); @@ -1198,7 +1197,7 @@ move_message_to (CamelFolder *source, const char *uid, if (!msg) return; - if (source->has_summary_capability) + if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) info = CF_CLASS (source)->get_message_info (source, uid); else info = camel_message_info_new_from_header (((CamelMimePart *)msg)->headers); @@ -1214,7 +1213,7 @@ move_message_to (CamelFolder *source, const char *uid, CAMEL_MESSAGE_DELETED); if (info) { - if (source->has_summary_capability) + if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) CF_CLASS (source)->free_message_info (source, info); else camel_message_info_free (info); @@ -1291,12 +1290,12 @@ camel_folder_delete (CamelFolder *folder) g_return_if_fail (CAMEL_IS_FOLDER (folder)); CAMEL_FOLDER_LOCK (folder, lock); - if (folder->deleted) { + if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED) { CAMEL_FOLDER_UNLOCK (folder, lock); return; } - folder->deleted = TRUE; + folder->folder_flags |= CAMEL_FOLDER_HAS_BEEN_DELETED; CF_CLASS (folder)->delete (folder); @@ -1450,7 +1449,7 @@ folder_changed (CamelObject *obj, gpointer event_data) CamelFilterDriver *driver; CAMEL_FOLDER_LOCK(folder, change_lock); - if (folder->filter_recent + if ((folder->folder_flags & CAMEL_FOLDER_FILTER_RECENT) && changed->uid_recent->len>0 && (driver = camel_session_get_filter_driver(session, "incoming", NULL))) { #ifdef ENABLE_THREADS diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 786e346627..e9b15b1306 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -63,14 +63,16 @@ struct _CamelFolder CamelStore *parent_store; CamelFolderSummary *summary; + guint32 folder_flags; guint32 permanent_flags; - gboolean has_summary_capability:1; - gboolean has_search_capability:1; - gboolean filter_recent:1; - gboolean deleted:1; - }; +#define CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY (1<<0) +#define CAMEL_FOLDER_HAS_SEARCH_CAPABILITY (1<<1) +#define CAMEL_FOLDER_FILTER_RECENT (1<<2) +#define CAMEL_FOLDER_HAS_BEEN_DELETED (1<<3) +#define CAMEL_FOLDER_IS_TRASH (1<<4) + typedef struct { CamelObjectClass parent_class; diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index 1cf0386e25..fbee88af2f 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -132,8 +132,8 @@ camel_vee_folder_init (CamelVeeFolder *obj) p = _PRIVATE(obj) = g_malloc0(sizeof(*p)); - folder->has_summary_capability = TRUE; - folder->has_search_capability = TRUE; + folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | + CAMEL_FOLDER_HAS_SEARCH_CAPABILITY); /* FIXME: what to do about user flags if the subfolder doesn't support them? */ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c index 1e7f7b8f67..8b39fe9717 100644 --- a/camel/camel-vtrash-folder.c +++ b/camel/camel-vtrash-folder.c @@ -53,6 +53,14 @@ camel_vtrash_folder_class_init (CamelVTrashFolderClass *klass) folder_class->move_messages_to = vtrash_move_messages_to; } +static void +camel_vtrash_folder_init (CamelVTrashFolder *vtrash) +{ + CamelFolder *folder = CAMEL_FOLDER (vtrash); + + folder->folder_flags |= CAMEL_FOLDER_IS_TRASH; +} + CamelType camel_vtrash_folder_get_type (void) { @@ -65,7 +73,7 @@ camel_vtrash_folder_get_type (void) sizeof (CamelVTrashFolderClass), (CamelObjectClassInitFunc) camel_vtrash_folder_class_init, NULL, - NULL, + (CamelObjectInitFunc) camel_vtrash_folder_init, NULL); } @@ -73,7 +81,7 @@ camel_vtrash_folder_get_type (void) } /** - * camel_vee_folder_new: + * camel_vtrash_folder_new: * @parent_store: the parent CamelVeeStore * @name: the vfolder name * @ex: a CamelException diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 902c52c3d9..b17ffb55cd 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -143,8 +143,8 @@ camel_imap_folder_init (gpointer object, gpointer klass) CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object); CamelFolder *folder = CAMEL_FOLDER (object); - folder->has_summary_capability = TRUE; - folder->has_search_capability = TRUE; + folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | + CAMEL_FOLDER_HAS_SEARCH_CAPABILITY); imap_folder->priv = g_malloc0(sizeof(*imap_folder->priv)); #ifdef ENABLE_THREADS @@ -219,7 +219,7 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name, if ((imap_store->parameters & IMAP_PARAM_FILTER_INBOX) && !g_strcasecmp (folder_name, "INBOX")) - folder->filter_recent = TRUE; + folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT; return folder; } diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index c469c2578b..43622eb23a 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -92,8 +92,8 @@ local_init(gpointer object, gpointer klass) CamelFolder *folder = object; CamelLocalFolder *local_folder = object; - folder->has_summary_capability = TRUE; - folder->has_search_capability = TRUE; + folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | + CAMEL_FOLDER_HAS_SEARCH_CAPABILITY); folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT | diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index 1bd6417e1a..bd7f879038 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -113,7 +113,7 @@ camel_maildir_folder_new(CamelStore *parent_store, const char *full_name, guint3 if (parent_store->flags & CAMEL_STORE_FILTER_INBOX && strcmp(full_name, "") == 0) - folder->filter_recent = TRUE; + folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT; folder = (CamelFolder *)camel_local_folder_construct((CamelLocalFolder *)folder, parent_store, full_name, flags, ex); diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index 8e8b3758a5..bc715e46bc 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -106,8 +106,8 @@ spool_init(gpointer object, gpointer klass) CamelFolder *folder = object; CamelSpoolFolder *spool_folder = object; - folder->has_summary_capability = TRUE; - folder->has_search_capability = TRUE; + folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | + CAMEL_FOLDER_HAS_SEARCH_CAPABILITY); folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT | @@ -227,7 +227,7 @@ camel_spool_folder_new(CamelStore *parent_store, const char *full_name, guint32 if (parent_store->flags & CAMEL_STORE_FILTER_INBOX && strcmp(full_name, "INBOX") == 0) - folder->filter_recent = TRUE; + folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT; folder = (CamelFolder *)camel_spool_folder_construct((CamelSpoolFolder *)folder, parent_store, full_name, flags, ex); diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 0f981be643..8d5e658a3e 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -261,8 +261,8 @@ camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelExcepti const gchar *root_dir_path; camel_folder_construct (folder, parent, folder_name, folder_name); - folder->has_summary_capability = TRUE; - folder->has_search_capability = TRUE; + folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | + CAMEL_FOLDER_HAS_SEARCH_CAPABILITY); root_dir_path = camel_nntp_store_get_toplevel_dir (CAMEL_NNTP_STORE(folder->parent_store)); nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index e5cca11cff..2aaf7dd9fa 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -81,19 +81,6 @@ camel_pop3_folder_class_init (CamelPop3FolderClass *camel_pop3_folder_class) camel_folder_class->set_message_flags = pop3_set_message_flags; } -static void -camel_pop3_folder_init (gpointer object) -{ - CamelFolder *folder = CAMEL_FOLDER (object); - CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object); - - folder->has_summary_capability = FALSE; - folder->has_search_capability = FALSE; - - pop3_folder->uids = NULL; - pop3_folder->flags = NULL; -} - CamelType camel_pop3_folder_get_type (void) { @@ -105,7 +92,7 @@ camel_pop3_folder_get_type (void) sizeof (CamelPop3FolderClass), (CamelObjectClassInitFunc) camel_pop3_folder_class_init, NULL, - (CamelObjectInitFunc) camel_pop3_folder_init, + NULL, (CamelObjectFinalizeFunc) pop3_finalize); } |