Changeset 1712
- Timestamp:
- 03/08/07 02:48:04
- Files:
-
- trunk/libtinymail-camel/tny-camel-account.c (modified) (3 diffs)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (2 diffs)
- trunk/tests/functional/folder-lister.c (modified) (2 diffs)
- trunk/tests/memory/memory-test.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/tny-camel-account.c
r1665 r1712 216 216 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 217 217 GThread *thread; 218 GError *err = NULL; 218 219 219 220 g_mutex_lock (priv->cancel_lock); … … 221 222 /* I know this isn't polite. But it works ;-) */ 222 223 /* camel_operation_cancel (NULL); */ 223 thread = g_thread_create (camel_cancel_hack_thread, NULL, TRUE, NULL); 224 g_thread_join (thread); 224 thread = g_thread_create (camel_cancel_hack_thread, NULL, TRUE, &err); 225 if (err == NULL) 226 g_thread_join (thread); 227 else 228 g_error_free (err); 225 229 226 230 if (priv->cancel) … … 781 785 camel_disco_store_set_status (CAMEL_DISCO_STORE (priv->service), 782 786 CAMEL_DISCO_STORE_ONLINE, &ex); 787 if (!camel_exception_is_set (&ex)) 788 camel_service_connect (CAMEL_SERVICE (priv->service), &ex); 789 783 790 goto done; 784 791 } else if (camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (priv->service))) { trunk/libtinymail-camel/tny-camel-folder.c
r1706 r1712 970 970 } 971 971 972 _tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account),973 NULL, NULL, NULL); 972 /*_tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->account), 973 NULL, NULL, NULL); */ 974 974 975 975 oldlen = priv->cached_length; … … 980 980 priv->want_changes = TRUE; 981 981 982 _tny_camel_account_stop_camel_operation (TNY_CAMEL_ACCOUNT (priv->account));982 /* _tny_camel_account_stop_camel_operation (TNY_CAMEL_ACCOUNT (priv->account)); */ 983 983 984 984 priv->cached_length = camel_folder_get_message_count (priv->folder); trunk/tests/functional/folder-lister.c
r1437 r1712 86 86 TnyStoreAccount *account; 87 87 TnyIterator *iter; 88 88 gint i; 89 89 90 free (malloc (10)); 90 91 91 92 g_type_init (); 92 93 93 context = g_option_context_new ("- The tinymail functional tester");94 context = g_option_context_new ("- The tinymail functional tester"); 94 95 g_option_context_add_main_entries (context, options, "tinymail"); 95 g_option_context_parse (context, &argc, &argv, NULL);96 g_option_context_parse (context, &argc, &argv, NULL); 96 97 97 98 account_store = tny_test_account_store_new (online, cachedir); … … 101 102 102 103 g_option_context_free (context); 103 104 104 accounts = tny_simple_list_new (); 105 105 106 106 tny_account_store_get_accounts (account_store, accounts, 107 TNY_ACCOUNT_STORE_STORE_ACCOUNTS);107 TNY_ACCOUNT_STORE_STORE_ACCOUNTS); 108 108 g_object_unref (G_OBJECT (account_store)); 109 110 109 iter = tny_list_create_iterator (accounts); 111 110 account = (TnyStoreAccount*) tny_iterator_get_current (iter); 112 111 113 recursion_level = 0; 114 recurse_folders (TNY_FOLDER_STORE (account), NULL); 115 112 recursion_level = 0; 113 for (i=0; i<1; i++) 114 recurse_folders (TNY_FOLDER_STORE (account), NULL); 115 116 116 g_object_unref (G_OBJECT (account)); 117 117 g_object_unref (G_OBJECT (iter)); 118 118 g_object_unref (G_OBJECT (accounts)); 119 119 120 120 return 0; 121 121 } trunk/tests/memory/memory-test.c
r1711 r1712 34 34 #include <tny-camel-header-priv.h> 35 35 36 typedef void (*performer) (TnyFolder *folder); 36 typedef void (*performer_t) (TnyFolder *folder); 37 static gint recursion_level=0; 38 static gchar *cachedir=NULL; 39 static gboolean online=FALSE, justget=FALSE; 37 40 38 41 static void 39 42 do_get_folder (TnyFolder *folder) 40 { 43 { 41 44 g_print ("Getting headers of %s ...\n", tny_folder_get_id (folder)); 42 45 tny_folder_refresh (folder, NULL); … … 50 53 gint length, bytes; 51 54 gdouble kbytes, mbytes; 52 55 53 56 g_print ("Loading headers for %s ...\n", tny_folder_get_id (folder)); 54 57 tny_folder_get_headers (folder, headers, FALSE, NULL); 55 58 length=tny_list_get_length (headers); 56 59 57 bytes = (sizeof (TnyCamelHeader) + sizeof (CamelMessageInfo) +60 bytes = (sizeof (TnyCamelHeader) + sizeof (CamelMessageInfo) + 58 61 sizeof (CamelMessageInfoBase) + 59 62 sizeof (CamelMessageContentInfo)); 60 63 61 64 kbytes = ((gdouble)bytes) / 1024; 62 mbytes = kbytes / 1024;63 65 mbytes = kbytes / 1024; 66 64 67 g_print ("Loaded %d headers\n\n", length); 65 68 66 g_print ("\tsizeof (TnyHeader) = %d - accounts for %d bytes (~%.2lfK)\n", sizeof (TnyCamelHeader), length * sizeof (TnyCamelHeader), ((gdouble)length * sizeof (TnyCamelHeader))/1024);69 g_print ("\tsizeof (TnyHeader) = %d - accounts for %d bytes (~%.2lfK)\n", sizeof (TnyCamelHeader), length * sizeof (TnyCamelHeader), ((gdouble)length * sizeof (TnyCamelHeader))/1024); 67 70 g_print ("\tsizeof (CamelMessageInfo) = %d - accounts for %d bytes (~%.2lfK)\n", sizeof (CamelMessageInfo), length * sizeof (CamelMessageInfo), ((gdouble)length * sizeof (CamelMessageInfo))/1024); 68 71 g_print ("\tsizeof (CamelMessageInfoBase) = %d - accounts for %d bytes (~%.2lfK)\n", sizeof (CamelMessageInfoBase), length * sizeof (CamelMessageInfoBase), ((gdouble)length * sizeof (CamelMessageInfoBase))/1024); … … 71 74 g_print ("\nThis means that (at least) %d bytes or ~%.2lfK or ~%.2lfM are needed for this folder\n", bytes, kbytes, mbytes); 72 75 73 g_print ("Sleeping to allow your valgrind to see this...\n");76 g_print ("Sleeping to allow your valgrind to see this...\n"); 74 77 sleep (5); 75 78 g_print ("Unloading headers ...\n"); 76 79 g_object_unref (G_OBJECT (headers)); 77 g_print ("Sleeping to allow your valgrind to see this...\n");80 g_print ("Sleeping to allow your valgrind to see this...\n"); 78 81 sleep (5); 79 82 } 80 81 82 static void83 recurse_folders (TnyFolderStore *store, TnyFolderStoreQuery *query, const gchar *folname, performer func)84 {85 TnyIterator *iter;86 TnyList *folders = tny_simple_list_new ();87 88 tny_folder_store_get_folders (store, folders, query, NULL);89 iter = tny_list_create_iterator (folders);90 91 while (!tny_iterator_is_done (iter))92 {93 TnyFolderStore *folder = (TnyFolderStore*) tny_iterator_get_current (iter);94 printf ("%s\n", folname);95 if (!strcmp (tny_folder_get_id (TNY_FOLDER (folder)), folname))96 func (TNY_FOLDER (folder));97 98 recurse_folders (folder, query, folname, func);99 100 g_object_unref (G_OBJECT (folder));101 102 tny_iterator_next (iter);103 }104 105 g_object_unref (G_OBJECT (iter));106 g_object_unref (G_OBJECT (folders));107 }108 109 110 static gchar *cachedir=NULL;111 static gboolean online=FALSE;112 83 113 84 static const GOptionEntry options[] = … … 116 87 "Cache directory", NULL }, 117 88 { "online", 'o', 0, G_OPTION_ARG_NONE, &online, 118 "Online or offline", NULL }, 89 "Online or offline", NULL }, 90 { "justget", 'j', 0, G_OPTION_ARG_NONE, &justget, 91 "Just get the messages", NULL }, 92 119 93 { NULL } 120 94 }; … … 126 100 TnyAccountStore *account_store; 127 101 TnyList *accounts; 102 TnyFolderStoreQuery *query; 128 103 TnyStoreAccount *account; 129 TnyIterator *aiter; 130 TnyList *folders; 131 gint i=0; 132 gchar *folderids[12] = { 133 "INBOX/100", "INBOX/200","INBOX/500","INBOX/700", 134 "INBOX/1000", "INBOX/2000","INBOX/3000","INBOX/5000", "INBOX/10000", 135 "INBOX/30000", "INBOX/40000","INBOX/50000" }; 136 137 free (malloc (10)); 138 104 TnyIterator *iter, *topiter; 105 TnyList *folders, *topfolders; 106 TnyFolder *inbox; 107 108 free (malloc (10)); 139 109 g_type_init (); 140 110 141 context = g_option_context_new ("- The tinymail memorytester");111 context = g_option_context_new ("- The tinymail functional tester"); 142 112 g_option_context_add_main_entries (context, options, "tinymail"); 143 144 145 113 g_option_context_parse (context, &argc, &argv, NULL); 146 114 … … 151 119 152 120 g_option_context_free (context); 121 accounts = tny_simple_list_new (); 153 122 154 accounts = tny_simple_list_new ();155 156 123 tny_account_store_get_accounts (account_store, accounts, 157 124 TNY_ACCOUNT_STORE_STORE_ACCOUNTS); 125 g_object_unref (G_OBJECT (account_store)); 126 iter = tny_list_create_iterator (accounts); 127 account = (TnyStoreAccount*) tny_iterator_get_current (iter); 158 128 159 aiter = tny_list_create_iterator (accounts); 160 tny_iterator_first (aiter); 161 account = TNY_STORE_ACCOUNT (tny_iterator_get_current (aiter)); 162 163 if (online) 164 for (i=0; i<12; i++) 165 recurse_folders (TNY_FOLDER_STORE (account), NULL, folderids[i], do_get_folder); 129 topfolders = tny_simple_list_new (); 130 folders = tny_simple_list_new (); 166 131 167 for (i=0; i<12; i++) 168 recurse_folders (TNY_FOLDER_STORE (account), NULL, folderids[i], do_test_folder); 169 170 err: 132 tny_folder_store_get_folders (TNY_FOLDER_STORE (account), topfolders, NULL, NULL); 133 topiter = tny_list_create_iterator (topfolders); 134 inbox = TNY_FOLDER (tny_iterator_get_current (topiter)); 135 136 tny_folder_store_get_folders (TNY_FOLDER_STORE (inbox), folders, NULL, NULL); 137 iter = tny_list_create_iterator (folders); 138 139 while (!tny_iterator_is_done (iter)) 140 { 141 TnyFolder *folder = (TnyFolder*) tny_iterator_get_current (iter); 142 143 printf ("NAME=%s\n", tny_folder_get_name (folder)); 144 145 if (online) 146 do_get_folder (folder); 147 if (!justget) 148 do_test_folder (folder); 149 g_object_unref (G_OBJECT (folder)); 150 tny_iterator_next (iter); 151 } 152 153 g_object_unref (G_OBJECT (iter)); 154 g_object_unref (G_OBJECT (folders)); 155 156 g_object_unref (G_OBJECT (inbox)); 157 g_object_unref (G_OBJECT (topiter)); 158 g_object_unref (G_OBJECT (topfolders)); 159 171 160 g_object_unref (G_OBJECT (account)); 172 g_object_unref (G_OBJECT (aiter));173 161 g_object_unref (G_OBJECT (accounts)); 174 162 175 163 return 0; 176 164 } 177 165 166
