Changeset 3422
- Timestamp:
- 02/19/08 00:29:07
- Files:
-
- trunk/tests/functional/folder-lister.c (modified) (2 diffs)
- trunk/tests/shared/account-store.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tests/functional/folder-lister.c
r3315 r3422 19 19 #include <stdlib.h> 20 20 #include <glib.h> 21 #include <gtk/gtk.h> 21 22 22 23 #include <tny-list.h> … … 113 114 recurse_folders (TNY_FOLDER_STORE (account), NULL); 114 115 116 gtk_main(); 117 115 118 g_object_unref (account); 116 119 g_object_unref (iter); trunk/tests/shared/account-store.c
r3304 r3422 99 99 } 100 100 101 typedef struct { 102 GCond *condition; 103 GMutex *mutex; 104 gboolean had_callback; 105 } SyncInfo; 106 107 108 static void went_online (TnyCamelAccount *account, gboolean canceled, GError *err, gpointer user_data) 109 { 110 SyncInfo *info = (SyncInfo *) user_data; 111 112 g_mutex_lock (info->mutex); 113 g_cond_broadcast (info->condition); 114 info->had_callback = TRUE; 115 g_mutex_unlock (info->mutex); 116 117 return; 118 } 101 119 102 120 static void … … 116 134 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 117 135 camel_session_set_online ((CamelSession*)me->session, me->force_online); 118 tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), me->force_online, NULL, NULL);119 136 120 137 tny_account_set_proto (account, "imap"); … … 126 143 tny_account_set_pass_func (account, per_account_get_pass); 127 144 145 if (me->force_online) { 146 SyncInfo *info = g_slice_new (SyncInfo); 147 148 info->mutex = g_mutex_new (); 149 info->condition = g_cond_new (); 150 info->had_callback = FALSE; 151 152 tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), me->force_online, went_online, info); 153 154 g_mutex_lock (info->mutex); 155 if (!info->had_callback) 156 g_cond_wait (info->condition, info->mutex); 157 g_mutex_unlock (info->mutex); 158 159 g_mutex_free (info->mutex); 160 g_cond_free (info->condition); 161 g_slice_free (SyncInfo, info); 162 } 163 128 164 tny_list_prepend (list, (GObject*)account); 129 165 g_object_unref (G_OBJECT (account)); … … 136 172 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 137 173 camel_session_set_online ((CamelSession*)me->session, me->force_online); 138 tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), me->force_online, NULL, NULL);139 174 140 175 tny_account_set_proto (account, "something"); … … 145 180 tny_account_set_forget_pass_func (account, per_account_forget_pass); 146 181 tny_account_set_pass_func (account, per_account_get_pass); 182 183 if (me->force_online) { 184 SyncInfo *info = g_slice_new (SyncInfo); 185 186 info->mutex = g_mutex_new (); 187 info->condition = g_cond_new (); 188 info->had_callback = FALSE; 189 190 tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), me->force_online, went_online, info); 191 192 g_mutex_lock (info->mutex); 193 if (!info->had_callback) 194 g_cond_wait (info->condition, info->mutex); 195 g_mutex_unlock (info->mutex); 196 197 g_mutex_free (info->mutex); 198 g_cond_free (info->condition); 199 g_slice_free (SyncInfo, info); 200 } 147 201 148 202 tny_list_prepend (list, (GObject*)account);
