Changeset 3595

Show
Ignore:
Timestamp:
04/17/08 11:20:19
Author:
pvanhoof
Message:

2008-04-17 Philip Van Hoof <pvanhoof@gnome.org>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3594 r3595  
     12008-04-17  Philip Van Hoof <pvanhoof@gnome.org> 
     2 
     3        * Corrections to reference handling for TnyCamelSendQueue 
     4 
    152008-04-16  José Dapena Paz  <jdapena@igalia.com> 
    26 
  • trunk/libtinymail-camel/tny-camel-send-queue.c

    r3539 r3595  
    330330        TnySendQueue *self; 
    331331        TnyDevice *device; 
     332        TnyAccount *outbox_account, *sentbox_account; 
     333        TnyFolder *outbox, *sentbox; 
    332334} MainThreadInfo; 
    333335 
     
    338340        TnySendQueue *self = info->self; 
    339341        TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self); 
    340         TnyFolder *sentbox = NULL, *outbox = NULL; 
    341342        guint i = 0, length = 0; 
    342343        TnyList *list = NULL; 
     
    350351        { 
    351352                GError *terror = NULL; 
    352                 sentbox = get_sentbox (self); 
    353                 outbox = tny_send_queue_get_outbox (self); 
    354  
    355                 if (!outbox || !sentbox) { 
    356                         if (outbox) 
    357                                 g_object_unref (outbox); 
    358                         if (sentbox) 
    359                                 g_object_unref (sentbox); 
    360                         g_warning ("tny_send_queue_get_outbox and " 
    361                                 "tny_send_queue_get_sentbox are not allowed to " 
    362                                 "return NULL. This indicates a problem in the " 
    363                                 "software."); 
    364                         priv->is_running = FALSE; 
    365                         g_static_rec_mutex_unlock (priv->todo_lock); 
    366                         goto errorhandler; 
    367                 } 
    368  
    369                 tny_folder_get_headers (outbox, list, TRUE, &terror); 
     353                tny_folder_get_headers (info->outbox, list, TRUE, &terror); 
    370354 
    371355                if (terror != NULL) 
     
    403387 
    404388                        if (tny_device_is_online (device)) 
    405                                 tny_folder_get_headers (outbox, headers, TRUE, &ferror); 
     389                                tny_folder_get_headers (info->outbox, headers, TRUE, &ferror); 
    406390                        else { 
    407391                                priv->is_running = FALSE; 
     
    481465 
    482466                        tny_list_prepend (hassent, G_OBJECT (header)); 
    483                         msg = tny_folder_get_msg (outbox, header, &err); 
     467                        msg = tny_folder_get_msg (info->outbox, header, &err); 
    484468 
    485469                        /* Emits msg-sending signal to inform a new msg is being sent */ 
     
    516500                                        tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); 
    517501                                        tny_header_set_flag (header, TNY_HEADER_FLAG_ANSWERED); 
    518                                         tny_folder_transfer_msgs (outbox, hassent, sentbox, TRUE, &newerr); 
     502                                        tny_folder_transfer_msgs (info->outbox, hassent, info->sentbox, TRUE, &newerr); 
    519503                                        if (newerr != NULL) { 
    520504                                                emit_error (self, header, msg, newerr, i, priv->total); 
     
    560544                g_hash_table_destroy (failed_headers); 
    561545 
    562         g_object_unref (sentbox); 
    563         g_object_unref (outbox); 
    564  
    565546        priv->thread = NULL; 
    566547 
    567548        g_object_unref (info->device); 
    568549        g_object_unref (info->self); 
     550 
     551        if (info->outbox_account) 
     552                g_object_unref (info->outbox_account); 
     553        if (info->sentbox_account) 
     554                g_object_unref (info->sentbox_account); 
     555 
     556        g_object_unref (info->outbox); 
     557        g_object_unref (info->sentbox); 
     558 
    569559        g_slice_free (MainThreadInfo, info); 
    570560 
     
    575565} 
    576566 
     567#define FOLDERSNOTREADY         _("tny_send_queue_get_outbox and tny_send_queue_get_sentbox are not allowed to return NULL. This indicates a problem in the software.") 
     568 
    577569static void  
    578 create_worker (TnySendQueue *self
     570create_worker (TnySendQueue *self, GError **err
    579571{ 
    580572        TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self); 
     
    591583                        info->self = g_object_ref (self); 
    592584                        info->device = g_object_ref (spriv->device); 
     585 
     586                        info->outbox = tny_send_queue_get_outbox (self); 
     587                        info->sentbox = get_sentbox (self); 
     588 
     589                        if (!info->outbox || !info->sentbox) { 
     590 
     591                                g_set_error (err, TNY_SERVICE_ERROR,  
     592                                        TNY_SERVICE_ERROR_ADD_MSG, FOLDERSNOTREADY); 
     593                                g_warning (FOLDERSNOTREADY); 
     594 
     595                                g_object_unref (info->self); 
     596                                g_object_unref (info->device); 
     597                                if (info->sentbox) 
     598                                        g_object_unref (info->sentbox); 
     599                                if (info->outbox) 
     600                                        g_object_unref (info->outbox); 
     601                                g_slice_free (MainThreadInfo, info); 
     602                                return; 
     603                        } 
     604 
     605                        info->sentbox_account = tny_folder_get_account (info->sentbox); 
     606                        info->outbox_account = tny_folder_get_account (info->outbox); 
    593607 
    594608                        emit_queue_control_signals (self, TNY_SEND_QUEUE_START); 
     
    698712        OnAddedInfo *info = (OnAddedInfo *) user_data; 
    699713        TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (info->self); 
     714        GError *new_err = NULL; 
     715 
     716        if (!err) { 
     717                priv->total++; 
     718                if (priv->total >= 1 && !priv->is_running) 
     719                        create_worker (info->self, &new_err); 
     720        } 
    700721 
    701722        /* Call user callback after msg has beed added to OUTBOX, waiting to be sent*/ 
    702723        if (info->callback) 
    703                 info->callback (info->self, info->cancelled, info->msg, info->user_data, err); 
    704  
    705         priv->total++; 
    706         if (priv->total >= 1 && !priv->is_running) 
    707                 create_worker (info->self); 
     724                info->callback (info->self, info->cancelled, info->msg, info->user_data,  
     725                        new_err?new_err:err); 
     726 
     727        if (new_err) 
     728                g_error_free (new_err); 
     729 
    708730        if (info->self) 
    709731                g_object_unref (info->self); 
     
    11071129tny_camel_send_queue_flush (TnyCamelSendQueue *self) 
    11081130{ 
     1131        GError *err = NULL; 
    11091132        g_return_if_fail (TNY_IS_CAMEL_SEND_QUEUE(self)); 
    1110         create_worker (TNY_SEND_QUEUE (self)); 
     1133        create_worker (TNY_SEND_QUEUE (self), &err); 
     1134        if (err) 
     1135                g_error_free (err); 
    11111136} 
    11121137 
  • trunk/libtinymail/tny-folder-monitor.c

    r3526 r3595  
    273273                        uid = tny_header_dup_uid (header); 
    274274                        if (uid) 
    275                                 g_ptr_array_add (array, uid); 
     275                                g_ptr_array_add (array, (gpointer) uid); 
    276276                        g_object_unref (header); 
    277277                        tny_iterator_next (iter); 
  • trunk/libtinymailui-gnome-keyring/tny-gnome-keyring-password-getter.c

    r3573 r3595  
    2121#include <glib.h> 
    2222#include <glib/gi18n-lib.h> 
     23#include <string.h> 
    2324 
    2425#include <tny-gnome-keyring-password-getter.h>