aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-mt.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-06-16 15:11:20 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-06-16 15:11:20 +0800
commita2d2fa53ef98e33fb45aeda6be10189f0ac298a9 (patch)
treea817a356c80b64646236b4c7b156f089324c7e6c /mail/mail-mt.c
parentd60e4144e5c756e478e0b09e3e22596e9d397527 (diff)
downloadgsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar.gz
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar.bz2
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar.lz
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar.xz
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.tar.zst
gsoc2013-evolution-a2d2fa53ef98e33fb45aeda6be10189f0ac298a9.zip
** See #56479.
2004-06-16 Not Zed <NotZed@Ximian.com> ** See #56479. * em-utils.c (em_utils_in_addressbook): use the main thread to setup the addressbook list. (em_utils_in_addressbook): only check against the "completion" sources, not all of them. 2004-06-15 Not Zed <NotZed@Ximian.com> * em-folder-browser.c (emfb_mail_stop): call mail_cancel_all to implement the stop button. * em-utils.c (emu_addr_sources_refresh): don't unref the group list, otherwise the sources become broken now (?). (em_utils_in_addressbook): add some locking. add cancellation. this is almost certainly going to cause issues. * mail-mt.c (mail_cancel_hook_add, mail_cancel_hook_remove) (mail_cancel_all): new functions to implement a global mailer stop button. svn path=/trunk/; revision=26363
Diffstat (limited to 'mail/mail-mt.c')
-rw-r--r--mail/mail-mt.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 1581d283bb..457fd4c43f 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -352,6 +352,60 @@ void mail_msg_wait_all(void)
}
}
+/* **************************************** */
+struct _cancel_hook_data {
+ struct _cancel_hook_data *next;
+ struct _cancel_hook_data *prev;
+
+ GDestroyNotify func;
+ void *data;
+};
+
+static EDList cancel_hook_list = E_DLIST_INITIALISER(cancel_hook_list);
+
+void *mail_cancel_hook_add(GDestroyNotify func, void *data)
+{
+ struct _cancel_hook_data *d;
+
+ d = g_malloc0(sizeof(*d));
+ d->func = func;
+ d->data = data;
+
+ MAIL_MT_LOCK(mail_msg_lock);
+ e_dlist_addtail(&cancel_hook_list, (EDListNode *)d);
+ MAIL_MT_UNLOCK(mail_msg_lock);
+
+ return (void *)d;
+}
+
+void mail_cancel_hook_remove(void *handle)
+{
+ struct _cancel_hook_data *d = handle;
+
+ MAIL_MT_LOCK(mail_msg_lock);
+ e_dlist_remove((EDListNode *)d);
+ MAIL_MT_UNLOCK(mail_msg_lock);
+ g_free(d);
+}
+
+void mail_cancel_all(void)
+{
+ struct _cancel_hook_data *d, *n;
+
+ camel_operation_cancel(NULL);
+
+ /* I can ssee a deadlock coming on ... */
+ MAIL_MT_LOCK(mail_msg_lock);
+ d = (struct _cancel_hook_data *)cancel_hook_list.head;
+ n = d->next;
+ while (n) {
+ d->func(d->data);
+ d = n;
+ n = n->next;
+ }
+ MAIL_MT_UNLOCK(mail_msg_lock);
+}
+
EMsgPort *mail_gui_port;
static GIOChannel *mail_gui_channel;
static guint mail_gui_watch;