aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-05-24 04:56:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-05-24 04:56:57 +0800
commit76f220863e83aa27c4f2d9efe214f697885072e0 (patch)
tree296850387147ef496b6b3a1054fc1e2cfa9e7ace /mail/mail-ops.c
parentcd75a45fc98b686fc180feb3209bbfd2e1c4413b (diff)
downloadgsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar.gz
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar.bz2
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar.lz
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar.xz
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.tar.zst
gsoc2013-evolution-76f220863e83aa27c4f2d9efe214f697885072e0.zip
New async function to remove a folder. God knows if it does what the
2001-05-23 Jeffrey Stedfast <fejj@ximian.com> * mail-ops.c (mail_remove_folder): New async function to remove a folder. God knows if it does what the ShellComponent needs or not yet. * component-factory.c (storage_remove_folder): New function for removing folders. (remove_folder): New function that the shell component calls to delete a folder. (component_fn): Set the remove_folder_fn argument. svn path=/trunk/; revision=9952
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 5b106636dc..23c0b047db 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1382,6 +1382,87 @@ mail_create_folder(const char *uri, void (*done) (char *uri, CamelFolder *folder
e_thread_put(mail_thread_new, (EMsg *)m);
}
+/* ** REMOVE FOLDER ******************************************************* */
+
+struct _remove_folder_msg {
+ struct _mail_msg msg;
+
+ char *uri;
+ gboolean removed;
+ void (*done) (char *uri, gboolean removed, void *data);
+ void *data;
+};
+
+static char *
+remove_folder_desc (struct _mail_msg *mm, int done)
+{
+ struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm;
+
+ return g_strdup_printf (_("Removing folder %s"), m->uri);
+}
+
+static void
+remove_folder_get (struct _mail_msg *mm)
+{
+ struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm;
+ CamelStore *store;
+ CamelURL *url;
+
+ m->removed = FALSE;
+
+ camel_operation_register (mm->cancel);
+
+ store = camel_session_get_store (session, m->uri, &mm->ex);
+ if (!store)
+ goto done;
+
+ url = camel_url_new (m->uri, NULL);
+ camel_store_delete_folder (store, url->path + 1, &mm->ex);
+ m->removed = !camel_exception_is_set (&mm->ex);
+ camel_object_unref (CAMEL_OBJECT (store));
+ camel_url_free (url);
+
+ done:
+ camel_operation_unregister (mm->cancel);
+}
+
+static void
+remove_folder_got (struct _mail_msg *mm)
+{
+ struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm;
+
+ if (m->done)
+ m->done (m->uri, m->removed, m->data);
+}
+
+static void
+remove_folder_free (struct _mail_msg *mm)
+{
+ struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm;
+
+ g_free (m->uri);
+}
+
+static struct _mail_msg_op remove_folder_op = {
+ remove_folder_desc,
+ remove_folder_get,
+ remove_folder_got,
+ remove_folder_free,
+};
+
+void
+mail_remove_folder (const char *uri, void (*done) (char *uri, gboolean removed, void *data), void *data)
+{
+ struct _remove_folder_msg *m;
+
+ m = mail_msg_new (&remove_folder_op, NULL, sizeof (*m));
+ m->uri = g_strdup (uri);
+ m->data = data;
+ m->done = done;
+
+ e_thread_put (mail_thread_new, (EMsg *)m);
+}
+
/* ** SYNC FOLDER ********************************************************* */
struct _sync_folder_msg {