Changeset 1884

Show
Ignore:
Timestamp:
05/04/07 10:42:29
Author:
pvanhoof
Message:

Changes to TnyGetMsgQueue and fix for ticket 43

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1882 r1884  
     12007-05-04  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * Massive changes to TnyGetMsgQueue (unfinished, experimental) 
     4        * Fix for urgent ticket #43 
     5 
    162007-05-03  Sergio Villar Senin  <svillar@igalia.com> 
    27        * tests/functional/folder-lister-async.c: Fixed a build error in the 
  • trunk/libtinymail-camel/tny-camel-folder-priv.h

    r1760 r1884  
    3333        GType headers_list_type; 
    3434        guint folder_changed_id; 
    35         guint headers_managed; 
     35        guint reason_to_live; 
     36        GMutex *reason_lock; 
    3637        GStaticRecMutex *folder_lock, *obs_lock; 
    3738        CamelFolder *folder; 
     
    5859void _tny_camel_folder_set_name (TnyCamelFolder *self, const gchar *name); 
    5960void _tny_camel_folder_set_folder_type (TnyCamelFolder *folder, CamelFolderInfo *folder_info); 
    60 void _tny_camel_folder_check_uncache (TnyCamelFolder *self, TnyCamelFolderPriv *priv); 
    6161void _tny_camel_folder_set_iter (TnyCamelFolder *folder, CamelFolderInfo *iter); 
    6262void _tny_camel_folder_set_account (TnyCamelFolder *self, TnyAccount *account); 
     
    6969void _tny_camel_folder_set_all_count (TnyCamelFolder *self, guint len); 
    7070void _tny_camel_folder_check_unread_count (TnyCamelFolder *self); 
     71 
     72void _tny_camel_folder_unreason (TnyCamelFolderPriv *priv); 
     73void _tny_camel_folder_reason (TnyCamelFolderPriv *priv); 
    7174 
    7275#define TNY_CAMEL_FOLDER_GET_PRIVATE(o) \ 
  • trunk/libtinymail-camel/tny-camel-folder.c

    r1879 r1884  
    718718        RefreshFolderInfo *info = thr_user_data; 
    719719        TnyFolder *self = info->self; 
     720        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
     721 
     722        _tny_camel_folder_unreason (priv); 
    720723 
    721724        /* thread reference */ 
     
    762765{ 
    763766        ProgressInfo *info = data; 
     767        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->minfo->self); 
    764768 
    765769        /* gidle reference */ 
     770        _tny_camel_folder_unreason (priv); 
    766771        g_object_unref (G_OBJECT (info->minfo->self)); 
    767772        g_free (info->what); 
     
    813818        RefreshFolderInfo *oinfo = thr_user_data; 
    814819        ProgressInfo *info = g_slice_new (ProgressInfo); 
     820        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (oinfo->self); 
    815821 
    816822        /* Camel will shredder what and thr_user_data, so we need to copy it */ 
     
    838844        /* gidle reference */ 
    839845        g_object_ref (G_OBJECT (info->minfo->self)); 
     846        _tny_camel_folder_reason (priv); 
    840847 
    841848        if (oinfo->depth > 0) 
     
    916923                        tny_camel_folder_refresh_async_destroyer (info); 
    917924                } 
    918         } else /* Thread reference */ 
     925        } else { /* Thread reference */ 
    919926                g_object_unref (G_OBJECT (self)); 
    920  
     927                _tny_camel_folder_unreason (priv); 
     928 
     929        } 
    921930        g_thread_exit (NULL); 
    922931 
     
    972981        /* thread reference */ 
    973982        g_object_ref (G_OBJECT (self)); 
     983        _tny_camel_folder_reason (priv); 
    974984 
    975985        thread = g_thread_create (tny_camel_folder_refresh_async_thread, 
    976986                        info, FALSE, NULL); 
    977987 
    978          
    979988        return; 
    980989} 
     
    11701179        GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 
    11711180        TnyFolderChange *change; 
     1181        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
    11721182 
    11731183        if (info->msg)  
     
    11821192 
    11831193        /* thread reference */ 
     1194        _tny_camel_folder_unreason (priv); 
    11841195        g_object_unref (G_OBJECT (info->self)); 
    11851196 
     
    12081219{ 
    12091220        GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 
     1221        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
    12101222        GError *err = NULL; 
    12111223 
     
    12341246                        tny_camel_folder_get_msg_async_destroyer (info); 
    12351247                } 
    1236         } else /* thread reference */ 
     1248        } else {/* thread reference */ 
     1249                _tny_camel_folder_unreason (priv); 
    12371250                g_object_unref (G_OBJECT (info->self)); 
     1251        } 
    12381252 
    12391253        g_thread_exit (NULL); 
     
    13101324 
    13111325        /* thread reference */ 
     1326        _tny_camel_folder_reason (priv); 
    13121327        g_object_ref (G_OBJECT (info->self)); 
    13131328        g_object_ref (G_OBJECT (info->header)); 
     
    18001815{ 
    18011816        TransferMsgsInfo *info = thr_user_data; 
     1817        TnyCamelFolderPriv *priv_src = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
     1818        TnyCamelFolderPriv *priv_dst = TNY_CAMEL_FOLDER_GET_PRIVATE (info->folder_dst); 
    18021819 
    18031820        inform_observers_about_transfer (info->self, info->folder_dst, info->delete_originals, 
     
    18051822 
    18061823        /* thread reference */ 
     1824        _tny_camel_folder_unreason (priv_src); 
    18071825        g_object_unref (G_OBJECT (info->self)); 
    18081826        g_object_unref (G_OBJECT (info->header_list)); 
     1827        _tny_camel_folder_unreason (priv_dst); 
    18091828        g_object_unref (G_OBJECT (info->folder_dst)); 
    18101829 
     
    19761995        } else {  
    19771996                /* thread reference (TNY TODO: inform observer?) */ 
     1997                _tny_camel_folder_unreason (priv_src); 
    19781998                g_object_unref (G_OBJECT (info->self)); 
    19791999                g_object_unref (G_OBJECT (info->header_list)); 
     2000                _tny_camel_folder_unreason (priv_dst); 
    19802001                g_object_unref (G_OBJECT (info->folder_dst)); 
    19812002        } 
     
    20002021        GError *err = NULL; 
    20012022        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
     2023        TnyCamelFolderPriv *priv_src = priv; 
     2024        TnyCamelFolderPriv *priv_dst = TNY_CAMEL_FOLDER_GET_PRIVATE (folder_dst); 
    20022025 
    20032026        if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), &err,  
     
    20222045        /* thread reference */ 
    20232046        g_object_ref (G_OBJECT (info->header_list)); 
     2047        _tny_camel_folder_reason (priv_src); 
    20242048        g_object_ref (G_OBJECT (info->self)); 
     2049        _tny_camel_folder_reason (priv_dst); 
    20252050        g_object_ref (G_OBJECT (info->folder_dst)); 
    20262051 
     
    22492274{ 
    22502275        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    2251         GError *err = NULL; 
    22522276 
    22532277        if (G_LIKELY (priv->folder != NULL)) 
     
    22572281} 
    22582282 
    2259  
    22602283void  
    2261 _tny_camel_folder_check_uncache (TnyCamelFolder *self, TnyCamelFolderPriv *priv) 
    2262 
    2263         if (priv->headers_managed == 0) 
    2264                 tny_camel_folder_uncache (self); 
    2265 
    2266  
     2284_tny_camel_folder_unreason (TnyCamelFolderPriv *priv) 
     2285
     2286        g_mutex_lock (priv->reason_lock); 
     2287        priv->reason_to_live--; 
     2288        if (priv->reason_to_live == 0) 
     2289                tny_camel_folder_uncache ((TnyCamelFolder *)priv->self); 
     2290        g_mutex_unlock (priv->reason_lock); 
     2291
     2292 
     2293void  
     2294_tny_camel_folder_reason (TnyCamelFolderPriv *priv) 
     2295
     2296        g_mutex_lock (priv->reason_lock); 
     2297        priv->reason_to_live++; 
     2298        g_mutex_unlock (priv->reason_lock); 
     2299
    22672300 
    22682301static TnyMsgRemoveStrategy*  
     
    26542687{ 
    26552688        GetFoldersInfo *info = thr_user_data; 
     2689        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
    26562690 
    26572691        /* thread reference */ 
     2692        _tny_camel_folder_unreason (priv); 
    26582693        g_object_unref (G_OBJECT (info->self)); 
    26592694        g_object_unref (G_OBJECT (info->list)); 
     
    26842719{ 
    26852720        GetFoldersInfo *info = (GetFoldersInfo*) thr_user_data; 
     2721        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
     2722 
    26862723        GError *err = NULL; 
    26872724 
     
    27112748        } else { 
    27122749                /* thread reference */ 
     2750                _tny_camel_folder_unreason (priv); 
    27132751                g_object_unref (G_OBJECT (info->self)); 
    27142752                g_object_unref (G_OBJECT (info->list)); 
     
    27532791 
    27542792        /* thread reference */ 
     2793        _tny_camel_folder_reason (priv); 
    27552794        g_object_ref (G_OBJECT (info->self)); 
    27562795        g_object_ref (G_OBJECT (info->list)); 
     
    28412880        } 
    28422881 
     2882        /* _tny_camel_folder_unreason (priv); */ 
     2883 
    28432884        return FALSE; 
    28442885} 
     
    28552896        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    28562897        GObject *info = g_object_ref (G_OBJECT (self)); 
     2898 
     2899        /* _tny_camel_folder_reason (priv); */ 
    28572900 
    28582901        if (g_main_depth () > 0) 
     
    31303173        priv->obs_lock = NULL; 
    31313174 
     3175        g_mutex_free (priv->reason_lock); 
    31323176 
    31333177        if (priv->folder_name) 
     
    32673311        priv->iter = NULL; 
    32683312        priv->iter_parented = FALSE; 
    3269         priv->headers_managed = 0; 
     3313        priv->reason_to_live = 0; 
    32703314        priv->loaded = FALSE; 
    32713315        priv->folder_changed_id = 0; 
     
    32753319        priv->remove_strat = tny_camel_msg_remove_strategy_new (); 
    32763320        priv->receive_strat = tny_camel_full_msg_receive_strategy_new (); 
     3321        priv->reason_lock = g_mutex_new (); 
    32773322 
    32783323        priv->folder_lock = g_new0 (GStaticRecMutex, 1); 
  • trunk/libtinymail-camel/tny-camel-header.c

    r1866 r1884  
    301301        { 
    302302                TnyCamelFolderPriv *fpriv = TNY_CAMEL_FOLDER_GET_PRIVATE (self->folder); 
    303                 fpriv->headers_managed--; 
    304                 _tny_camel_folder_check_uncache (((TnyCamelFolder*)self->folder), fpriv); 
     303                _tny_camel_folder_unreason (fpriv); 
    305304        } 
    306305 
     
    325324{ 
    326325        TnyCamelHeader *me = TNY_CAMEL_HEADER (self); 
    327         fpriv->headers_managed++
     326        _tny_camel_folder_reason (fpriv)
    328327        me->folder = (TnyCamelFolder*) folder; 
    329328 
  • trunk/libtinymail-queues/tny-get-msg-queue-priv.h

    r1816 r1884  
    2727        OAsyncWorker *queue; 
    2828        GMutex *lock; 
     29        guint total; 
    2930}; 
    3031 
  • trunk/libtinymail-queues/tny-get-msg-queue.c

    r1822 r1884  
    2222#include <glib/gi18n-lib.h> 
    2323 
     24#include <tny-status.h> 
     25#include <tny-simple-list.h> 
     26#include <tny-msg.h> 
     27#include <tny-folder.h> 
     28#include <tny-folder-observer.h> 
     29 
    2430#include <tny-get-msg-queue.h> 
    2531#include <oasyncworker/oasyncworker.h> 
    2632 
    2733static GObjectClass *parent_class = NULL; 
     34static GObjectClass *int_parent_class = NULL; 
    2835 
    2936#include "tny-get-msg-queue-priv.h" 
     37 
    3038 
    3139typedef struct { 
     
    3543        TnyStatusCallback status_callback; 
    3644        gpointer user_data; 
     45        guint i; 
    3746        GError *err; 
    3847} GetMsgInfo; 
     
    4453        TnyMsg *retval = NULL; 
    4554        GetMsgInfo *info = (GetMsgInfo *) arguments; 
     55        TnyGetMsgQueuePriv *priv = TNY_GET_MSG_QUEUE_GET_PRIVATE (info->self); 
    4656        TnyFolder *folder; 
    4757 
    4858        info->err = NULL; 
    4959 
     60        g_print ("Getting message (%d of %d): %s\n", info->i, priv->total,  
     61                tny_header_get_subject (info->header)); 
    5062        folder = tny_header_get_folder (info->header); 
     63 
     64        if (info->status_callback) { 
     65 
     66                TnyStatus *status = tny_status_new (TNY_GET_MSG_QUEUE_STATUS,  
     67                        TNY_GET_MSG_QUEUE_STATUS_GET_MSG, 
     68                        info->i, priv->total, "Receiving message"); 
     69 
     70                /* This could also be the status of the message retrieval itself, 
     71                 * rather than the status of the queue receiving messages. */ 
     72 
     73                info->status_callback (G_OBJECT (info->self), status, info->user_data); 
     74 
     75                tny_status_free (status); 
     76        } 
     77 
    5178        retval = tny_folder_get_msg (folder, info->header, &info->err); 
    5279 
     
    6087{ 
    6188        GetMsgInfo *info = o_async_worker_task_get_arguments (task); 
     89        TnyGetMsgQueuePriv *priv = TNY_GET_MSG_QUEUE_GET_PRIVATE (info->self); 
    6290        TnyMsg *msg = (TnyMsg *) func_result; 
    6391        TnyFolder *folder; 
     
    106134        GetMsgInfo *info = g_slice_new (GetMsgInfo); 
    107135 
     136        priv->total++; 
     137        info->i = priv->total; 
    108138        info->self = TNY_GET_MSG_QUEUE (g_object_ref (self)); 
    109139        info->header = TNY_HEADER (g_object_ref (header)); 
     
    122152} 
    123153 
     154typedef struct {  
     155        GObject parent;  
     156        TnyGetMsgQueue *queue; 
     157        TnyGetMsgCallback callback; 
     158        TnyStatusCallback status_callback; 
     159        gpointer user_data; 
     160} IntFolderMonitor; 
     161 
     162typedef struct {  
     163        GObjectClass parent;  
     164} IntFolderMonitorClass; 
     165 
     166 
     167static void  
     168get_messages (TnyGetMsgQueue *self, TnyList *list, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 
     169{ 
     170        TnyIterator *iter; 
     171        iter = tny_list_create_iterator (list); 
     172        while (!tny_iterator_is_done (iter)) 
     173        { 
     174                GError *err = NULL; 
     175                TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter)); 
     176 
     177                tny_get_msg_queue_get_msg (self, header, callback, status_callback, user_data); 
     178 
     179                g_object_unref (G_OBJECT (header)); 
     180                tny_iterator_next (iter); 
     181        } 
     182        g_object_unref (G_OBJECT (iter)); 
     183} 
     184 
     185static void  
     186int_folder_monitor_update (TnyFolderObserver *self, TnyFolderChange *change) 
     187{ 
     188        TnyFolderChangeChanged changed; 
     189        IntFolderMonitor *mon = (IntFolderMonitor *) self; 
     190 
     191        g_object_ref (self); 
     192 
     193        changed = tny_folder_change_get_changed (change); 
     194 
     195        if (changed & TNY_FOLDER_CHANGE_CHANGED_ADDED_HEADERS) 
     196        { 
     197                TnyList *list = tny_simple_list_new (); 
     198                tny_folder_change_get_added_headers (change, list); 
     199                get_messages (mon->queue, list, mon->callback, mon->status_callback, mon->user_data); 
     200                g_object_unref (G_OBJECT (list)); 
     201        } 
     202 
     203        g_object_unref (self); 
     204 
     205        return; 
     206} 
     207 
     208static void 
     209int_folder_monitor_instance_init (GTypeInstance *instance, gpointer g_class) { } 
     210static void 
     211int_folder_monitor_finalize (GObject *object) { 
     212        IntFolderMonitor *self = (IntFolderMonitor *) object; 
     213        g_object_unref (self->queue); 
     214        int_parent_class->finalize (object); 
     215} 
     216static void 
     217int_tny_folder_observer_init (TnyFolderObserverIface *klass) { 
     218        klass->update_func = int_folder_monitor_update;  
     219} 
     220static void 
     221int_folder_monitor_class_init (TnyFolderMonitorClass *klass) { 
     222        GObjectClass *object_class; 
     223        int_parent_class = g_type_class_peek_parent (klass); 
     224        object_class = (GObjectClass*) klass; 
     225        object_class->finalize = int_folder_monitor_finalize; 
     226} 
     227static GType 
     228int_folder_monitor_get_type (void) 
     229{ 
     230        static GType type = 0; 
     231        if (G_UNLIKELY(type == 0)) { 
     232                static const GTypeInfo info = { sizeof (IntFolderMonitorClass), 
     233                        NULL, NULL, (GClassInitFunc) int_folder_monitor_class_init,  
     234                        NULL,  NULL, sizeof (IntFolderMonitor), 0, 
     235                        int_folder_monitor_instance_init, NULL }; 
     236                static const GInterfaceInfo tny_folder_observer_info = { 
     237                        (GInterfaceInitFunc) int_tny_folder_observer_init,  
     238                        NULL, NULL }; 
     239                type = g_type_register_static (G_TYPE_OBJECT,  
     240                        "IntFolderMonitor", &info, 0); 
     241                g_type_add_interface_static (type, TNY_TYPE_FOLDER_OBSERVER, 
     242                        &tny_folder_observer_info); } 
     243        return type; 
     244} 
     245 
     246static void 
     247refresh_done (TnyFolder *folder, gboolean cancelled, GError **err, gpointer user_data) 
     248{ 
     249        IntFolderMonitor *mon = user_data; 
     250        tny_folder_remove_observer (folder, TNY_FOLDER_OBSERVER (mon)); 
     251        g_object_unref (mon); 
     252} 
     253static void 
     254status_update (GObject *sender, TnyStatus *status, gpointer user_data) { } 
     255 
     256static void 
     257tny_get_msg_queue_full_msg_retrieval_default (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 
     258{ 
     259        TnyList *list = NULL; 
     260 
     261        if (headers) 
     262                list = g_object_ref (headers); 
     263        else { 
     264 
     265                IntFolderMonitor *mon = g_object_new (int_folder_monitor_get_type (), NULL); 
     266 
     267                mon->queue = TNY_GET_MSG_QUEUE (g_object_ref (self)); 
     268                mon->callback = callback; 
     269                mon->status_callback = status_callback; 
     270                mon->user_data = user_data; 
     271 
     272                tny_folder_add_observer (folder, TNY_FOLDER_OBSERVER (mon)); 
     273                tny_folder_refresh_async (folder, refresh_done, status_update,  
     274                        g_object_ref (mon)); 
     275 
     276                list = tny_simple_list_new (); 
     277                tny_folder_get_headers (folder, list, FALSE, NULL); 
     278 
     279                g_object_unref (mon); 
     280        } 
     281 
     282        get_messages (self, list, callback, status_callback, user_data); 
     283 
     284        g_object_unref (G_OBJECT (list)); 
     285 
     286} 
     287 
     288/** 
     289 * tny_get_msg_queue_full_msg_retrieval: 
     290 * @self: a #TnyGetMsgQueue object 
     291 * @folder: a #TnyFolder object 
     292 * @headers: a #TnyList with #TnyHeader instances or NULL 
     293 * @callback: The callback handler 
     294 * @status_callback: The status_callback handler 
     295 * @user_data: user data for the callback 
     296 * 
     297 * Queue getting full messages of @folder. If @headers is NULL, all messages 
     298 * will be retrieved while getting the summary. 
     299 * 
     300 **/ 
     301void 
     302tny_get_msg_queue_full_msg_retrieval (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 
     303{ 
     304        TNY_GET_MSG_QUEUE_GET_CLASS (self)->full_msg_retrieval_func (self, folder, headers, callback, status_callback, user_data); 
     305        return; 
     306} 
     307 
    124308/** 
    125309 * tny_get_msg_queue_new: 
     
    158342 
    159343        priv->lock = g_mutex_new (); 
    160  
     344        priv->total = 0; 
    161345        g_mutex_lock (priv->lock); 
    162346        priv->queue = o_async_worker_new (); 
     
    175359 
    176360        klass->get_msg_func = tny_get_msg_queue_get_msg_default; 
     361        klass->full_msg_retrieval_func = tny_get_msg_queue_full_msg_retrieval_default; 
    177362 
    178363        object_class->finalize = tny_get_msg_queue_finalize; 
  • trunk/libtinymail-queues/tny-get-msg-queue.h

    r1822 r1884  
    4848        /* virtual methods */ 
    4949        void (*get_msg_func) (TnyGetMsgQueue *self, TnyHeader *header, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 
     50        void (*full_msg_retrieval_func) (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 
    5051}; 
    5152 
     
    5455 
    5556void tny_get_msg_queue_get_msg (TnyGetMsgQueue *self, TnyHeader *header, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 
     57void tny_get_msg_queue_full_msg_retrieval (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 
    5658 
    5759 
  • trunk/libtinymail/tny-enums.h

    r1862 r1884  
    99{ 
    1010        TNY_FOLDER_STATUS_CODE_REFRESH = 1, 
    11         TNY_FOLDER_STATUS_CODE_GET_MSG = 2 
     11        TNY_FOLDER_STATUS_CODE_GET_MSG = 2, 
     12        TNY_GET_MSG_QUEUE_STATUS_GET_MSG = 3 
    1213} TnyStatusCode; 
    1314 
    1415typedef enum  
    1516{ 
    16         TNY_FOLDER_STATUS = 1 
     17        TNY_FOLDER_STATUS = 1, 
     18        TNY_GET_MSG_QUEUE_STATUS  = 2 
    1719} TnyStatusDomain; 
    1820 
  • trunk/libtinymail/tny-status.c

    r1866 r1884  
    3535  if (etype == 0) { 
    3636    static const GEnumValue values[] = { 
    37       { TNY_FOLDER_STATUS, "TNY_FOLDER_STTUS", "folder_status" }, 
     37      { TNY_FOLDER_STATUS, "TNY_FOLDER_STATUS", "folder_status" }, 
     38      { TNY_GET_MSG_QUEUE_STATUS, "TNY_GET_MSG_QUEUE_STATUS", "get_msg_queue_status" }, 
     39 
    3840      { 0, NULL, NULL } 
    3941    }; 
     
    5961      { TNY_FOLDER_STATUS_CODE_REFRESH, "TNY_FOLDER_STATUS_CODE_REFRESH", "folder_status_code_refresh" }, 
    6062      { TNY_FOLDER_STATUS_CODE_GET_MSG, "TNY_FOLDER_STATUS_CODE_GET_MSG", "folder_status_code_get_msg" }, 
     63      { TNY_GET_MSG_QUEUE_STATUS_GET_MSG, "TNY_GET_MSG_QUEUE_STATUS_GET_MSG", "get_msg_queue_status_get_msg" }, 
    6164      { 0, NULL, NULL } 
    6265    }; 
  • trunk/libtinymail/tny-status.h

    r1830 r1884  
    3333enum _TnyStatusDomain 
    3434{ 
    35         TNY_FOLDER_STATUS = 1 
     35        TNY_FOLDER_STATUS = 1, 
     36        TNY_GET_MSG_QUEUE_STATUS = 2 
    3637}; 
    3738 
     
    4142{ 
    4243        TNY_FOLDER_STATUS_CODE_REFRESH = 1, 
    43         TNY_FOLDER_STATUS_CODE_GET_MSG = 2 
     44        TNY_FOLDER_STATUS_CODE_GET_MSG = 2, 
     45        TNY_GET_MSG_QUEUE_STATUS_GET_MSG = 3, 
    4446}; 
    4547 
  • trunk/tests/c-demo/Makefile.am

    r1467 r1884  
    1111if BUILD_GNOME 
    1212INCLUDES += -DGNOME 
     13endif 
     14 
     15if BUILD_QUEUES 
     16INCLUDES += -DQUEUES -I$(top_srcdir)/libtinymail-queues 
    1317endif 
    1418 
     
    3337        $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la 
    3438 
     39if BUILD_QUEUES 
     40tny_demoui_LDADD +=  $(top_builddir)/libtinymail-queues/libtinymail-queues-$(API_VERSION).la 
     41endif 
     42 
  • trunk/tests/c-demo/tny-demoui-summary-view.c

    r1829 r1884  
    7777#include <tny-folder-monitor.h> 
    7878 
     79 
     80#ifdef QUEUES 
     81#include <tny-get-msg-queue.h> 
     82#endif 
     83 
    7984static TnySendQueue *queue = NULL; 
    8085 
     
    470475 
    471476        TnyDemouiSummaryViewPriv *priv = user_data; 
    472          
     477 
     478        if (!user_data) 
     479                return; 
     480 
    473481        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),  
    474482                tny_status_get_fraction (status)); 
     
    736744} 
    737745 
     746#ifdef QUEUES 
     747static TnyGetMsgQueue *fullqueue = NULL; 
     748 
     749static void  
     750on_full_download_folder_activate (GtkMenuItem *mitem, gpointer user_data) 
     751{ 
     752        TnyDemouiSummaryView *self = user_data; 
     753        TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 
     754        GtkTreeIter iter; 
     755        GtkTreeModel *model; 
     756 
     757        if (gtk_tree_selection_get_selected (priv->mailbox_select, &model, &iter)) 
     758        { 
     759                gint type; 
     760 
     761                gtk_tree_model_get (model, &iter,  
     762                        TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN,  
     763                        &type, -1); 
     764 
     765                if (type != TNY_FOLDER_TYPE_ROOT)  
     766                {  
     767                        TnyFolder *folder; 
     768 
     769                        gtk_tree_model_get (model, &iter,  
     770                                TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,  
     771                                &folder, -1); 
     772 
     773                        if (!fullqueue) 
     774                                fullqueue = tny_get_msg_queue_new (); 
     775 
     776                        tny_get_msg_queue_full_msg_retrieval (fullqueue, folder,  
     777                                NULL, NULL, refresh_current_folder_status_update, priv); 
     778 
     779                        g_object_unref (G_OBJECT (folder)); 
     780 
     781                } 
     782        } 
     783} 
     784#endif 
    738785 
    739786static void  
     
    10571104 
    10581105 
    1059  
    10601106static void 
    10611107mailbox_view_do_popup_menu (GtkWidget *my_widget, GdkEventButton *event, gpointer user_data) 
     
    10641110        TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 
    10651111        GtkWidget *menu; 
    1066         GtkWidget *mrename, *mdelete, *mcreate, *mmerge; 
    10671112        int button, event_time; 
    10681113        GtkSelectionMode mode; 
     1114        GtkWidget *mrename, *mdelete, *mcreate, *mmerge; 
     1115#ifdef QUEUES 
     1116        GtkWidget *fdown; 
     1117#endif 
    10691118 
    10701119        menu = gtk_menu_new (); 
     
    10741123        mdelete = gtk_menu_item_new_with_label (_("Delete folder")); 
    10751124 
     1125#ifdef QUEUES 
     1126        fdown = gtk_menu_item_new_with_label (_("Download entire folder")); 
     1127#endif 
    10761128 
    10771129        mode = gtk_tree_selection_get_mode (priv->mailbox_select); 
     
    10901142        g_signal_connect (G_OBJECT (mmerge), "activate", 
    10911143                G_CALLBACK (on_merge_view_activate), user_data); 
     1144#ifdef QUEUES 
     1145        g_signal_connect (G_OBJECT (fdown), "activate", 
     1146                G_CALLBACK (on_full_download_folder_activate), user_data); 
     1147#endif 
    10921148 
    10931149        gtk_menu_prepend (menu, mrename); 
     
    10951151        gtk_menu_prepend (menu, mdelete); 
    10961152        gtk_menu_prepend (menu, mmerge); 
    1097  
     1153#ifdef QUEUES 
     1154        gtk_menu_prepend (menu, fdown); 
     1155 
     1156        gtk_widget_show (fdown); 
     1157#endif 
    10981158        gtk_widget_show (mrename); 
    10991159        gtk_widget_show (mcreate);