Changeset 3422

Show
Ignore:
Timestamp:
02/19/08 00:29:07
Author:
pvanhoof
Message:

Small adaptations

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tests/functional/folder-lister.c

    r3315 r3422  
    1919#include <stdlib.h> 
    2020#include <glib.h> 
     21#include <gtk/gtk.h> 
    2122 
    2223#include <tny-list.h> 
     
    113114                recurse_folders (TNY_FOLDER_STORE (account), NULL); 
    114115 
     116        gtk_main(); 
     117 
    115118        g_object_unref (account); 
    116119        g_object_unref (iter); 
  • trunk/tests/shared/account-store.c

    r3304 r3422  
    9999} 
    100100 
     101typedef struct { 
     102        GCond *condition; 
     103        GMutex *mutex; 
     104        gboolean had_callback; 
     105} SyncInfo; 
     106 
     107 
     108static 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} 
    101119 
    102120static void 
     
    116134                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
    117135                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); 
    119136 
    120137                tny_account_set_proto (account, "imap"); 
     
    126143                tny_account_set_pass_func (account, per_account_get_pass); 
    127144 
     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 
    128164                tny_list_prepend (list, (GObject*)account); 
    129165                g_object_unref (G_OBJECT (account)); 
     
    136172                tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); 
    137173                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); 
    139174 
    140175                tny_account_set_proto (account, "something"); 
     
    145180                tny_account_set_forget_pass_func (account, per_account_forget_pass); 
    146181                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                } 
    147201 
    148202                tny_list_prepend (list, (GObject*)account);