Changeset 3726

Show
Ignore:
Timestamp:
07/23/08 13:42:24
Author:
svillar
Message:
  • Properly registers camel operations
  • Added progress information to get_headers_async call
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3725 r3726  
     12008-07-23  Sergio Villar Senin  <svillar@igalia.com> 
     2 
     3        * libtinymail-camel/tny-camel-account.c 
     4        (_tny_camel_account_start_camel_operation_n): added a missing 
     5        camel_operation_register that was preventing progress info to be 
     6        threw up and cancelations as well. 
     7 
     8        * libtinymail-camel/tny-camel-folder.c: added progress information 
     9        to get_headers_async function. 
     10 
    1112008-07-21  Jose Dapena Paz  <jdapena@igalia.com> 
    212 
  • trunk/libtinymail-camel/tny-camel-account.c

    r3705 r3726  
    782782        priv->cancel = camel_operation_new (func, user_data); 
    783783 
     784        camel_operation_register (priv->cancel); 
    784785        camel_operation_start (priv->cancel, (char*)what); 
    785786 
  • trunk/libtinymail-camel/tny-camel-folder.c

    r3704 r3726  
    21892189        gboolean refresh; 
    21902190        TnyGetHeadersCallback callback; 
     2191        TnyStatusCallback status_callback; 
    21912192        gpointer user_data; 
    21922193        TnySessionCamel *session; 
    21932194        gboolean cancelled; 
     2195        TnyIdleStopper *stopper; 
    21942196 
    21952197} GetHeadersInfo; 
     
    22092211        if (info->err) 
    22102212                g_error_free (info->err); 
     2213 
     2214        tny_idle_stopper_destroy (info->stopper); 
     2215        info->stopper = NULL; 
    22112216 
    22122217        /**/ 
     
    22262231                tny_lockable_unlock (info->session->priv->ui_lock); 
    22272232        } 
     2233        tny_idle_stopper_stop (info->stopper); 
     2234 
    22282235        return FALSE; 
    22292236} 
     2237 
     2238static void 
     2239tny_camel_folder_get_headers_async_status (struct _CamelOperation *op, const char *what, int sofar, int oftotal, void *thr_user_data) 
     2240{ 
     2241        GetHeadersInfo *oinfo = thr_user_data; 
     2242        TnyProgressInfo *info = NULL; 
     2243 
     2244        info = tny_progress_info_new (G_OBJECT (oinfo->self), oinfo->status_callback,  
     2245                                      TNY_FOLDER_STATUS, TNY_FOLDER_STATUS_CODE_GET_MSG, what, sofar,  
     2246                                      oftotal, oinfo->stopper, oinfo->session->priv->ui_lock, oinfo->user_data); 
     2247         
     2248        g_idle_add_full (TNY_PRIORITY_LOWER_THAN_GTK_REDRAWS,  
     2249                         tny_progress_info_idle_func, info,  
     2250                         tny_progress_info_destroy); 
     2251         
     2252        return; 
     2253} 
     2254 
    22302255 
    22312256static gpointer  
     
    22332258{ 
    22342259        GetHeadersInfo *info = (GetHeadersInfo*) thr_user_data; 
     2260        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 
     2261 
    22352262        info->err = NULL; 
     2263        info->cancelled = FALSE; 
     2264 
     2265        g_static_rec_mutex_lock (priv->folder_lock); 
     2266 
     2267        _tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account), 
     2268                                                  tny_camel_folder_get_headers_async_status,  
     2269                                                  info, "Getting headers"); 
     2270 
    22362271        tny_folder_get_headers (info->self, info->headers, info->refresh, &info->err); 
    2237         info->cancelled = FALSE; 
     2272 
     2273        _tny_camel_account_stop_camel_operation (TNY_CAMEL_ACCOUNT (priv->account)); 
    22382274 
    22392275        if (info->err != NULL) { 
     
    22412277                        info->cancelled = TRUE; 
    22422278        } 
     2279 
     2280        g_static_rec_mutex_unlock (priv->folder_lock); 
    22432281 
    22442282        return NULL; 
     
    22572295        g_object_unref (info->headers); 
    22582296 
    2259         /**/ 
     2297        tny_idle_stopper_destroy (info->stopper); 
     2298        info->stopper = NULL; 
    22602299 
    22612300        camel_object_unref (info->session); 
     
    22982337        info->refresh = refresh; 
    22992338        info->callback = callback; 
     2339        info->status_callback = status_callback; 
    23002340        info->user_data = user_data; 
    23012341        info->err = NULL; 
     2342        info->stopper = tny_idle_stopper_new(); 
    23022343 
    23032344        /* thread reference */ 
     
    23192360                info, sizeof (GetHeadersInfo), 
    23202361                TNY_CAMEL_QUEUE_PRIORITY_ITEM/*|TNY_CAMEL_QUEUE_CANCELLABLE_ITEM*/| 
    2321                        TNY_CAMEL_QUEUE_GET_HEADERS_ITEM,  
     2362                TNY_CAMEL_QUEUE_GET_HEADERS_ITEM,  
    23222363                __FUNCTION__); 
    23232364