Changeset 2499
- Timestamp:
- 07/25/07 23:41:34
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c (modified) (6 diffs)
- trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (3 diffs)
- trunk/libtinymail-camel/tny-camel-imap-store-account.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-pop-store-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-pop-store-account.c (modified) (4 diffs)
- trunk/tests/c-demo/tny-demoui-summary-view.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2497 r2499 5 5 * Disconnecting after summary retrieval of a POP folder 6 6 * Disconnecting after get-msg and sync of a POP folder 7 * Some reference counting problems when factoring folders 7 8 8 9 2007-07-24 Philip Van Hoof <pvanhoof@gnome.org> trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c
r2497 r2499 492 492 pop3_store = CAMEL_POP3_STORE (folder->parent_store); 493 493 494 if (!pop3_store->delete_after && !expunge) 495 return; 496 494 497 if (camel_disco_store_status (CAMEL_DISCO_STORE (pop3_store)) == CAMEL_DISCO_STORE_OFFLINE) 495 498 return; … … 518 521 } 519 522 523 g_static_rec_mutex_unlock (pop3_store->eng_lock); 524 520 525 camel_operation_start(NULL, _("Expunging deleted messages")); 521 526 … … 529 534 /* busy already? wait for that to finish first */ 530 535 if (fi->cmd) { 536 g_static_rec_mutex_lock (pop3_store->eng_lock); 537 if (pop3_store->engine == NULL) { 538 g_static_rec_mutex_unlock (pop3_store->eng_lock); 539 return; 540 } 541 while (camel_pop3_engine_iterate(pop3_store->engine, fi->cmd) > 0) 542 ; 543 camel_pop3_engine_command_free(pop3_store->engine, fi->cmd); 544 g_static_rec_mutex_unlock (pop3_store->eng_lock); 545 546 fi->cmd = NULL; 547 } 548 549 /* This file is written by TnyCamelPopLocalMsgRemoveStrategy */ 550 expunged_path = g_strdup_printf ("%s/%s.expunged", pop3_store->storage_path, fi->uid); 551 if (fi->flags & g_file_test (expunged_path, G_FILE_TEST_EXISTS)) 552 { 553 g_static_rec_mutex_lock (pop3_store->eng_lock); 554 if (pop3_store->engine == NULL) { 555 g_static_rec_mutex_unlock (pop3_store->eng_lock); 556 return; 557 } 558 fi->cmd = camel_pop3_engine_command_new(pop3_store->engine, 0, NULL, NULL, "DELE %u\r\n", fi->id); 559 g_static_rec_mutex_unlock (pop3_store->eng_lock); 560 561 g_unlink (expunged_path); 562 /* also remove from cache */ 563 if (pop3_store->cache && fi->uid) 564 camel_data_cache_remove(pop3_store->cache, "cache", fi->uid, NULL); 565 } 566 567 g_free (expunged_path); 568 } 569 570 for (i = 0; i < pop3_folder->uids->len; i++) { 571 fi = pop3_folder->uids->pdata[i]; 572 /* wait for delete commands to finish */ 573 if (fi->cmd) { 574 575 g_static_rec_mutex_lock (pop3_store->eng_lock); 576 577 if (pop3_store->engine == NULL) { 578 g_static_rec_mutex_unlock (pop3_store->eng_lock); 579 return; 580 } 581 531 582 while (camel_pop3_engine_iterate(pop3_store->engine, fi->cmd) > 0) 532 583 ; 533 584 camel_pop3_engine_command_free(pop3_store->engine, fi->cmd); 534 585 fi->cmd = NULL; 535 } 536 537 /* This file is written by TnyCamelPopLocalMsgRemoveStrategy */ 538 expunged_path = g_strdup_printf ("%s/%s.expunged", pop3_store->storage_path, fi->uid); 539 if (fi->flags & g_file_test (expunged_path, G_FILE_TEST_EXISTS)) 540 { 541 fi->cmd = camel_pop3_engine_command_new(pop3_store->engine, 0, NULL, NULL, "DELE %u\r\n", fi->id); 542 g_unlink (expunged_path); 543 /* also remove from cache */ 544 if (pop3_store->cache && fi->uid) 545 camel_data_cache_remove(pop3_store->cache, "cache", fi->uid, NULL); 546 } 547 548 g_free (expunged_path); 549 } 550 551 for (i = 0; i < pop3_folder->uids->len; i++) { 552 fi = pop3_folder->uids->pdata[i]; 553 /* wait for delete commands to finish */ 554 if (fi->cmd) { 555 while (camel_pop3_engine_iterate(pop3_store->engine, fi->cmd) > 0) 556 ; 557 camel_pop3_engine_command_free(pop3_store->engine, fi->cmd); 558 fi->cmd = NULL; 586 587 g_static_rec_mutex_unlock (pop3_store->eng_lock); 588 559 589 } 560 590 camel_operation_progress(NULL, (i+1) , pop3_folder->uids->len); … … 574 604 { 575 605 struct _CamelPOP3Command *cmd; 606 607 g_static_rec_mutex_lock (pop3_store->eng_lock); 608 609 if (pop3_store->engine == NULL) { 610 g_static_rec_mutex_unlock (pop3_store->eng_lock); 611 return; 612 } 613 576 614 g_unlink (expunged_path); 577 615 cmd = camel_pop3_engine_command_new(pop3_store->engine, 0, NULL, NULL, "DELE %u\r\n", info->uid); … … 580 618 camel_data_cache_remove(pop3_store->cache, "cache", info->uid, NULL); 581 619 camel_pop3_engine_command_free(pop3_store->engine, cmd); 620 621 g_static_rec_mutex_unlock (pop3_store->eng_lock); 622 582 623 camel_message_info_free((CamelMessageInfo *)info); 583 624 } … … 587 628 588 629 camel_operation_end(NULL); 589 590 g_static_rec_mutex_unlock (pop3_store->eng_lock);591 630 592 631 camel_service_disconnect (CAMEL_SERVICE (pop3_store), TRUE, &dex); trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c
r2498 r2499 837 837 838 838 g_static_rec_mutex_lock (pop3_store->eng_lock); 839 839 840 840 if (pop3_store->engine == NULL) { 841 841 g_static_rec_mutex_unlock (pop3_store->eng_lock); trunk/libtinymail-camel/tny-camel-folder.c
r2489 r2499 4139 4139 { 4140 4140 PokeStatusInfo *info = (PokeStatusInfo *) data; 4141 4141 4142 g_object_unref (info->self); 4142 4143 g_slice_free (PokeStatusInfo, info); … … 4168 4169 4169 4170 folder = poke_folders->data; 4171 4172 if (folder == NULL) 4173 goto mycont; 4170 4174 4171 4175 priv = TNY_CAMEL_FOLDER_GET_PRIVATE (folder); … … 4198 4202 info, tny_camel_folder_poke_status_destroyer); 4199 4203 } 4200 4201 4204 g_object_unref (folder); 4202 4205 poke_folders->data = NULL; 4206 4207 mycont: 4203 4208 poke_folders = g_list_next (poke_folders); 4204 4209 mypoke_folders = poke_folders; trunk/libtinymail-camel/tny-camel-imap-store-account.c
r2194 r2499 72 72 TnyCamelFolder *folder = NULL; 73 73 74 GList *copy = priv->managed_folders; 74 GList *copy = NULL; 75 76 g_static_rec_mutex_lock (priv->factory_lock); 77 78 copy = priv->managed_folders; 75 79 while (copy) 76 80 { 77 81 TnyFolder *fnd = (TnyFolder*) copy->data; 78 82 const gchar *name = tny_folder_get_id (fnd); 79 if (!strcmp (name, full_name)) 83 84 /* printf ("COMPARE: [%s] [%s]\n", name, full_name); */ 85 86 if (name && full_name && !strcmp (name, full_name)) 80 87 { 81 88 folder = TNY_CAMEL_FOLDER (g_object_ref (G_OBJECT (fnd))); … … 88 95 if (!folder) { 89 96 folder = TNY_CAMEL_FOLDER (_tny_camel_imap_folder_new ()); 97 priv->managed_folders = g_list_prepend (priv->managed_folders, folder); 98 99 /* printf ("CREATE: %s\n", full_name); */ 100 90 101 *was_new = TRUE; 91 102 } 103 104 g_static_rec_mutex_unlock (priv->factory_lock); 92 105 93 106 return (TnyFolder *) folder; trunk/libtinymail-camel/tny-camel-pop-store-account-priv.h
r2244 r2499 25 25 struct _TnyCamelPopStoreAccountPriv 26 26 { 27 TnyFolder *inbox; 27 28 GMutex *lock; 28 29 }; trunk/libtinymail-camel/tny-camel-pop-store-account.c
r2307 r2499 95 95 { 96 96 TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self); 97 TnyCamelFolder *folder = NULL; 98 99 GList *copy = priv->managed_folders; 100 while (copy) 101 { 102 TnyFolder *fnd = (TnyFolder*) copy->data; 103 const gchar *name = tny_folder_get_id (fnd); 104 if (!strcmp (name, full_name)) 105 { 106 folder = TNY_CAMEL_FOLDER (g_object_ref (G_OBJECT (fnd))); 107 *was_new = FALSE; 108 break; 109 } 110 copy = g_list_next (copy); 111 } 112 113 if (!folder) { 114 folder = TNY_CAMEL_FOLDER (_tny_camel_pop_folder_new ()); 97 TnyCamelPopStoreAccountPriv *ppriv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 98 99 g_static_rec_mutex_lock (priv->factory_lock); 100 101 if (!ppriv->inbox) 102 { 115 103 *was_new = TRUE; 116 } 117 118 return (TnyFolder *) folder; 104 ppriv->inbox = TNY_FOLDER (_tny_camel_pop_folder_new ()); 105 priv->managed_folders = g_list_prepend (priv->managed_folders, ppriv->inbox); 106 } 107 108 g_static_rec_mutex_unlock (priv->factory_lock); 109 110 return (TnyFolder *) g_object_ref (ppriv->inbox); 119 111 } 120 112 … … 138 130 { 139 131 TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (object); 132 133 if (priv->inbox) 134 g_object_unref (priv->inbox); 140 135 141 136 g_mutex_free (priv->lock); … … 232 227 233 228 pop3_store->immediate_delete_after = !enabled; 234 235 236 229 } 237 230 … … 242 235 TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (instance); 243 236 237 priv->inbox = NULL; 244 238 priv->lock = g_mutex_new (); 245 239 trunk/tests/c-demo/tny-demoui-summary-view.c
r2467 r2499 95 95 TnyMsgView *msg_view; 96 96 guint accounts_reloaded_signal; 97 GtkWidget *status, *progress, *online_button, *poke_button ;97 GtkWidget *status, *progress, *online_button, *poke_button, *sync_button; 98 98 guint status_id; 99 99 gulong mailbox_select_sid; … … 1381 1381 } 1382 1382 1383 static void 1384 sync_button_clicked (GtkWidget *button, gpointer user_data) 1385 { 1386 TnyDemouiSummaryView *self = user_data; 1387 TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 1388 GtkTreeIter iter; 1389 GtkTreeModel *model; 1390 1391 if (gtk_tree_selection_get_selected (priv->mailbox_select, &model, &iter)) 1392 { 1393 gint type; 1394 1395 gtk_tree_model_get (model, &iter, 1396 TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, 1397 &type, -1); 1398 1399 if (type != TNY_FOLDER_TYPE_ROOT) 1400 { 1401 TnyFolder *folder; 1402 gtk_tree_model_get (model, &iter, 1403 TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 1404 &folder, -1); 1405 1406 if (TNY_IS_FOLDER (folder)) 1407 tny_folder_sync_async (folder, TRUE, NULL, NULL, NULL); 1408 1409 g_object_unref (folder); 1410 } 1411 1412 } 1413 } 1414 1383 1415 1384 1416 static void … … 1670 1702 priv->online_button = gtk_toggle_button_new_with_label (GO_ONLINE_TXT); 1671 1703 priv->poke_button = gtk_button_new_with_label ("Poke status"); 1704 priv->sync_button = gtk_button_new_with_label ("Sync"); 1672 1705 priv->current_accounts = NULL; 1673 1706 … … 1677 1710 g_signal_connect (G_OBJECT (priv->poke_button), "clicked", 1678 1711 G_CALLBACK (poke_button_toggled), self); 1712 1713 g_signal_connect (G_OBJECT (priv->sync_button), "clicked", 1714 G_CALLBACK (sync_button_clicked), self); 1679 1715 1680 1716 #if PLATFORM==1 … … 1705 1741 gtk_box_pack_start (GTK_BOX (priv->status), priv->online_button, FALSE, FALSE, 0); 1706 1742 gtk_box_pack_start (GTK_BOX (priv->status), priv->poke_button, FALSE, FALSE, 0); 1743 gtk_box_pack_start (GTK_BOX (priv->status), priv->sync_button, FALSE, FALSE, 0); 1707 1744 1708 1745 gtk_widget_show (priv->online_button); 1709 1746 gtk_widget_show (priv->poke_button); 1747 gtk_widget_show (priv->sync_button); 1710 1748 gtk_widget_show (priv->status); 1711 1749 gtk_widget_show (GTK_WIDGET (vbox));
