aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/folder-browser-factory.c3
-rw-r--r--mail/mail-callbacks.c8
-rw-r--r--mail/mail-callbacks.h2
-rw-r--r--mail/mail-mt.c2
-rw-r--r--mail/mail-ops.c27
6 files changed, 43 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 048d90ce25..4ea2c51312 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+2001-01-16 Not Zed <NotZed@Ximian.com>
+
+ * mail-ops.c (mail_do_fetch_mail): Setup a cancellation handle.
+ (do_fetch_mail): REgister for cancellation here.
+ (cleanup_fetch_mail): And unregister for cancellation here.
+ (mail_get_message): Add a cancel handle.
+ (get_message_get): Register/deregister for cancel.
+ (get_message_free): & clean up.
+
+ * mail-mt.c (mail_msg_received): Removed debuggng.
+
+ * mail-callbacks.c (stop_threads): Callback for stopping.
+
+ * folder-browser-factory.c: Add a stop button verb thingy.
+ (control_activate): Disable the stop button by default.
+
2001-01-15 Christopher James Lahey <clahey@ximian.com>
* message-list.c, message-list.h: Change from using filters for
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index 5deaacadcc..ce574dfaa5 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -93,6 +93,7 @@ BonoboUIVerb verbs [] = {
/* Toolbar specific */
BONOBO_UI_UNSAFE_VERB ("MailGet", send_receieve_mail),
BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg),
+ BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads),
BONOBO_UI_VERB_END
};
@@ -179,6 +180,8 @@ control_activate (BonoboControl *control,
update_pixmaps (uic);
+ /*bonobo_ui_component_set_prop(uic, "/Toolbar/Stop", "sensitive", "0", NULL);*/
+
bonobo_ui_component_thaw (uic, NULL);
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index c5472d961b..9dada3f929 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1139,3 +1139,11 @@ edit_message (BonoboUIComponent *uih, void *user_data, const char *path)
{
edit_msg (NULL, user_data);
}
+
+
+void
+stop_threads(BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ camel_cancel_cancel(NULL);
+}
+
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index d529600ceb..0d9ccd2183 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -71,6 +71,8 @@ void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char
void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path);
+void stop_threads (BonoboUIComponent *uih, void *user_data, const char *path);
+
void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all);
void composer_send_cb (EMsgComposer *composer, gpointer data);
void composer_postpone_cb (EMsgComposer *composer, gpointer data);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index b12bd2b2de..b18f78c06e 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -191,7 +191,7 @@ mail_msg_received(EThread *e, EMsg *msg, void *data)
if (m->ops->describe_msg) {
char *text = m->ops->describe_msg(m, FALSE);
- printf("message received at thread\n");
+ d(printf("message received at thread\n"));
mail_status_start(text);
g_free(text);
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 27351fe700..47a7933e70 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -56,6 +56,7 @@ typedef struct fetch_mail_input_s
CamelFolder *destination;
gpointer hook_func;
gpointer hook_data;
+ CamelCancel *cancel;
}
fetch_mail_input_t;
@@ -201,6 +202,8 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex)
FILE *logfile = NULL;
CamelFolder *folder;
+ camel_cancel_register(input->cancel);
+
/* FIXME: This shouldn't be checking for "imap" specifically. */
if (!strncmp (input->source_url, "imap:", 5)) {
CamelStore *store;
@@ -332,6 +335,9 @@ cleanup_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex)
fetch_mail_input_t *input = (fetch_mail_input_t *) in_data;
fetch_mail_data_t *data = (fetch_mail_data_t *) op_data;
+ camel_cancel_unregister(input->cancel);
+ camel_cancel_unref(input->cancel);
+
if (data->empty && !camel_exception_is_set (ex))
mail_op_set_message (_("There is no new mail at %s."),
input->source_url);
@@ -385,7 +391,8 @@ mail_do_fetch_mail (const gchar *source_url, gboolean keep_on_server,
input->destination = destination;
input->hook_func = hook_func;
input->hook_data = hook_data;
-
+ input->cancel = camel_cancel_new();
+
mail_operation_queue (&op_fetch_mail, input, TRUE);
}
@@ -529,19 +536,6 @@ struct _send_mail_msg {
void *data;
};
-#if 0
-{
- /* If done_folder != NULL, will add done_flags to
- * the flags of the message done_uid in done_folder. */
-
- CamelFolder *done_folder;
- char *done_uid;
- guint32 done_flags;
-
- GtkWidget *composer;
-}
-#endif
-
static char *send_mail_desc(struct _mail_msg *mm, int done)
{
struct _send_mail_msg *m = (struct _send_mail_msg *)mm;
@@ -1434,6 +1428,7 @@ struct _get_message_msg {
void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data);
void *data;
CamelMimeMessage *message;
+ CamelCancel *cancel;
};
static char *get_message_desc(struct _mail_msg *mm, int done)
@@ -1447,7 +1442,9 @@ static void get_message_get(struct _mail_msg *mm)
{
struct _get_message_msg *m = (struct _get_message_msg *)mm;
+ camel_cancel_register(m->cancel);
m->message = camel_folder_get_message(m->folder, m->uid, &mm->ex);
+ camel_cancel_unregister(m->cancel);
}
static void get_message_got(struct _mail_msg *mm)
@@ -1464,6 +1461,7 @@ static void get_message_free(struct _mail_msg *mm)
g_free(m->uid);
camel_object_unref((CamelObject *)m->folder);
+ camel_cancel_unref(m->cancel);
}
static struct _mail_msg_op get_message_op = {
@@ -1484,6 +1482,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder
m->uid = g_strdup(uid);
m->data = data;
m->done = done;
+ m->cancel = camel_cancel_new();
e_thread_put(thread, (EMsg *)m);
}