aboutsummaryrefslogtreecommitdiffstats
path: root/mail/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/session.c')
-rw-r--r--mail/session.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/mail/session.c b/mail/session.c
index 8e8ff6e4bf..53c694206b 100644
--- a/mail/session.c
+++ b/mail/session.c
@@ -25,7 +25,6 @@
#include <gnome.h>
#include "mail.h"
#include "mail-session.h"
-#include "mail-threads.h"
#include "mail-mt.h"
CamelSession *session;
@@ -173,63 +172,54 @@ mail_session_remember_password (const char *url)
/* ******************** */
-typedef struct _timeout_data_s {
+struct _timeout_data {
CamelTimeoutCallback cb;
gpointer camel_data;
gboolean result;
-} timeout_data_t;
-
-static gchar *
-describe_camel_timeout (gpointer in_data, gboolean gerund)
-{
- /* FIXME this is so wrong */
+};
- if (gerund)
- return g_strdup ("Keeping connection alive");
- else
- return g_strdup ("Keep connection alive");
-}
+struct _timeout_msg {
+ struct _mail_msg msg;
-static void
-noop_camel_timeout (gpointer in_data, gpointer op_data, CamelException *ex)
-{
-}
+ CamelTimeoutCallback cb;
+ gpointer camel_data;
+};
-static void
-do_camel_timeout (gpointer in_data, gpointer op_data, CamelException *ex)
+static void timeout_timeout(struct _mail_msg *mm)
{
- timeout_data_t *td = (timeout_data_t *) in_data;
+ struct _timeout_msg *m = (struct _timeout_msg *)mm;
- td->result = (td->cb) (td->camel_data);
+ /* we ignore the callback result, do we care?? no. */
+ m->cb(m->camel_data);
}
-static const mail_operation_spec spec_camel_timeout =
-{
- describe_camel_timeout,
- 0,
- noop_camel_timeout,
- do_camel_timeout,
- noop_camel_timeout
+static struct _mail_msg_op timeout_op = {
+ NULL,
+ timeout_timeout,
+ NULL,
+ NULL,
};
static gboolean
camel_timeout (gpointer data)
{
- timeout_data_t *td = (timeout_data_t *) data;
+ struct _timeout_data *td = data;
+ struct _timeout_msg *m;
- if (td->result == FALSE) {
- g_free (td);
- return FALSE;
- }
+ m = mail_msg_new(&timeout_op, NULL, sizeof(*m));
+
+ m->cb = td->cb;
+ m->camel_data = td->camel_data;
+
+ e_thread_put(mail_thread_queued, (EMsg *)m);
- mail_operation_queue (&spec_camel_timeout, td, FALSE);
return TRUE;
}
static guint
register_callback (guint32 interval, CamelTimeoutCallback cb, gpointer camel_data)
{
- timeout_data_t *td;
+ struct _timeout_data *td;
/* We do this because otherwise the timeout can get called
* more often than the dispatch thread can get rid of it,
@@ -238,13 +228,12 @@ register_callback (guint32 interval, CamelTimeoutCallback cb, gpointer camel_dat
*/
g_return_val_if_fail (interval > 1000, 0);
- td = g_new (timeout_data_t, 1);
+ td = g_malloc(sizeof(*td));
td->result = TRUE;
td->cb = cb;
td->camel_data = camel_data;
- return gtk_timeout_add_full (interval, camel_timeout, NULL,
- td, g_free);
+ return gtk_timeout_add_full(interval, camel_timeout, NULL, td, g_free);
}
static gboolean