camel_folder_create_folder can now return a heirachial tree so subscribe

2001-08-20  Jeffrey Stedfast  <fejj@ximian.com>

	* component-factory.c (storage_create_folder):
	camel_folder_create_folder can now return a heirachial tree so
	subscribe to down the tree.

svn path=/trunk/; revision=12257
This commit is contained in:
Jeffrey Stedfast
2001-08-20 07:29:26 +00:00
committed by Jeffrey Stedfast
parent fd2c106a51
commit 41dcb0c01b
3 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2001-08-20 Jeffrey Stedfast <fejj@ximian.com>
* component-factory.c (storage_create_folder):
camel_folder_create_folder can now return a heirachial tree so
subscribe to down the tree.
2001-08-20 Damon Chaplin <damon@ximian.com>
* folder-browser-ui.c: use new Cut/Copy/Paste icons.

View File

@ -793,14 +793,14 @@ storage_create_folder (EvolutionStorage *storage,
gpointer user_data)
{
CamelStore *store = user_data;
CamelFolderInfo *root, *fi;
char *prefix, *name;
CamelURL *url;
CamelException ex;
CamelFolderInfo *fi;
if (strcmp (type, "mail") != 0)
return EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE;
name = strrchr (path, '/');
if (!name++)
return EVOLUTION_STORAGE_ERROR_INVALID_URI;
@ -811,10 +811,10 @@ storage_create_folder (EvolutionStorage *storage,
if (!url)
return EVOLUTION_STORAGE_ERROR_INVALID_URI;
fi = camel_store_create_folder (store, url->path + 1, name, &ex);
root = camel_store_create_folder (store, url->path + 1, name, &ex);
camel_url_free (url);
} else
fi = camel_store_create_folder (store, NULL, name, &ex);
root = camel_store_create_folder (store, NULL, name, &ex);
if (camel_exception_is_set (&ex)) {
/* FIXME: do better than this */
@ -822,14 +822,16 @@ storage_create_folder (EvolutionStorage *storage,
return EVOLUTION_STORAGE_ERROR_INVALID_URI;
}
if (camel_store_supports_subscriptions (store))
camel_store_subscribe_folder (store, fi->full_name, NULL);
if (camel_store_supports_subscriptions (store)) {
for (fi = root; fi; fi = fi->child)
camel_store_subscribe_folder (store, fi->full_name, NULL);
}
prefix = g_strndup (path, name - path - 1);
folder_created (store, prefix, fi);
folder_created (store, prefix, root);
g_free (prefix);
camel_store_free_folder_info (store, fi);
camel_store_free_folder_info (store, root);
return EVOLUTION_STORAGE_OK;
}

View File

@ -2115,12 +2115,12 @@ static void
create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo *fi)
{
char *path;
mail_folder_cache_set_update_estorage (fi->url, storage);
mail_folder_cache_note_folderinfo (fi->url, fi);
path = g_strdup_printf ("%s/%s", prefix, fi->name);
if (!strncmp (fi->url, "vtrash:", 7))
evolution_storage_new_folder (storage, path, fi->name,
"vtrash", fi->url,
@ -2131,7 +2131,7 @@ create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo *
"mail", fi->url,
fi->name, /* description */
fi->unread_message_count > 0);
if (fi->child)
create_folders (storage, path, fi->child);
g_free (path);
@ -2141,12 +2141,12 @@ create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo *
}
void
folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *fi)
folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *root)
{
EvolutionStorage *storage;
if ((storage = mail_lookup_storage (store))) {
create_folders (storage, prefix, fi);
create_folders (storage, prefix, root);
bonobo_object_unref (BONOBO_OBJECT (storage));
}
}