Changeset 2535
- Timestamp:
- 07/31/07 00:33:39
- Files:
-
- devel/pvanhoof/sessionwork/ChangeLog (modified) (1 diff)
- devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-account.c (modified) (5 diffs)
- devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-folder.c (modified) (88 diffs)
- devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-store-account.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/pvanhoof/sessionwork/ChangeLog
r2532 r2535 1 2007-07-31 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * Cleaning up, coding style fixes 4 * Review of TnyCamelFolder and TnyCamelStoreAccount 5 1 6 2007-07-30 Philip Van Hoof <pvanhoof@gnome.org> 2 7 devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-account.c
r2526 r2535 1337 1337 GError *err; 1338 1338 TnyCamelSetOnlineCallback callback; 1339 1340 GCond* condition; 1341 gboolean had_callback; 1342 GMutex *mutex; 1343 1339 1344 } OnSetOnlineInfo; 1340 1345 … … 1343 1348 { 1344 1349 OnSetOnlineInfo *info = (OnSetOnlineInfo *) data; 1345 1346 1350 if (info->callback) 1347 1351 info->callback (info->account, info->err); 1348 1349 1352 return FALSE; 1350 1353 } … … 1361 1364 /* Thread reference */ 1362 1365 g_object_unref (info->account); 1363 g_slice_free (OnSetOnlineInfo, data); 1364 1365 return; 1366 1367 if (info->condition) { 1368 g_mutex_lock (info->mutex); 1369 g_cond_broadcast (info->condition); 1370 info->had_callback = TRUE; 1371 g_mutex_unlock (info->mutex); 1372 } 1373 1374 return; 1375 } 1376 1377 /** 1378 * When using a #GMainLoop this method will execute a callback using 1379 * g_idle_add_full. Note that without a #GMainLoop, the callbacks 1380 * could happen in a worker thread (depends on who call it) at an 1381 * unknown moment in time (check your locking in this case). 1382 */ 1383 static void 1384 execute_callback (gint depth, 1385 gint priority, 1386 GSourceFunc idle_func, 1387 gpointer data, 1388 GDestroyNotify destroy_func) 1389 { 1390 if (depth > 0){ 1391 g_idle_add_full (priority, idle_func, data, destroy_func); 1392 } else { 1393 idle_func (data); 1394 destroy_func (data); 1395 } 1366 1396 } 1367 1397 … … 1382 1412 info->callback = (TnyCamelSetOnlineCallback) user_data; 1383 1413 1384 g_idle_add_full (G_PRIORITY_HIGH, on_set_online_done_idle_func, 1414 info->mutex = g_mutex_new (); 1415 info->condition = g_cond_new (); 1416 info->had_callback = FALSE; 1417 1418 execute_callback (/* info->depth */ 10, G_PRIORITY_HIGH, 1419 on_set_online_done_idle_func, 1385 1420 info, on_set_online_done_destroy_func); 1421 1422 /* Wait on the queue for the mainloop callback to be finished */ 1423 g_mutex_lock (info->mutex); 1424 if (!info->had_callback) 1425 g_cond_wait (info->condition, info->mutex); 1426 g_mutex_unlock (info->mutex); 1427 1428 g_mutex_free (info->mutex); 1429 g_cond_free (info->condition); 1430 1431 g_slice_free (OnSetOnlineInfo, info); 1386 1432 1387 1433 return; … … 1402 1448 _tny_camel_store_account_queue_going_online ( 1403 1449 TNY_CAMEL_STORE_ACCOUNT (self), session, online, 1404 on_set_online_done, (gpointer ) callback);1450 on_set_online_done, (gpointer) callback); 1405 1451 } 1406 1452 devel/pvanhoof/sessionwork/libtinymail-camel/tny-camel-folder.c
r2532 r2535 515 515 gboolean haderr = FALSE; 516 516 517 g_assert (TNY_IS_CAMEL_MSG (msg)); 518 519 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 520 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_ADD_MSG)) 517 if (!TNY_IS_CAMEL_MSG (msg)) 518 { 519 g_critical ("You must not use a non-TnyCamelMsg implementation " 520 "of TnyMsg with TnyCamelFolder types. This indicates a " 521 "problem in the software (unsupported operation)\n"); 522 g_assert (TNY_IS_CAMEL_MSG (msg)); 523 } 524 525 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 526 priv->account, err, TNY_FOLDER_ERROR, 527 TNY_FOLDER_ERROR_ADD_MSG)) 521 528 return; 522 529 … … 539 546 gint a = 0, len = 0, nlen = 0; 540 547 CamelException ex2 = CAMEL_EXCEPTION_INITIALISER; 548 541 549 len = priv->folder->summary->messages->len; 542 550 dst_orig_uids = g_ptr_array_sized_new (len); 543 for (a = 0; a < len; a++) { 544 CamelMessageInfo *om = camel_folder_summary_index (priv->folder->summary, a); 551 552 for (a = 0; a < len; a++) 553 { 554 CamelMessageInfo *om = 555 camel_folder_summary_index (priv->folder->summary, a); 545 556 if (om && om->uid) 546 557 g_ptr_array_add (dst_orig_uids, g_strdup (om->uid)); … … 548 559 camel_message_info_free (om); 549 560 } 550 561 551 562 camel_folder_append_message (priv->folder, message, NULL, NULL, &ex); 552 563 priv->unread_length = camel_folder_get_unread_message_count (priv->folder); … … 558 569 for (a = 0; a < nlen; a++) 559 570 { 560 CamelMessageInfo *om = camel_folder_summary_index (priv->folder->summary, a); 561 if (om && om->uid) { 571 CamelMessageInfo *om = 572 camel_folder_summary_index (priv->folder->summary, a); 573 574 if (om && om->uid) 575 { 562 576 gint b = 0; 563 577 gboolean found = FALSE; … … 649 663 g_assert (TNY_IS_HEADER (header)); 650 664 651 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 652 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_REMOVE_MSG)) 665 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 666 priv->account, err, TNY_FOLDER_ERROR, 667 TNY_FOLDER_ERROR_REMOVE_MSG)) 653 668 return; 654 669 … … 670 685 tny_msg_remove_strategy_perform_remove (priv->remove_strat, self, header, err); 671 686 672 673 687 /* Notify about unread count */ 674 688 _tny_camel_folder_check_unread_count (TNY_CAMEL_FOLDER (self)); … … 796 810 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 797 811 priv->cached_length = len; 798 799 812 return; 800 813 } … … 806 819 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 807 820 priv->local_size = len; 808 809 821 return; 810 822 } … … 820 832 { 821 833 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 822 823 834 return priv->cached_length; 824 835 } … … 835 846 { 836 847 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 837 838 848 return TNY_ACCOUNT (g_object_ref (priv->account)); 839 849 } … … 852 862 } 853 863 854 /** 855 * When using a #GMainLoop this method will execute a callback using 864 /* When using a #GMainLoop this method will execute a callback using 856 865 * g_idle_add_full. Note that without a #GMainLoop, the callbacks 857 866 * could happen in a worker thread (depends on who call it) at an 858 * unknown moment in time (check your locking in this case). 859 */ 867 * unknown moment in time (check your locking in this case). */ 868 860 869 static void 861 870 execute_callback (gint depth, … … 888 897 CamelException ex = CAMEL_EXCEPTION_INITIALISER; 889 898 890 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 891 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_SYNC)) 899 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 900 priv->account, err, TNY_FOLDER_ERROR, 901 TNY_FOLDER_ERROR_SYNC)) 892 902 return; 893 903 … … 949 959 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 950 960 961 /* thread reference */ 951 962 _tny_camel_folder_unreason (priv); 952 953 /* thread reference */954 963 g_object_unref (G_OBJECT (self)); 964 955 965 if (info->err) 956 966 g_error_free (info->err); … … 960 970 tny_idle_stopper_destroy (info->stopper); 961 971 info->stopper = NULL; 962 963 972 964 973 if (info->condition) { … … 980 989 TnyFolderChange *change = tny_folder_change_new (self); 981 990 982 if (info->callback)983 info->callback (info->self, info->cancelled, &info->err, info->user_data);984 985 tny_idle_stopper_stop (info->stopper);986 987 991 tny_folder_change_set_new_all_count (change, priv->cached_length); 988 992 tny_folder_change_set_new_unread_count (change, priv->unread_length); … … 990 994 g_object_unref (change); 991 995 996 if (info->callback) 997 info->callback (info->self, info->cancelled, &info->err, info->user_data); 998 999 tny_idle_stopper_stop (info->stopper); 1000 992 1001 return FALSE; 993 1002 } … … 1027 1036 { 1028 1037 tny_camel_folder_sync_async_destroyer (info); 1038 g_slice_free (SyncFolderInfo, thr_user_data); 1029 1039 g_static_rec_mutex_unlock (priv->folder_lock); 1030 1040 return NULL; … … 1071 1081 tny_camel_folder_sync_async_destroyer); 1072 1082 1083 1073 1084 /* Wait on the queue for the mainloop callback to be finished */ 1074 1075 1085 g_mutex_lock (info->mutex); 1076 1086 if (!info->had_callback) … … 1090 1100 { 1091 1101 SyncFolderInfo *info = thr_user_data; 1092 1093 1102 g_error_free (info->err); 1094 1103 g_object_unref (info->self); 1095 1104 g_slice_free (SyncFolderInfo, thr_user_data); 1105 return; 1096 1106 } 1097 1107 … … 1100 1110 { 1101 1111 SyncFolderInfo *info = thr_user_data; 1102 1103 1112 if (info->callback) 1104 1113 info->callback (info->self, TRUE, &info->err, info->user_data); 1105 1106 1114 return FALSE; 1107 1115 } 1116 1108 1117 void 1109 1118 tny_camel_folder_sync_async_default (TnyFolder *self, gboolean expunge, TnySyncFolderCallback callback, TnyStatusCallback status_callback, gpointer user_data) … … 1163 1172 gpointer user_data; 1164 1173 gboolean cancelled; 1165 /* This stops us from calling a status callback after the operation has1166 * finished. */1167 1174 TnyIdleStopper* stopper; 1168 1175 guint depth; … … 1178 1185 1179 1186 /** This is the GDestroyNotify callback provided to g_idle_add_full() 1180 * for tny_camel_folder_refresh_async_callback(). 1181 */ 1187 * for tny_camel_folder_refresh_async_callback().*/ 1188 1182 1189 static void 1183 1190 tny_camel_folder_refresh_async_destroyer (gpointer thr_user_data) … … 1187 1194 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 1188 1195 1196 /* thread reference */ 1189 1197 _tny_camel_folder_unreason (priv); 1190 1191 /* thread reference */1192 1198 g_object_unref (G_OBJECT (self)); 1199 1193 1200 if (info->err) 1194 1201 g_error_free (info->err); … … 1217 1224 TnyFolderChange *change = tny_folder_change_new (self); 1218 1225 1219 if (info->callback)1220 info->callback (info->self, info->cancelled, &info->err, info->user_data);1221 1222 /* Prevent status callbacks from being called after this1223 * (can happen because the 2 idle callbacks have different priorities)1224 * by causing tny_idle_stopper_is_stopped() to return TRUE. */1225 tny_idle_stopper_stop (info->stopper);1226 1227 1226 tny_folder_change_set_new_all_count (change, priv->cached_length); 1228 1227 tny_folder_change_set_new_unread_count (change, priv->unread_length); … … 1230 1229 g_object_unref (change); 1231 1230 1231 if (info->callback) 1232 info->callback (info->self, info->cancelled, &info->err, info->user_data); 1233 1234 /* Prevent status callbacks from being called after this 1235 * (can happen because the 2 idle callbacks have different priorities) 1236 * by causing tny_idle_stopper_is_stopped() to return TRUE. */ 1237 1238 tny_idle_stopper_stop (info->stopper); 1239 1232 1240 return FALSE; 1233 1241 } … … 1267 1275 { 1268 1276 tny_camel_folder_refresh_async_destroyer (info); 1277 g_slice_free (RefreshFolderInfo, info); 1269 1278 g_static_rec_mutex_unlock (priv->folder_lock); 1270 1279 return NULL; … … 1334 1343 { 1335 1344 RefreshFolderInfo *info = thr_user_data; 1336 1337 1345 g_error_free (info->err); 1338 1346 g_object_unref (info->self); 1339 1347 g_slice_free (RefreshFolderInfo, thr_user_data); 1348 return; 1340 1349 } 1341 1350 … … 1344 1353 { 1345 1354 RefreshFolderInfo *info = thr_user_data; 1346 1347 1355 if (info->callback) 1348 1356 info->callback (info->self, TRUE, &info->err, info->user_data); 1349 1350 1357 return FALSE; 1351 1358 } … … 1365 1372 * become zero while doing stuff on the instance in the background, don't you? 1366 1373 **/ 1374 1367 1375 static void 1368 1376 tny_camel_folder_refresh_async_default (TnyFolder *self, TnyRefreshFolderCallback callback, TnyStatusCallback status_callback, gpointer user_data) … … 1432 1440 TnyFolderChange *change = NULL; 1433 1441 1434 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 1435 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_REFRESH)) 1442 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 1443 priv->account, err, TNY_FOLDER_ERROR, 1444 TNY_FOLDER_ERROR_REFRESH)) 1436 1445 return; 1437 1446 … … 1445 1454 } 1446 1455 1447 /*_tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account),1448 NULL, NULL, NULL); */1449 1450 1456 oldlen = priv->cached_length; 1451 1457 oldurlen = priv->unread_length; … … 1454 1460 camel_folder_refresh_info (priv->folder, &ex); 1455 1461 priv->want_changes = TRUE; 1456 1457 /* _tny_camel_account_stop_camel_operation (TNY_CAMEL_ACCOUNT (priv->account)); */1458 1462 1459 1463 priv->cached_length = camel_folder_get_message_count (priv->folder); … … 1461 1465 priv->unread_length = (guint) camel_folder_get_unread_message_count (priv->folder); 1462 1466 update_iter_counts (priv); 1463 1464 1467 1465 1468 if (camel_exception_is_set (&ex)) … … 1507 1510 1508 1511 header = _tny_camel_header_new (); 1509 1510 _tny_camel_header_set_folder (TNY_CAMEL_HEADER (header), TNY_CAMEL_FOLDER (self), priv); 1511 _tny_camel_header_set_camel_message_info (TNY_CAMEL_HEADER (header), mi, FALSE); 1512 1513 tny_list_prepend (headers, (GObject*)header); 1514 1515 g_object_unref (G_OBJECT (header)); 1512 _tny_camel_header_set_folder ((TnyCamelHeader *) header, (TnyCamelFolder *) self, priv); 1513 _tny_camel_header_set_camel_message_info ((TnyCamelHeader *) header, mi, FALSE); 1514 tny_list_prepend (headers, (GObject*) header); 1515 g_object_unref (header); 1516 1516 1517 1517 return; … … 1538 1538 return; 1539 1539 1540 /* we reason the folder to make sure it does not1541 * lose all the references and uncache, causing an interlock */1542 _tny_camel_folder_reason (priv);1543 1540 g_static_rec_mutex_lock (priv->folder_lock); 1544 1541 … … 1550 1547 } 1551 1548 1552 g_object_ref (G_OBJECT (headers)); 1553 1549 /* We reason the folder to make sure it does not lose all the references 1550 * and uncache, causing an interlock */ 1551 _tny_camel_folder_reason (priv); 1552 1553 g_object_ref (headers); 1554 1554 ptr = g_slice_new (FldAndPriv); 1555 1555 ptr->self = self; … … 1577 1577 g_slice_free (FldAndPriv, ptr); 1578 1578 1579 g_object_unref (G_OBJECT (headers)); 1579 g_object_unref (headers); 1580 1580 1581 g_static_rec_mutex_unlock (priv->folder_lock); 1581 1582 _tny_camel_folder_unreason (priv); … … 1613 1614 { 1614 1615 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1616 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 1617 1618 /* thread reference */ 1619 _tny_camel_folder_unreason (priv); 1620 g_object_unref (info->self); 1621 1622 if (info->err) 1623 g_error_free (info->err); 1624 1625 _tny_session_stop_operation (info->session); 1626 1627 tny_idle_stopper_destroy (info->stopper); 1628 info->stopper = NULL; 1629 1630 if (info->condition) { 1631 g_mutex_lock (info->mutex); 1632 g_cond_broadcast (info->condition); 1633 info->had_callback = TRUE; 1634 g_mutex_unlock (info->mutex); 1635 } 1636 1637 return; 1638 } 1639 1640 1641 static gboolean 1642 tny_camel_folder_get_msg_async_callback (gpointer thr_user_data) 1643 { 1644 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1615 1645 TnyFolderChange *change; 1616 1646 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); … … 1625 1655 } 1626 1656 1627 /* thread reference */1628 _tny_camel_folder_unreason (priv);1629 g_object_unref (info->self);1630 1631 if (info->err)1632 g_error_free (info->err);1633 1634 _tny_session_stop_operation (info->session);1635 1636 tny_idle_stopper_destroy (info->stopper);1637 info->stopper = NULL;1638 1639 if (info->condition) {1640 g_mutex_lock (info->mutex);1641 g_cond_broadcast (info->condition);1642 info->had_callback = TRUE;1643 g_mutex_unlock (info->mutex);1644 }1645 1646 return;1647 }1648 1649 1650 static gboolean1651 tny_camel_folder_get_msg_async_callback (gpointer thr_user_data)1652 {1653 GetMsgInfo *info = (GetMsgInfo *) thr_user_data;1654 1655 1657 if (info->callback) 1656 1658 info->callback (info->self, info->cancelled, info->msg, &info->err, info->user_data); … … 1659 1661 * (can happen because the 2 idle callbacks have different priorities) 1660 1662 * by causing tny_idle_stopper_is_stopped() to return TRUE. */ 1663 1661 1664 tny_idle_stopper_stop (info->stopper); 1662 1665 … … 1690 1693 CamelOperation *cancel; 1691 1694 1695 /* TNY TODO: Ensure load_folder here */ 1696 1692 1697 /* This one doesn't use the _tny_camel_account_start_camel_operation 1693 1698 * infrastructure because it doesn't need to cancel existing operations … … 1699 1704 /* To disable parallel getting of messages while summary is being retreived, 1700 1705 * restore this lock (A) */ 1701 1702 1706 /* g_static_rec_mutex_lock (priv->folder_lock); */ 1703 1707 … … 1706 1710 camel_operation_start (cancel, (char *) "Getting message"); 1707 1711 1708 info->msg = tny_msg_receive_strategy_perform_get_msg (priv->receive_strat, info->self, info->header, &err); 1712 info->msg = tny_msg_receive_strategy_perform_get_msg (priv->receive_strat, 1713 info->self, info->header, &err); 1709 1714 1710 1715 info->cancelled = camel_operation_cancel_check (cancel); … … 1717 1722 /* To disable parallel getting of messages while summary is being retreived, 1718 1723 * restore this lock (B) */ 1719 1720 1724 /* g_static_rec_mutex_unlock (priv->folder_lock); */ 1721 1725 … … 1730 1734 info->err = NULL; 1731 1735 1736 /* thread reference header */ 1732 1737 g_object_unref (info->header); 1733 1738 … … 1759 1764 { 1760 1765 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1761 1762 1766 g_error_free (info->err); 1763 1767 g_object_unref (info->self); 1764 1768 g_slice_free (GetMsgInfo, info); 1769 return; 1765 1770 } 1766 1771 … … 1770 1775 1771 1776 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1772 1773 1777 if (info->callback) 1774 1778 info->callback (info->self, TRUE, NULL, &info->err, info->user_data); 1775 1776 1779 return FALSE; 1777 1780 } … … 1825 1828 /* thread reference */ 1826 1829 _tny_camel_folder_reason (priv); 1827 g_object_ref (G_OBJECT (info->self)); 1828 g_object_ref (G_OBJECT (info->header)); 1830 g_object_ref (info->self); 1831 1832 /* thread reference header */ 1833 g_object_ref (info->header); 1829 1834 1830 1835 _tny_camel_queue_launch (TNY_FOLDER_PRIV_GET_MSG_QUEUE (priv), … … 1883 1888 TnyFolderChange *change; 1884 1889 1885 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 1886 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_GET_MSG)) 1890 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 1891 priv->account, err, TNY_FOLDER_ERROR, 1892 TNY_FOLDER_ERROR_GET_MSG)) 1887 1893 return NULL; 1888 1894 … … 1939 1945 const gchar *uid; 1940 1946 1941 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 1942 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_GET_MSG)) 1947 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 1948 priv->account, err, TNY_FOLDER_ERROR, 1949 TNY_FOLDER_ERROR_GET_MSG)) 1943 1950 return NULL; 1944 1951 … … 2038 2045 { 2039 2046 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 2040 2041 2047 return priv->folder_name; 2042 2048 } … … 2277 2283 TnyFolderStoreObserver *observer = TNY_FOLDER_STORE_OBSERVER (tny_iterator_get_current (iter)); 2278 2284 tny_folder_store_observer_update (observer, change); 2279 g_object_unref ( G_OBJECT (observer));2285 g_object_unref (observer); 2280 2286 tny_iterator_next (iter); 2281 2287 } 2282 g_object_unref ( G_OBJECT (iter));2288 g_object_unref (iter); 2283 2289 } 2284 2290 … … 2305 2311 tny_folder_get_name (evt->fol)); 2306 2312 2307 g_object_unref ( G_OBJECT (change));2313 g_object_unref (change); 2308 2314 } 2309 2315 … … 2327 2333 notify_folder_store_observers_about (evt->str, change); 2328 2334 2329 g_object_unref ( G_OBJECT (change));2335 g_object_unref (change); 2330 2336 2331 2337 tny_debug ("tny_folder_copy: observers notify folder-add %s\n", … … 2363 2369 2364 2370 g_propagate_error (err, nerr); 2365 /* g_error_free (nerr); */2366 2371 return retc; 2367 2372 } … … 2532 2537 CpyRecRet *cpyr; 2533 2538 2534 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 2535 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_COPY)) 2539 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 2540 priv->account, err, TNY_FOLDER_ERROR, 2541 TNY_FOLDER_ERROR_COPY)) 2536 2542 return NULL; 2537 2543 … … 2545 2551 2546 2552 if (nerr != NULL) 2547 {2548 2553 g_propagate_error (err, nerr); 2549 /* g_error_free (nerr); */ 2550 } else 2554 else 2551 2555 notify_folder_observers_about_copy (adds, rems, del); 2552 2556 … … 2588 2592 2589 2593 if (info->err == NULL) 2590 {2591 2594 notify_folder_observers_about_copy (info->adds, info->rems, 2592 2595 info->delete_originals); 2593 }2594 2596 2595 2597 if (info->new_folder) … … 2599 2601 g_object_unref (info->into); 2600 2602 g_object_unref (info->self); 2601 /* _tny_camel_folder_unreason (priv); */2602 2603 2603 2604 if (info->err) … … 2646 2647 2647 2648 /* Send back progress data only for these internal operations */ 2649 2650 if (!what) 2651 return; 2652 2648 2653 if ((g_ascii_strcasecmp(what, "Renaming folder")) && 2649 2654 (g_ascii_strcasecmp(what, "Moving messages")) && … … 2679 2684 _tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account), 2680 2685 tny_camel_folder_copy_async_status, 2681 info, 2682 "Copying folder"); 2683 2684 info-> adds = NULL; info->rems = NULL;2686 info, "Copying folder"); 2687 2688 info->adds = NULL; 2689 info->rems = NULL; 2685 2690 2686 2691 cpyr = tny_camel_folder_copy_shared (info->self, info->into, … … 2700 2705 info->err = NULL; 2701 2706 if (nerr != NULL) 2702 {2703 2707 g_propagate_error (&info->err, nerr); 2704 }2705 2708 2706 2709 g_static_rec_mutex_unlock (priv->folder_lock); … … 2732 2735 { 2733 2736 CopyFolderInfo *info = (CopyFolderInfo *) thr_user_data; 2734 2735 2737 g_free (info->new_name); 2736 2738 g_error_free (info->err); … … 2738 2740 g_object_unref (info->into); 2739 2741 g_slice_free (CopyFolderInfo, info); 2742 return; 2740 2743 } 2741 2744 … … 2745 2748 2746 2749 CopyFolderInfo *info = (CopyFolderInfo *) thr_user_data; 2747 2748 2750 if (info->callback) 2749 2751 info->callback (info->self, info->into, TRUE, NULL, &info->err, info->user_data); 2750 2751 2752 return FALSE; 2752 2753 } … … 2801 2802 * will be the last, and we can only unref self in the last callback: 2802 2803 * This is destroyed in the idle GDestroyNotify callback. */ 2804 2803 2805 info->stopper = tny_idle_stopper_new(); 2804 2806 … … 2918 2920 { 2919 2921 TransferMsgsInfo *info = thr_user_data; 2920 2921 2922 if (info->callback) 2922 2923 info->callback (info->self, info->cancelled, &info->err, info->user_data); 2923 2924 2924 /* Prevent status callbacks from being called after this 2925 2925 * (can happen because the 2 idle callbacks have different priorities) 2926 2926 * by causing tny_idle_stopper_is_stopped() to return TRUE. */ 2927 2927 tny_idle_stopper_stop (info->stopper); 2928 2929 2928 return FALSE; 2930 2929 } … … 2950 2949 g_assert (TNY_IS_FOLDER (folder_dst)); 2951 2950 2952 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 2953 TNY_FOLDER_ERROR, TNY_FOLDER_ERROR_TRANSFER_MSGS)) 2951 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 2952 priv->account, err, TNY_FOLDER_ERROR, 2953 TNY_FOLDER_ERROR_TRANSFER_MSGS)) 2954 2954 return; 2955 2955 … … 3323 3323 { 3324 3324 TransferMsgsInfo *info = thr_user_data; 3325 3326 3325 g_error_free (info->err); 3327 3326 g_object_unref (info->new_header_list); 3328 3327 g_object_unref (info->self); 3329 3328 g_slice_free (TransferMsgsInfo, info); 3329 return; 3330 3330 } 3331 3331 … … 3334 3334 { 3335 3335 TransferMsgsInfo *info = thr_user_data; 3336 3337 3336 if (info->callback) 3338 3337 info->callback (info->self, TRUE, &info->err, info->user_data); 3339 3340 3338 return FALSE; 3341 3339 } … … 3509 3507 #ifdef DEBUG_EXTRA 3510 3508 g_print ("_tny_camel_folder_unreason (%s) : %d\n", 3511 priv->folder_name?priv->folder_name:"(cleared)", priv->reason_to_live); 3509 priv->folder_name?priv->folder_name:"(cleared)", 3510 priv->reason_to_live); 3512 3511 #endif 3513 3512 … … 3771 3770 _tny_camel_folder_set_all_count (folder, info->total); 3772 3771 _tny_camel_folder_set_local_size (folder, info->local_size); 3772 3773 3773 if (!info->name) 3774 g_warning ("Creating invalid folder\n"); 3774 g_critical ("Creating invalid folder. This indicates a problem " 3775 "in the software\n"); 3776 3775 3777 _tny_camel_folder_set_name (folder, info->name); 3776 3778 _tny_camel_folder_set_iter (folder, info); … … 3803 3805 CamelException subex = CAMEL_EXCEPTION_INITIALISER; 3804 3806 3805 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 3806 TNY_FOLDER_STORE_ERROR, TNY_FOLDER_STORE_ERROR_CREATE_FOLDER)) 3807 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 3808 priv->account, err, TNY_FOLDER_STORE_ERROR, 3809 TNY_FOLDER_STORE_ERROR_CREATE_FOLDER)) 3807 3810 return NULL; 3808 3811 … … 3942 3945 CamelFolderInfo *iter; 3943 3946 3944 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), priv->account, err, 3945 TNY_FOLDER_STORE_ERROR, TNY_FOLDER_STORE_ERROR_GET_FOLDERS)) 3947 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), 3948 priv->account, err, TNY_FOLDER_STORE_ERROR, 3949 TNY_FOLDER_STORE_ERROR_GET_FOLDERS)) 3946 3950 return; 3947 3948 3951 3949 3952 if (!priv->iter && priv->iter_parented) … … 4029 4032 /* thread reference */ 4030 4033 _tny_camel_folder_unreason (priv); 4031 g_object_unref ( G_OBJECT (info->self));4032 g_object_unref ( G_OBJECT (info->list));4034 g_object_unref (info->self); 4035 g_object_unref (info->list); 4033 4036 4034 4037 if (info->err) … … 4051 4054 { 4052 4055 GetFoldersInfo *info = thr_user_data; 4053 4054 4056 if (info->callback) 4055 4057 info->callback (info->self, info->list, &info->err, info->user_data); 4056 4057 4058 return FALSE; 4058 4059 } … … 4103 4104 { 4104 4105 GetFoldersInfo *info = thr_user_data; 4105 4106 4106 g_error_free (info->err); 4107 4107 g_object_unref (info->self); 4108 4108 g_object_unref (info->list); 4109 4109 g_slice_free (GetFoldersInfo, info); 4110 return; 4110 4111 } 4111 4112 … … 4114 4115 { 4115 4116 GetFoldersInfo *info = thr_user_data; 4116 4117 4117 if (info->callback) 4118 4118 info->callback (info->self, info->list, &info->err, info->user_data); 4119 4120 4119 return FALSE; 4121 4120 } … … 4200 4199 if (!load_folder (priv)) 4201 4200 return NULL; 4202 4201 4203 4202 retval = priv->folder; 4204 4203 if (retval) … … 4216 4215 } 4217 4216 4218 typedef struct 4219 { 4217 typedef struct { 4220 4218 TnyFolder *self; 4221 4219 gint unread; … … 4246 4244 notify_folder_observers_about (self, change); 4247 4245 4248 4249 4246 g_object_unref (change); 4250 4247 … … 4256 4253 { 4257 4254 PokeStatusInfo *info = (PokeStatusInfo *) data; 4258 4259 4255 g_object_unref (info->self); 4260 4261 4256 g_slice_free (PokeStatusInfo, info); 4257 return; 4262 4258 } 4263 4259 … … 4335 4331 /* Thread reference */ 4336 4332 g_object_ref (self); 4337 4338 4333 _tny_camel_queue_launch (TNY_FOLDER_PRIV_GET_QUEUE (priv), 4339 4334 tny_camel_folder_poke_status_thread, self); … … 4349 4344 4350 4345 4351 if (info) 4346 if (info) 4352 4347 { 4353 4348 info->self = TNY_FOLDER (g_object_ref (self)); 4354 4355 4349 execute_callback (g_main_depth (), G_PRIORITY_HIGH, 4356 4350 tny_camel_folder_poke_status_callback, info, 4357 4351 tny_camel_folder_poke_status_destroyer); 4358 4359 4352 } 4360 4353 … … 4523 4516 * Check for strlen(), because camel produces an empty (non-null) 4524 4517 * uri for POP. */ 4518 4525 4519 if (priv->iter && priv->iter->uri && (strlen (priv->iter->uri) > 0)) 4526 4520 { … … 4538 4532 } 4539 4533 4540 if (!retval) { /* Strange, a local one? */4534 if (!retval) { /* Strange, a local one? */ 4541 4535 g_warning ("tny_folder_get_url_string doe
