diff options
author | Not Zed <NotZed@Ximian.com> | 2004-03-11 11:04:45 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-03-11 11:04:45 +0800 |
commit | 6071a963e85f69133cc1761e37b6ed942629d70d (patch) | |
tree | 95c9e1644c80d083e2baf049e66b9f99c5997051 /camel/providers/local/camel-maildir-store.c | |
parent | ecda7da11e893ff29258388c7b594b5ef4fa902a (diff) | |
download | gsoc2013-evolution-6071a963e85f69133cc1761e37b6ed942629d70d.tar.gz gsoc2013-evolution-6071a963e85f69133cc1761e37b6ed942629d70d.tar.zst gsoc2013-evolution-6071a963e85f69133cc1761e37b6ed942629d70d.zip |
turn off NOINFERIORS always, translate to nochildren.
2004-03-11 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c (get_one_folder_offline):
(parse_list_response_as_folder_info): turn
off NOINFERIORS always, translate to nochildren.
2004-03-08 Not Zed <NotZed@Ximian.com>
* camel-vee-store.c (vee_get_folder_info): setup virtual/system
flags as appropriate.
(change_folder): setup flags properly.
* providers/nntp/camel-nntp-store.c
(nntp_store_get_subscribed_folder_info): mark all folders as
system folders.
* providers/local/camel-mh-store.c (fill_fi): add this to setup
folderinfo.
(folder_info_new): call fill_fi to fill unread/total.
(recursive_scan, folders_scan): ahh yeah, so wtf was i thinking,
store->flags != get_folder_info flags!!!!
* providers/local/camel-maildir-store.c (camel_folder_info_new):
remove unread count arg & setup total.
(fill_fi): setup total field.
(scan_dir): remove the code that checked the directory directly -
use fill_fi instead. It will more accurately reflect what you get
when you visit the folder.
(camel_folder_info_new): mark "." as a system folder.
(scan_dir): try to setup children/no children flags properly.
* providers/local/camel-mbox-store.c (fill_fi): setup total field.
(scan_dir): init total.
(get_folder_info): "
2004-03-05 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c
(parse_list_response_as_folder_info): mark INBOX as a system
folder. Can't be renamed/deleted.
(fill_fi): setup total field.
(get_folder_counts): ditto.
* camel-store.c (add_special_info): set the system folder flag.
* camel-store.h: time to fix up the camelfolderinfo mess. fix
some member names, and add some type fields. Fixed all uses.
svn path=/trunk/; revision=25019
Diffstat (limited to 'camel/providers/local/camel-maildir-store.c')
-rw-r--r-- | camel/providers/local/camel-maildir-store.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index b0412d3d9a..5d0654c6e4 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -222,17 +222,21 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce g_free(new); } -static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, const char *name, int unread) +static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, const char *name) { CamelFolderInfo *fi; fi = g_malloc0(sizeof(*fi)); - fi->url = g_strdup(url); + fi->uri = g_strdup(url); fi->full_name = g_strdup(full); fi->name = g_strdup(name); - fi->unread_message_count = unread; + fi->unread = -1; + fi->total = -1; camel_folder_info_build_path(fi, '/'); + if (!strcmp(full, ".")) + fi->flags |= CAMEL_FOLDER_SYSTEM; + d(printf("Adding maildir info: '%s' '%s' '%s' '%s'\n", fi->path, fi->name, fi->full_name, fi->url)); return fi; @@ -242,13 +246,13 @@ static void fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags) { CamelFolder *folder; - int unread = -1; folder = camel_object_bag_get(store->folders, fi->full_name); if (folder) { if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0) camel_folder_refresh_info(folder, NULL); - unread = camel_folder_get_unread_message_count(folder); + fi->unread = camel_folder_get_unread_message_count(folder); + fi->total = camel_folder_get_message_count(folder); camel_object_unref(folder); } else { char *path, *folderpath; @@ -260,14 +264,14 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags) path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name); folderpath = g_strdup_printf("%s/%s", root, fi->full_name); s = (CamelFolderSummary *)camel_maildir_summary_new(path, folderpath, NULL); - if (camel_folder_summary_header_load(s) != -1) - unread = s->unread_count; + if (camel_folder_summary_header_load(s) != -1) { + fi->unread = s->unread_count; + fi->total = s->saved_count; + } camel_object_unref(s); g_free(folderpath); g_free(path); } - - fi->unread_message_count = unread; } /* used to find out where we've visited already */ @@ -285,8 +289,6 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch const char *base; CamelFolderInfo *fi = NULL; struct stat st; - CamelFolder *folder; - int unread; /* look for folders matching the right structure, recursively */ name = g_strdup_printf("%s/%s", root, path); @@ -310,6 +312,7 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch else base = path; +#if 0 /* if we have this folder open, get the real unread count */ folder = camel_object_bag_get(store->folders, path); if (folder) { @@ -348,16 +351,15 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch closedir(dir); } } - - fi = camel_folder_info_new(uri, path, base, -1); - /* fills the unread count */ +#endif + fi = camel_folder_info_new(uri, path, base); fill_fi(store, fi, flags); d(printf("found! uri = %s\n", fi->url)); d(printf(" full_name = %s\n name = '%s'\n", fi->full_name, fi->name)); fi->parent = parent; - fi->sibling = *fip; + fi->next = *fip; *fip = fi; g_free(uri); @@ -365,10 +367,10 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch g_free(cur); g_free(new); - unread = 0; - /* always look further if asked */ if (((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) || parent == NULL)) { + int children = 0; + dir = opendir(name); if (dir == NULL) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -394,6 +396,8 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch if (g_hash_table_lookup(visited, &in) == NULL) { struct _inode *inew = g_malloc(sizeof(*inew)); + children++; + *inew = in; g_hash_table_insert(visited, inew, inew); new = g_strdup_printf("%s/%s", path, d->d_name); @@ -409,6 +413,11 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch g_free(tmp); } closedir(dir); + + if (children) + fi->flags |= CAMEL_FOLDER_CHILDREN; + else + fi->flags |= CAMEL_FOLDER_NOCHILDREN; } g_free(name); |