diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-12-04 00:47:16 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-04 00:47:16 +0800 |
commit | 15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2 (patch) | |
tree | 9de6bd8653dd3f22fbff52146a71591abd5a1040 | |
parent | 4d8aef368f8eb4d518741a20c4ae6fc113f2545d (diff) | |
download | gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar.gz gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar.bz2 gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar.lz gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar.xz gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.tar.zst gsoc2013-evolution-15585cc9c6eb9a24c4c03e8c5bc34e36aa3474a2.zip |
Only add vTrash/vJunk info's if we've requested the toplevel folder tree,
2003-12-03 Jeffrey Stedfast <fejj@ximian.com>
* camel-store.c (camel_store_get_folder_info): Only add
vTrash/vJunk info's if we've requested the toplevel folder tree,
otherwise we get vTrash/vJunk folders in odd places in the folder
tree.
(add_special_info): Use the provider->url_flags to determine if
the url uses the fragment or not for the path.
svn path=/trunk/; revision=23606
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/camel-store.c | 40 |
2 files changed, 31 insertions, 18 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index a24189bd76..4e77a363a3 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2003-12-03 Jeffrey Stedfast <fejj@ximian.com> + + * camel-store.c (camel_store_get_folder_info): Only add + vTrash/vJunk info's if we've requested the toplevel folder tree, + otherwise we get vTrash/vJunk folders in odd places in the folder + tree. + (add_special_info): Use the provider->url_flags to determine if + the url uses the fragment or not for the path. + 2003-12-02 Not Zed <NotZed@Ximian.com> ** See bug #51478. diff --git a/camel/camel-store.c b/camel/camel-store.c index c0a213a22f..ad88c7e1bc 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -690,14 +690,16 @@ get_folder_info (CamelStore *store, const char *top, } static void -add_special_info (CamelStore *store, CamelFolderInfo *info, gchar *name, gchar *full_name, gchar *url_base, gboolean unread_count) +add_special_info (CamelStore *store, CamelFolderInfo *info, const char *name, const char *full_name, + const char *url_base, gboolean unread_count) { CamelFolderInfo *fi, *vinfo, *parent; + CamelProvider *provider; char *uri, *path; CamelURL *url; g_return_if_fail (info != NULL); - + parent = NULL; for (fi = info; fi; fi = fi->sibling) { if (!strcmp (fi->name, name)) @@ -707,12 +709,14 @@ add_special_info (CamelStore *store, CamelFolderInfo *info, gchar *name, gchar * /* create our vTrash/vJunk URL */ url = camel_url_new (info->url, NULL); - path = g_strdup_printf ("/%s", name); - if (url->fragment) - camel_url_set_fragment (url, path); - else + if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) { + camel_url_set_fragment (url, name); + } else { + path = g_strdup_printf ("/%s", name); camel_url_set_path (url, path); - g_free (path); + g_free (path); + } + uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free (url); @@ -725,23 +729,23 @@ add_special_info (CamelStore *store, CamelFolderInfo *info, gchar *name, gchar * } else { /* There wasn't a Trash/Junk folder so create a new folder entry */ vinfo = g_new0 (CamelFolderInfo, 1); - + g_assert(parent != NULL); - + vinfo->flags |= CAMEL_FOLDER_NOINFERIORS | CAMEL_FOLDER_SUBSCRIBED; - + /* link it into the right spot */ vinfo->sibling = parent->sibling; parent->sibling = vinfo; } - + /* Fill in the new fields */ vinfo->full_name = g_strdup (full_name); - vinfo->name = g_strdup(vinfo->full_name); + vinfo->name = g_strdup (vinfo->full_name); vinfo->url = g_strdup_printf ("%s:%s", url_base, uri); if (!unread_count) vinfo->unread_message_count = -1; - vinfo->path = g_strdup_printf("/%s", vinfo->name); + vinfo->path = g_strdup_printf ("/%s", vinfo->name); g_free (uri); } @@ -772,23 +776,23 @@ camel_store_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex) { CamelFolderInfo *info; - + g_return_val_if_fail (CAMEL_IS_STORE (store), NULL); g_return_val_if_fail ((store->flags & CAMEL_STORE_SUBSCRIPTIONS) || !(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED), NULL); - + CAMEL_STORE_LOCK(store, folder_lock); info = CS_CLASS (store)->get_folder_info (store, top, flags, ex); CAMEL_STORE_UNLOCK(store, folder_lock); - - if (info) { + + if (info && (top == NULL || *top == '\0')) { if (info->url && (store->flags & CAMEL_STORE_VTRASH)) add_special_info (store, info, CAMEL_VTRASH_NAME, _("Trash"), "vtrash", FALSE); if (info->url && (store->flags & CAMEL_STORE_VJUNK)) add_special_info (store, info, CAMEL_VJUNK_NAME, _("Junk"), "vjunk", TRUE); } - + return info; } |