Changes to disable cut/copy with images (fixes NB#80355).
[modest] / src / modest-tny-send-queue.c
index b1f8560..db4a1af 100644 (file)
@@ -73,7 +73,7 @@ static void _on_msg_error_happened (TnySendQueue *self,
 static void _on_queue_start        (TnySendQueue *self, 
                                    gpointer user_data);
 
-static void modest_tny_send_queue_add_async (TnyCamelSendQueue *self, 
+static void modest_tny_send_queue_add_async (TnySendQueue *self, 
                                             TnyMsg *msg, 
                                             TnySendQueueAddCallback callback, 
                                             TnyStatusCallback status_callback, 
@@ -275,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);
 }
 
 
@@ -348,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] =
@@ -514,12 +514,8 @@ modest_tny_send_queue_get_msg_id (TnyHeader *header)
 
 
 static void
-_on_msg_start_sending (TnySendQueue *self,
-                      TnyHeader *header,
-                      TnyMsg *msg,
-                      int done, 
-                      int total,
-                      gpointer user_data)
+_on_msg_start_sending (TnySendQueue *self, TnyHeader *header,
+                      TnyMsg *msg, int done, int total, gpointer user_data)
 {
        ModestTnySendQueuePrivate *priv = NULL;
        GList *item = NULL;
@@ -530,16 +526,20 @@ _on_msg_start_sending (TnySendQueue *self,
        
        /* Get message uid */
        msg_id = modest_tny_send_queue_get_msg_id (header);
-
-       /* Get status info */
-       item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self), msg_id);
-
-       /* Set current status item */
-       info = item->data;
-       info->status = MODEST_TNY_SEND_QUEUE_SENDING;
-       g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status);
-       priv->current = item;
-
+       if (msg_id) 
+               item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self), msg_id);
+       else
+               g_warning ("%s: could not get msg-id for header", __FUNCTION__);
+       
+       if (item) {
+               /* Set current status item */
+               info = item->data;
+               info->status = MODEST_TNY_SEND_QUEUE_SENDING;
+               g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status);
+               priv->current = item;
+       } else
+               g_warning ("%s: could not find item with id '%s'", __FUNCTION__, msg_id);
+       
        /* free */
        g_free (msg_id);
 }
@@ -748,6 +748,9 @@ modest_tny_send_queue_wakeup (ModestTnySendQueue *self)
                tny_iterator_next (iter);
        }
 
+       /* Make changes persistent on disk */
+       tny_folder_sync (priv->outbox, FALSE, NULL);
+
        /* Frees */
        g_object_unref (iter);
        g_object_unref (G_OBJECT (headers));