Changeset 212
- Timestamp:
- 05/03/06 12:08:06
- Files:
-
- trunk/libtinymail-camel/tny-account.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-stream.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-msg-folder-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-msg-folder.c (modified) (4 diffs)
- trunk/libtinymail-camel/tny-msg-header.c (modified) (23 diffs)
- trunk/libtinymail-camel/tny-msg-mime-part.c (modified) (7 diffs)
- trunk/libtinymail-camel/tny-msg.c (modified) (12 diffs)
- trunk/libtinymail-camel/tny-session-camel.c (modified) (3 diffs)
- trunk/libtinymail-camel/tny-store-account.c (modified) (13 diffs)
- trunk/libtinymail-camel/tny-stream-camel.c (modified) (4 diffs)
- trunk/libtinymail-camel/tny-transport-account.c (modified) (2 diffs)
- trunk/libtinymail-gnomevfs/tny-vfs-stream.c (modified) (7 diffs)
- trunk/libtinymail/tny-account-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-account-store-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-msg-folder-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-msg-header-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-msg-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-msg-mime-part-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-shared.h (modified) (1 diff)
- trunk/libtinymail/tny-store-account-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-stream-iface.c (modified) (1 diff)
- trunk/libtinymail/tny-transport-account-iface.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-account-tree-model.c (modified) (3 diffs)
- trunk/libtinymailui-gtk/tny-attach-list-model.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-msg-header-list-model.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-msg-view.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-msg-window.c (modified) (1 diff)
- trunk/libtinymailui-gtk/tny-text-buffer-stream.c (modified) (1 diff)
- trunk/libtinymailui/tny-msg-view-iface.c (modified) (1 diff)
- trunk/libtinymailui/tny-msg-window-iface.c (modified) (1 diff)
- trunk/libtinymailui/tny-summary-window-iface.c (modified) (1 diff)
- trunk/tinymail/tny-account-store.c (modified) (1 diff)
- trunk/tinymail/tny-password-dialog.c (modified) (1 diff)
- trunk/tinymail/tny-summary-window.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/tny-account.c
r202 r212 394 394 static GType type = 0; 395 395 396 if ( !camel_type_init_done)396 if (G_UNLIKELY (!camel_type_init_done)) 397 397 { 398 398 camel_type_init (); … … 400 400 } 401 401 402 if ( type == 0)402 if (G_UNLIKELY(type == 0)) 403 403 { 404 404 static const GTypeInfo info = trunk/libtinymail-camel/tny-camel-stream.c
r209 r212 150 150 static CamelType type = CAMEL_INVALID_TYPE; 151 151 152 if ( !camel_type_init_done)152 if (G_UNLIKELY (!camel_type_init_done)) 153 153 { 154 154 camel_type_init (); … … 156 156 } 157 157 158 if (type == CAMEL_INVALID_TYPE) { 158 if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) 159 { 159 160 parent_class = (CamelStreamClass *)camel_stream_get_type(); 160 161 type = camel_type_register ((CamelType)parent_class, trunk/libtinymail-camel/tny-msg-folder-priv.h
r196 r212 55 55 56 56 void _tny_msg_folder_set_subscribed_priv (TnyMsgFolderIface *self, gboolean subscribed); 57 void _tny_msg_folder_set_name_priv (TnyMsgFolderIface *self, const gchar *name); 57 58 58 59 #endif trunk/libtinymail-camel/tny-msg-folder.c
r209 r212 498 498 const gchar *name = NULL; 499 499 500 load_folder (priv);501 502 500 if (!priv->cached_name) 501 { 502 load_folder (priv); 503 503 name = camel_folder_get_name (priv->folder); 504 else504 } else 505 505 name = priv->cached_name; 506 506 … … 525 525 526 526 priv->folder_name = g_strdup (id); 527 528 return; 529 } 530 531 532 void 533 _tny_msg_folder_set_name_priv (TnyMsgFolderIface *self, const gchar *name) 534 { 535 TnyMsgFolderPriv *priv = TNY_MSG_FOLDER_GET_PRIVATE (TNY_MSG_FOLDER (self)); 536 537 if (priv->cached_name) 538 g_free (priv->cached_name); 539 540 priv->cached_name = g_strdup (name); 527 541 528 542 return; … … 774 788 static GType type = 0; 775 789 776 if ( !camel_type_init_done)790 if (G_UNLIKELY (!camel_type_init_done)) 777 791 { 778 792 camel_type_init (); … … 780 794 } 781 795 782 if ( type == 0)796 if (G_UNLIKELY(type == 0)) 783 797 { 784 798 static const GTypeInfo info = trunk/libtinymail-camel/tny-msg-header.c
r186 r212 66 66 unload_msg_header (TnyMsgHeader *self) 67 67 { 68 if ( !self->uncachable)68 if (G_UNLIKELY (!self->uncachable)) 69 69 return; 70 70 71 if (self->mime_from) 71 if (G_LIKELY (self->mime_from)) 72 { 72 73 g_free (self->mime_from); 73 self->mime_from = NULL; 74 75 if (self->use_summary) 74 self->mime_from = NULL; 75 } 76 77 if (G_LIKELY (self->use_summary)) 76 78 { 77 if (self->message_info) 79 if (G_LIKELY (self->message_info)) 80 { 78 81 camel_message_info_free (self->message_info); 79 self->message_info = NULL; 82 self->message_info = NULL; 83 } 80 84 } else { 81 if ( self->mime_message && CAMEL_IS_OBJECT (self->mime_message))82 camel_object_unref (CAMEL_OBJECT (self->mime_message)); 85 if (G_LIKELY (self->mime_message) && G_LIKELY (CAMEL_IS_OBJECT (self->mime_message))) 86 camel_object_unref (CAMEL_OBJECT (self->mime_message)); 83 87 self->mime_message = NULL; 84 88 } … … 101 105 load_msg_header (TnyMsgHeader *self) 102 106 { 103 if ( !self->uncachable)107 if (G_UNLIKELY (!self->uncachable)) 104 108 return; 105 109 106 if ( self->use_summary)110 if (G_LIKELY (self->use_summary)) 107 111 { 108 if ( !self->message_info && self->folder && self->uid)112 if (G_LIKELY (!self->message_info) && G_LIKELY (self->folder) && G_LIKELY (self->uid)) 109 113 { 110 114 CamelFolder *folder = _tny_msg_folder_get_camel_folder (self->folder); … … 113 117 _tny_msg_header_set_camel_message_info (self, msginfo); 114 118 } 115 } else 116 { 117 if (!self->mime_message && self->folder && self->uid) 119 } else { 120 if (G_LIKELY (!self->mime_message) && G_LIKELY (self->folder) && G_LIKELY (self->uid)) 118 121 { 119 122 CamelFolder *folder = _tny_msg_folder_get_camel_folder (self->folder); … … 134 137 self->use_summary = FALSE; 135 138 136 if ( !self->mime_message)139 if (G_LIKELY (!self->mime_message)) 137 140 self->mime_message = camel_mime_message_new (); 138 141 … … 146 149 { 147 150 148 if ( self->message_info)151 if (G_UNLIKELY (self->message_info)) 149 152 g_warning ("Strange behaviour: Overwriting existing message info"); 150 153 … … 168 171 { 169 172 170 if ( self->mime_message)173 if (G_UNLIKELY (self->mime_message)) 171 174 g_warning ("Strange behaviour: Overwriting existing MIME message"); 172 175 … … 195 198 TnyMsgHeader *me = TNY_MSG_HEADER (self); 196 199 197 g_mutex_lock (me->hdr_lock); 198 if (me->folder) 200 if (G_UNLIKELY (me->folder)) 199 201 g_warning ("Strange behaviour: Overwriting existing folder"); 200 202 203 g_mutex_lock (me->hdr_lock); 201 204 me->folder = (TnyMsgFolderIface*)folder; 202 205 g_mutex_unlock (me->hdr_lock); … … 358 361 load_msg_header (me); 359 362 360 if ( me->use_summary && me->message_info)363 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 361 364 retval = camel_message_info_cc (me->message_info); 362 else if ( me->mime_message)365 else if (G_LIKELY (me->mime_message)) 363 366 retval = camel_medium_get_header (CAMEL_MEDIUM (me->mime_message), "cc"); 364 367 365 if ( !retval)368 if (G_UNLIKELY (!retval)) 366 369 retval = me->invalid; 367 370 … … 382 385 load_msg_header (me); 383 386 384 if ( me->use_summary) /* TODO */387 if (G_LIKELY (me->use_summary)) /* TODO */ 385 388 retval = me->invalid; 386 else if ( me->mime_message)389 else if (G_LIKELY (me->mime_message)) 387 390 retval = camel_medium_get_header (CAMEL_MEDIUM (me->mime_message), "bcc"); 388 391 389 if ( !retval)392 if (G_UNLIKELY (!retval)) 390 393 retval = me->invalid; 391 394 … … 406 409 load_msg_header (me); 407 410 408 if ( me->use_summary && me->message_info)411 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 409 412 retval = camel_message_info_date_received (me->message_info); 410 else if ( me->mime_message)413 else if (G_LIKELY (me->mime_message)) 411 414 retval = camel_mime_message_get_date_received (me->mime_message, NULL); 412 415 … … 427 430 load_msg_header (me); 428 431 429 if ( me->use_summary && me->message_info)432 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 430 433 retval = camel_message_info_date_sent (me->message_info); 431 434 else { … … 449 452 load_msg_header (me); 450 453 451 if ( me->use_summary && me->message_info)454 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 452 455 retval = camel_message_info_from (me->message_info); 453 456 else 454 457 { 455 if ( !me->mime_from && me->mime_message)458 if (G_LIKELY (!me->mime_from) && G_LIKELY (me->mime_message)) 456 459 { 457 460 CamelInternetAddress *addr = (CamelInternetAddress*) … … 464 467 } 465 468 466 if ( !retval)469 if (G_UNLIKELY (!retval)) 467 470 retval = me->invalid; 468 471 … … 482 485 load_msg_header (me); 483 486 484 if ( me->use_summary && me->message_info)487 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 485 488 retval = camel_message_info_subject (me->message_info); 486 else if ( me->mime_message)489 else if (G_LIKELY (me->mime_message)) 487 490 retval = camel_mime_message_get_subject (me->mime_message); 488 491 489 if ( !retval)492 if (G_UNLIKELY (!retval)) 490 493 retval = me->invalid; 491 494 … … 507 510 load_msg_header (me); 508 511 509 if ( me->use_summary && me->message_info)512 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 510 513 retval = camel_message_info_to (me->message_info); 511 else if ( me->mime_message)514 else if (G_LIKELY (me->mime_message)) 512 515 retval = camel_medium_get_header (CAMEL_MEDIUM (me->mime_message), "to"); 513 516 514 if ( !retval)517 if (G_UNLIKELY (!retval)) 515 518 retval = me->invalid; 516 519 … … 531 534 load_msg_header (me); 532 535 533 if ( me->use_summary && me->message_info)536 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 534 537 retval = (const gchar*)camel_message_info_message_id (me->message_info); 535 else if ( me->mime_message)538 else if (G_LIKELY (me->mime_message)) 536 539 retval = camel_mime_message_get_message_id (me->mime_message); 537 540 538 if ( !retval)541 if (G_UNLIKELY (!retval)) 539 542 retval = me->invalid; 540 543 … … 557 560 load_msg_header (me); 558 561 559 if ( me->use_summary && me->message_info)562 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 560 563 retval = camel_message_info_uid (me->message_info); 561 564 else /* Bleh solution ... */ … … 583 586 /* Yes I know what I'm doing, also check tny-msg-folder.c */ 584 587 585 if ( me->use_summary)588 if (G_LIKELY (me->use_summary)) 586 589 me->uid = (gchar*)uid; 587 590 else { … … 611 614 g_mutex_lock (me->hdr_lock); 612 615 613 if ( me->use_summary)616 if (G_LIKELY (me->use_summary)) 614 617 retval = (me->message_info != NULL); 615 618 else … … 628 631 g_mutex_lock (me->hdr_lock); 629 632 630 if ( me->use_summary && me->message_info)633 if (G_LIKELY (me->use_summary) && G_LIKELY (me->message_info)) 631 634 unload_msg_header (me); 632 635 633 if ( !me->use_summary && me->mime_message)636 if (G_UNLIKELY (!me->use_summary) && G_LIKELY (me->mime_message)) 634 637 unload_msg_header (me); 635 638 … … 650 653 self->uncachable = TRUE; 651 654 652 if ( self->use_summary && self->message_info)655 if (G_LIKELY (self->use_summary) && G_LIKELY (self->message_info)) 653 656 unload_msg_header (self); 654 657 655 if ( !self->use_summary && self->mime_message)658 if (G_UNLIKELY (!self->use_summary) && G_LIKELY (self->mime_message)) 656 659 unload_msg_header (self); 657 660 658 661 /* Indeed, check the speedup trick above */ 659 if ( self->uid && !self->use_summary)662 if (G_LIKELY (self->uid) && G_UNLIKELY (!self->use_summary)) 660 663 g_free (self->uid); /* Also check above */ 661 664 … … 744 747 static GType type = 0; 745 748 746 if ( !camel_type_init_done)749 if (G_UNLIKELY (!camel_type_init_done)) 747 750 { 748 751 camel_type_init (); … … 750 753 } 751 754 752 if ( type == 0)755 if (G_UNLIKELY(type == 0)) 753 756 { 754 757 static const GTypeInfo info = trunk/libtinymail-camel/tny-msg-mime-part.c
r209 r212 50 50 wrapper = camel_medium_get_content_object (medium); 51 51 52 if ( !wrapper)52 if (G_UNLIKELY (!wrapper)) 53 53 { 54 54 g_error ("Mime part does not yet have a source stream, use " … … 89 89 wrapper = camel_medium_get_content_object (medium); 90 90 91 if ( wrapper)91 if (G_LIKELY (wrapper)) 92 92 camel_object_unref (CAMEL_OBJECT (wrapper)); 93 93 … … 121 121 wrapper = camel_medium_get_content_object (medium); 122 122 123 if ( !wrapper)123 if (G_UNLIKELY (!wrapper)) 124 124 { 125 125 wrapper = camel_data_wrapper_new (); … … 145 145 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 146 146 147 if ( !priv->cached_content_type)147 if (G_LIKELY (!priv->cached_content_type)) 148 148 { 149 149 CamelContentType *type; … … 199 199 g_mutex_lock (priv->part_lock); 200 200 201 if (G_UNLIKELY (priv->cached_content_type)) 202 g_free (priv->cached_content_type); 203 priv->cached_content_type = NULL; 204 if (G_UNLIKELY (priv->part)) 205 camel_object_unref (CAMEL_OBJECT (priv->part)); 206 camel_object_ref (CAMEL_OBJECT (part)); 207 priv->part = part; 208 209 g_mutex_unlock (priv->part_lock); 210 211 return; 212 } 213 214 CamelMimePart* 215 tny_msg_mime_part_get_part (TnyMsgMimePart *self) 216 { 217 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 218 CamelMimePart *retval; 219 220 g_mutex_lock (priv->part_lock); 221 retval = priv->part; 222 g_mutex_unlock (priv->part_lock); 223 224 return retval; 225 } 226 227 228 static const gchar* 229 tny_msg_mime_part_get_filename (TnyMsgMimePartIface *self) 230 { 231 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 232 const gchar *retval; 233 234 g_mutex_lock (priv->part_lock); 235 retval = camel_mime_part_get_filename (priv->part); 236 g_mutex_unlock (priv->part_lock); 237 238 return retval; 239 } 240 241 static const gchar* 242 tny_msg_mime_part_get_content_id (TnyMsgMimePartIface *self) 243 { 244 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 245 const gchar *retval; 246 247 g_mutex_lock (priv->part_lock); 248 retval = camel_mime_part_get_content_id (priv->part); 249 g_mutex_unlock (priv->part_lock); 250 251 return retval; 252 } 253 254 static const gchar* 255 tny_msg_mime_part_get_description (TnyMsgMimePartIface *self) 256 { 257 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 258 const gchar *retval; 259 260 g_mutex_lock (priv->part_lock); 261 retval = camel_mime_part_get_description (priv->part); 262 g_mutex_unlock (priv->part_lock); 263 264 return retval; 265 } 266 267 static const gchar* 268 tny_msg_mime_part_get_content_location (TnyMsgMimePartIface *self) 269 { 270 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 271 const gchar *retval; 272 273 g_mutex_lock (priv->part_lock); 274 retval = camel_mime_part_get_content_location (priv->part); 275 g_mutex_unlock (priv->part_lock); 276 277 return retval; 278 } 279 280 281 static void 282 tny_msg_mime_part_set_content_location (TnyMsgMimePartIface *self, const gchar *content_location) 283 { 284 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 285 286 g_mutex_lock (priv->part_lock); 287 camel_mime_part_set_content_location (priv->part, content_location); 288 g_mutex_unlock (priv->part_lock); 289 290 return; 291 } 292 293 static void 294 tny_msg_mime_part_set_description (TnyMsgMimePartIface *self, const gchar *description) 295 { 296 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 297 298 g_mutex_lock (priv->part_lock); 299 camel_mime_part_set_description (priv->part, description); 300 g_mutex_unlock (priv->part_lock); 301 302 return; 303 } 304 305 static void 306 tny_msg_mime_part_set_content_id (TnyMsgMimePartIface *self, const gchar *content_id) 307 { 308 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 309 310 g_mutex_lock (priv->part_lock); 311 camel_mime_part_set_content_id (priv->part, content_id); 312 g_mutex_unlock (priv->part_lock); 313 314 return; 315 } 316 317 static void 318 tny_msg_mime_part_set_filename (TnyMsgMimePartIface *self, const gchar *filename) 319 { 320 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 321 322 g_mutex_lock (priv->part_lock); 323 camel_mime_part_set_filename (priv->part, filename); 324 g_mutex_unlock (priv->part_lock); 325 326 return; 327 } 328 329 static void 330 tny_msg_mime_part_set_content_type (TnyMsgMimePartIface *self, const gchar *content_type) 331 { 332 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 333 334 g_mutex_lock (priv->part_lock); 335 336 camel_mime_part_set_content_type (priv->part, content_type); 337 if (G_UNLIKELY (priv->cached_content_type)) 338 g_free (priv->cached_content_type); 339 priv->cached_content_type = NULL; 340 341 g_mutex_unlock (priv->part_lock); 342 343 return; 344 } 345 346 static void 347 tny_msg_mime_part_finalize (GObject *object) 348 { 349 TnyMsgMimePart *self = (TnyMsgMimePart*) object; 350 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 351 352 g_mutex_lock (priv->part_lock); 201 353 if (priv->cached_content_type) 202 354 g_free (priv->cached_content_type); 203 355 priv->cached_content_type = NULL; 204 if (priv->part) 205 camel_object_unref (CAMEL_OBJECT (priv->part)); 206 camel_object_ref (CAMEL_OBJECT (part)); 207 priv->part = part; 208 209 g_mutex_unlock (priv->part_lock); 210 211 return; 212 } 213 214 CamelMimePart* 215 tny_msg_mime_part_get_part (TnyMsgMimePart *self) 216 { 217 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 218 CamelMimePart *retval; 219 220 g_mutex_lock (priv->part_lock); 221 retval = priv->part; 222 g_mutex_unlock (priv->part_lock); 223 224 return retval; 225 } 226 227 228 static const gchar* 229 tny_msg_mime_part_get_filename (TnyMsgMimePartIface *self) 230 { 231 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 232 const gchar *retval; 233 234 g_mutex_lock (priv->part_lock); 235 retval = camel_mime_part_get_filename (priv->part); 236 g_mutex_unlock (priv->part_lock); 237 238 return retval; 239 } 240 241 static const gchar* 242 tny_msg_mime_part_get_content_id (TnyMsgMimePartIface *self) 243 { 244 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 245 const gchar *retval; 246 247 g_mutex_lock (priv->part_lock); 248 retval = camel_mime_part_get_content_id (priv->part); 249 g_mutex_unlock (priv->part_lock); 250 251 return retval; 252 } 253 254 static const gchar* 255 tny_msg_mime_part_get_description (TnyMsgMimePartIface *self) 256 { 257 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 258 const gchar *retval; 259 260 g_mutex_lock (priv->part_lock); 261 retval = camel_mime_part_get_description (priv->part); 262 g_mutex_unlock (priv->part_lock); 263 264 return retval; 265 } 266 267 static const gchar* 268 tny_msg_mime_part_get_content_location (TnyMsgMimePartIface *self) 269 { 270 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 271 const gchar *retval; 272 273 g_mutex_lock (priv->part_lock); 274 retval = camel_mime_part_get_content_location (priv->part); 275 g_mutex_unlock (priv->part_lock); 276 277 return retval; 278 } 279 280 281 static void 282 tny_msg_mime_part_set_content_location (TnyMsgMimePartIface *self, const gchar *content_location) 283 { 284 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 285 286 g_mutex_lock (priv->part_lock); 287 camel_mime_part_set_content_location (priv->part, content_location); 288 g_mutex_unlock (priv->part_lock); 289 290 return; 291 } 292 293 static void 294 tny_msg_mime_part_set_description (TnyMsgMimePartIface *self, const gchar *description) 295 { 296 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 297 298 g_mutex_lock (priv->part_lock); 299 camel_mime_part_set_description (priv->part, description); 300 g_mutex_unlock (priv->part_lock); 301 302 return; 303 } 304 305 static void 306 tny_msg_mime_part_set_content_id (TnyMsgMimePartIface *self, const gchar *content_id) 307 { 308 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 309 310 g_mutex_lock (priv->part_lock); 311 camel_mime_part_set_content_id (priv->part, content_id); 312 g_mutex_unlock (priv->part_lock); 313 314 return; 315 } 316 317 static void 318 tny_msg_mime_part_set_filename (TnyMsgMimePartIface *self, const gchar *filename) 319 { 320 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 321 322 g_mutex_lock (priv->part_lock); 323 camel_mime_part_set_filename (priv->part, filename); 324 g_mutex_unlock (priv->part_lock); 325 326 return; 327 } 328 329 static void 330 tny_msg_mime_part_set_content_type (TnyMsgMimePartIface *self, const gchar *content_type) 331 { 332 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 333 334 g_mutex_lock (priv->part_lock); 335 336 camel_mime_part_set_content_type (priv->part, content_type); 337 if (priv->cached_content_type) 338 g_free (priv->cached_content_type); 339 priv->cached_content_type = NULL; 340 341 g_mutex_unlock (priv->part_lock); 342 343 return; 344 } 345 346 static void 347 tny_msg_mime_part_finalize (GObject *object) 348 { 349 TnyMsgMimePart *self = (TnyMsgMimePart*) object; 350 TnyMsgMimePartPriv *priv = TNY_MSG_MIME_PART_GET_PRIVATE (self); 351 352 g_mutex_lock (priv->part_lock); 353 if (priv->cached_content_type) 354 g_free (priv->cached_content_type); 355 priv->cached_content_type = NULL; 356 g_mutex_unlock (priv->part_lock); 357 358 if (priv->part) 356 g_mutex_unlock (priv->part_lock); 357 358 if (G_LIKELY (priv->part)) 359 359 { 360 360 g_mutex_lock (priv->part_lock); … … 446 446 static GType type = 0; 447 447 448 if ( !camel_type_init_done)448 if (G_UNLIKELY (!camel_type_init_done)) 449 449 { 450 450 camel_type_init (); … … 452 452 } 453 453 454 if ( type == 0)454 if (G_UNLIKELY(type == 0)) 455 455 { 456 456 static const GTypeInfo info = trunk/libtinymail-camel/tny-msg.c
r209 r212 55 55 containee = camel_medium_get_content_object (CAMEL_MEDIUM (part)); 56 56 57 if ( containee == NULL)57 if (G_UNLIKELY (containee == NULL)) 58 58 return go; 59 59 60 if ( CAMEL_IS_MULTIPART (containee))60 if (G_LIKELY (CAMEL_IS_MULTIPART (containee))) 61 61 { 62 62 parts = camel_multipart_get_number (CAMEL_MULTIPART (containee)); … … 67 67 } 68 68 69 } else if ( CAMEL_IS_MIME_MESSAGE (containee))69 } else if (G_LIKELY (CAMEL_IS_MIME_MESSAGE (containee))) 70 70 { 71 71 go = message_foreach_part_rec (msg, (CamelMimePart *)containee, callback, data); … … 94 94 destroy_part (gpointer data, gpointer user_data) 95 95 { 96 if ( data)96 if (G_LIKELY (data)) 97 97 g_object_unref (G_OBJECT (data)); 98 98 … … 105 105 g_mutex_lock (priv->parts_lock); 106 106 107 if ( priv->parts)107 if (G_LIKELY (priv->parts)) 108 108 { 109 109 g_list_foreach (priv->parts, … … 136 136 g_mutex_lock (priv->message_lock); 137 137 138 if ( ppriv->part)138 if (G_LIKELY (ppriv->part)) 139 139 camel_object_unref (CAMEL_OBJECT (ppriv->part)); 140 140 … … 222 222 223 223 /* Warp it into a multipart */ 224 if ( !containee || !CAMEL_IS_MULTIPART (containee))224 if (G_UNLIKELY (!containee) || G_LIKELY (!CAMEL_IS_MULTIPART (containee))) 225 225 { 226 226 /* TODO: restore original mime part? */ 227 if ( containee)227 if (G_LIKELY (containee)) 228 228 camel_object_unref (CAMEL_OBJECT (containee)); 229 229 … … 274 274 camel_multipart_remove_part_at (CAMEL_MULTIPART (containee), id); 275 275 276 if (remove->data) 277 camel_object_unref (CAMEL_OBJECT (remove->data)); 278 g_list_free (remove); 279 276 if (G_LIKELY (remove)) 277 { 278 if (G_LIKELY (remove->data)) 279 camel_object_unref (CAMEL_OBJECT (remove->data)); 280 281 g_list_free (remove); 282 } 280 283 281 284 /* Warning: large lock that locks code, not data */ … … 302 305 message = _tny_msg_header_get_camel_mime_message (TNY_MSG_HEADER (priv->header)); 303 306 304 if ( message)307 if (G_UNLIKELY (message)) 305 308 _tny_msg_set_camel_mime_message (TNY_MSG (self), message); 306 309 … … 318 321 319 322 g_mutex_lock (priv->header_lock); 320 if ( priv->header)323 if (G_LIKELY (priv->header)) 321 324 g_object_unref (G_OBJECT (priv->header)); 322 325 priv->header = NULL; … … 381 384 gint nth=0; 382 385 383 while ( list)386 while (G_LIKELY (list)) 384 387 { 385 388 if (TNY_IS_MSG_MIME_PART_IFACE (list->data)) … … 469 472 static GType type = 0; 470 473 471 if ( !camel_type_init_done)474 if (G_UNLIKELY (!camel_type_init_done)) 472 475 { 473 476 camel_type_init (); … … 475 478 } 476 479 477 if ( type == 0)480 if (G_UNLIKELY(type == 0)) 478 481 { 479 482 static const GTypeInfo info = trunk/libtinymail-camel/tny-session-camel.c
r209 r212 432 432 { 433 433 /* TODO: potential problem: singleton without lock */ 434 if ( !the_singleton)434 if (G_UNLIKELY (!the_singleton)) 435 435 { 436 436 the_singleton = TNY_SESSION_CAMEL … … 484 484 static CamelType tny_session_camel_type = CAMEL_INVALID_TYPE; 485 485 486 if ( !camel_type_init_done)486 if (G_UNLIKELY (!camel_type_init_done)) 487 487 { 488 488 camel_type_init (); … … 490 490 } 491 491 492 if ( tny_session_camel_type == CAMEL_INVALID_TYPE)492 if (G_UNLIKELY (tny_session_camel_type == CAMEL_INVALID_TYPE)) 493 493 { 494 494 ms_parent_class = (CamelSessionClass *)camel_session_get_type(); trunk/libtinymail-camel/tny-store-account.c
r202 r212 66 66 camel_url_set_host (url, priv->host); 67 67 68 if ( priv->url_string)68 if (G_LIKELY (priv->url_string)) 69 69 g_free (priv->url_string); 70 70 71 71 priv->url_string = camel_url_to_string (url, 0); 72 72 73 if ( priv->service)73 if (G_UNLIKELY (priv->service)) 74 74 camel_object_unref (CAMEL_OBJECT (priv->service)); 75 75 … … 78 78 priv->type, priv->ex); 79 79 80 if (priv->service == NULL) { 80 if (G_UNLIKELY (priv->service == NULL)) 81 { 81 82 g_error ("couldn't get service %s: %s\n", priv->url_string, 82 83 camel_exception_get_description (priv->ex)); … … 88 89 } 89 90 90 if (priv->service && priv->pass_func_set && priv->proto && priv->user && priv->host) 91 if (G_LIKELY (priv->service) && G_UNLIKELY (priv->pass_func_set) 92 && G_UNLIKELY (priv->proto) && G_UNLIKELY (priv->user) 93 && G_UNLIKELY (priv->host)) 91 94 camel_service_connect (priv->service, priv->ex); 92 95 … … 104 107 tny_store_account_clear_folders (TnyStoreAccountPriv *priv) 105 108 { 106 if ( priv->folders)109 if (G_LIKELY (priv->folders)) 107 110 { 108 111 g_mutex_lock (priv->folders_lock); … … 111 114 } 112 115 113 if ( priv->ufolders)116 if (G_UNLIKELY (priv->ufolders)) 114 117 { 115 118 g_mutex_lock (priv->folders_lock); … … 139 142 tny_msg_folder_iface_set_account (iface, TNY_ACCOUNT_IFACE (self)); 140 143 141 &n
