Don't pass the header_list in GetMsgInfo, it's not needed
[modest] / src / modest-tny-send-queue.c
index 43b9b7f..8a6b9a1 100644 (file)
@@ -70,11 +70,15 @@ static void _on_msg_error_happened (TnySendQueue *self,
                                    GError *err, 
                                    gpointer user_data);
 
-static void modest_tny_send_queue_add_async (TnyCamelSendQueue *self, 
+static void _on_queue_start        (TnySendQueue *self, 
+                                   gpointer user_data);
+
+static void modest_tny_send_queue_add_async (TnySendQueue *self, 
                                             TnyMsg *msg, 
                                             TnySendQueueAddCallback callback, 
                                             TnyStatusCallback status_callback, 
                                             gpointer user_data);
+
 static TnyFolder* modest_tny_send_queue_get_outbox  (TnySendQueue *self);
 static TnyFolder* modest_tny_send_queue_get_sentbox (TnySendQueue *self);
 
@@ -271,14 +275,14 @@ _add_message (ModestTnySendQueue *self, TnyHeader *header)
 }
 
 static void 
-modest_tny_send_queue_add_async (TnyCamelSendQueue *self, 
+modest_tny_send_queue_add_async (TnySendQueue *self, 
                                 TnyMsg *msg, 
                                 TnySendQueueAddCallback callback, 
                                 TnyStatusCallback status_callback, 
                                 gpointer user_data)
 {
        /* Call the superclass passing our own callback */
-       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_async_func (self, msg, _on_added_to_outbox, NULL, NULL);
+       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_async (self, msg, _on_added_to_outbox, NULL, NULL);
 }
 
 
@@ -344,9 +348,9 @@ modest_tny_send_queue_class_init (ModestTnySendQueueClass *klass)
        parent_class            = g_type_class_peek_parent (klass);
        gobject_class->finalize = modest_tny_send_queue_finalize;
 
-       TNY_CAMEL_SEND_QUEUE_CLASS(klass)->add_async_func  = modest_tny_send_queue_add_async;
-       TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_outbox_func  = modest_tny_send_queue_get_outbox;
-        TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_sentbox_func = modest_tny_send_queue_get_sentbox;
+       TNY_CAMEL_SEND_QUEUE_CLASS(klass)->add_async   = modest_tny_send_queue_add_async;
+       TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_outbox  = modest_tny_send_queue_get_outbox;
+        TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_sentbox = modest_tny_send_queue_get_sentbox;
        klass->status_changed   = NULL;
 
        signals[STATUS_CHANGED_SIGNAL] =
@@ -409,6 +413,9 @@ modest_tny_send_queue_new (TnyCamelTransportAccount *account)
        g_signal_connect (G_OBJECT(self), "error-happened",
                          G_CALLBACK(_on_msg_error_happened),
                          NULL);
+       g_signal_connect (G_OBJECT (self), "queue-start",
+                         G_CALLBACK (_on_queue_start),
+                         NULL);
 
        /* Set outbox and sentbox */
        priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
@@ -614,6 +621,19 @@ _on_msg_error_happened (TnySendQueue *self,
 }
 
 static void 
+_on_queue_start (TnySendQueue *self,
+                gpointer data)
+{
+       ModestMailOperation *mail_op;
+
+       mail_op = modest_mail_operation_new (NULL);
+       modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
+                                        mail_op);
+       modest_mail_operation_run_queue (mail_op, MODEST_TNY_SEND_QUEUE (self));
+       g_object_unref (mail_op);
+}
+
+static void 
 fill_list_of_caches (gpointer key, gpointer value, gpointer userdata)
 {
        GSList **send_queues = (GSList **) userdata;