aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-vfolder.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r--mail/mail-vfolder.c86
1 files changed, 37 insertions, 49 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 9f4b8e2d94..6397ca772a 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -21,7 +21,7 @@
*/
#include <config.h>
-
+#include <pthread.h>
#include <string.h>
#include <glib.h>
@@ -75,7 +75,7 @@ static void rule_changed(FilterRule *rule, CamelFolder *folder);
/* ********************************************************************** */
struct _setup_msg {
- struct _mail_msg msg;
+ MailMsg base;
CamelFolder *folder;
char *query;
@@ -83,18 +83,15 @@ struct _setup_msg {
GList *sources_folder;
};
-static char *
-vfolder_setup_desc(struct _mail_msg *mm, int done)
+static gchar *
+vfolder_setup_desc (struct _setup_msg *m)
{
- struct _setup_msg *m = (struct _setup_msg *)mm;
-
return g_strdup_printf(_("Setting up Search Folder: %s"), m->folder->full_name);
}
static void
-vfolder_setup_do(struct _mail_msg *mm)
+vfolder_setup_exec (struct _setup_msg *m)
{
- struct _setup_msg *m = (struct _setup_msg *)mm;
GList *l, *list = NULL;
CamelFolder *folder;
@@ -105,12 +102,12 @@ vfolder_setup_do(struct _mail_msg *mm)
l = m->sources_uri;
while (l && !shutdown) {
d(printf(" Adding uri: %s\n", (char *)l->data));
- folder = mail_tool_uri_to_folder (l->data, 0, &mm->ex);
+ folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex);
if (folder) {
list = g_list_append(list, folder);
} else {
g_warning("Could not open vfolder source: %s", (char *)l->data);
- camel_exception_clear(&mm->ex);
+ camel_exception_clear(&m->base.ex);
}
l = l->next;
}
@@ -135,17 +132,13 @@ vfolder_setup_do(struct _mail_msg *mm)
}
static void
-vfolder_setup_done(struct _mail_msg *mm)
+vfolder_setup_done (struct _setup_msg *m)
{
- struct _setup_msg *m = (struct _setup_msg *)mm;
-
- m = m;
}
static void
-vfolder_setup_free (struct _mail_msg *mm)
+vfolder_setup_free (struct _setup_msg *m)
{
- struct _setup_msg *m = (struct _setup_msg *)mm;
GList *l;
camel_object_unref(m->folder);
@@ -166,11 +159,12 @@ vfolder_setup_free (struct _mail_msg *mm)
g_list_free(m->sources_folder);
}
-static struct _mail_msg_op vfolder_setup_op = {
- vfolder_setup_desc,
- vfolder_setup_do,
- vfolder_setup_done,
- vfolder_setup_free,
+static MailMsgInfo vfolder_setup_info = {
+ sizeof (struct _setup_msg),
+ (MailMsgDescFunc) vfolder_setup_desc,
+ (MailMsgExecFunc) vfolder_setup_exec,
+ (MailMsgDoneFunc) vfolder_setup_done,
+ (MailMsgFreeFunc) vfolder_setup_free
};
/* sources_uri should be camel uri's */
@@ -180,15 +174,15 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList
struct _setup_msg *m;
int id;
- m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m));
+ m = mail_msg_new(&vfolder_setup_info);
m->folder = folder;
camel_object_ref(folder);
m->query = g_strdup(query);
m->sources_uri = sources_uri;
m->sources_folder = sources_folder;
- id = m->msg.seq;
- e_thread_put(mail_thread_queued_slow, (EMsg *)m);
+ id = m->base.seq;
+ mail_msg_slow_ordered_push (m);
return id;
}
@@ -196,17 +190,16 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList
/* ********************************************************************** */
struct _adduri_msg {
- struct _mail_msg msg;
+ MailMsg base;
char *uri;
GList *folders;
int remove;
};
-static char *
-vfolder_adduri_desc(struct _mail_msg *mm, int done)
+static gchar *
+vfolder_adduri_desc (struct _adduri_msg *m)
{
- struct _adduri_msg *m = (struct _adduri_msg *)mm;
char *euri, *desc = NULL;
/* Yuck yuck. Lookup the account name and use that to describe the path */
@@ -250,9 +243,8 @@ vfolder_adduri_desc(struct _mail_msg *mm, int done)
}
static void
-vfolder_adduri_do(struct _mail_msg *mm)
+vfolder_adduri_exec (struct _adduri_msg *m)
{
- struct _adduri_msg *m = (struct _adduri_msg *)mm;
GList *l;
CamelFolder *folder = NULL;
@@ -269,7 +261,7 @@ vfolder_adduri_do(struct _mail_msg *mm)
}
if (folder == NULL)
- folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex);
+ folder = mail_tool_uri_to_folder (m->uri, 0, &m->base.ex);
if (folder != NULL) {
l = m->folders;
@@ -285,28 +277,24 @@ vfolder_adduri_do(struct _mail_msg *mm)
}
static void
-vfolder_adduri_done(struct _mail_msg *mm)
+vfolder_adduri_done(struct _adduri_msg *m)
{
- struct _adduri_msg *m = (struct _adduri_msg *)mm;
-
- m = m;
}
static void
-vfolder_adduri_free (struct _mail_msg *mm)
+vfolder_adduri_free (struct _adduri_msg *m)
{
- struct _adduri_msg *m = (struct _adduri_msg *)mm;
-
g_list_foreach(m->folders, (GFunc)camel_object_unref, NULL);
g_list_free(m->folders);
g_free(m->uri);
}
-static struct _mail_msg_op vfolder_adduri_op = {
- vfolder_adduri_desc,
- vfolder_adduri_do,
- vfolder_adduri_done,
- vfolder_adduri_free,
+static MailMsgInfo vfolder_adduri_info = {
+ sizeof (struct _adduri_msg),
+ (MailMsgDescFunc) vfolder_adduri_desc,
+ (MailMsgExecFunc) vfolder_adduri_exec,
+ (MailMsgDoneFunc) vfolder_adduri_done,
+ (MailMsgFreeFunc) vfolder_adduri_free
};
@@ -317,13 +305,13 @@ vfolder_adduri(const char *uri, GList *folders, int remove)
struct _adduri_msg *m;
int id;
- m = mail_msg_new(&vfolder_adduri_op, NULL, sizeof (*m));
+ m = mail_msg_new(&vfolder_adduri_info);
m->folders = folders;
m->uri = g_strdup(uri);
m->remove = remove;
- id = m->msg.seq;
- e_thread_put(mail_thread_queued_slow, (EMsg *)m);
+ id = m->base.seq;
+ mail_msg_slow_ordered_push (m);
return id;
}
@@ -447,7 +435,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove)
return;
}
- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (mail_in_main_thread());
is_ignore = uri_is_ignore(store, curi);
@@ -543,7 +531,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
d(printf ("Deleting uri to check: %s\n", uri));
- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (mail_in_main_thread());
changed = g_string_new ("");
@@ -627,7 +615,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto))
return;
- g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (mail_in_main_thread());
from = em_uri_from_camel(cfrom);
to = em_uri_from_camel(cto);