Changeset 1403

Show
Ignore:
Timestamp:
01/13/07 17:27:36
Author:
pvanhoof
Message:

Simplified the async session stuff a bit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/tny-camel-account.c

    r1401 r1403  
    291291        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    292292 
    293         g_static_rec_mutex_lock (priv->service_lock); 
    294  
    295293        if (G_UNLIKELY (priv->id)) 
    296294                g_free (priv->id); 
    297295 
    298296        priv->id = g_strdup (id); 
    299  
    300         g_static_rec_mutex_unlock (priv->service_lock); 
    301297 
    302298        return; 
     
    338334{ 
    339335        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    340          
     336 
    341337        g_static_rec_mutex_lock (priv->service_lock); 
    342338 
     
    439435        const gchar *retval; 
    440436 
    441         g_static_rec_mutex_lock (priv->service_lock); 
    442437        retval = (const gchar*)priv->id; 
    443         g_static_rec_mutex_unlock (priv->service_lock); 
    444438 
    445439        return retval; 
     
    457451        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    458452        const gchar *retval; 
    459          
    460         g_static_rec_mutex_lock (priv->service_lock); 
     453 
    461454        retval = (const gchar*)priv->proto; 
    462         g_static_rec_mutex_unlock (priv->service_lock); 
    463455 
    464456        return retval; 
     
    477469        const gchar *retval; 
    478470 
    479         g_static_rec_mutex_lock (priv->service_lock); 
    480471        retval = (const gchar*)priv->user; 
    481         g_static_rec_mutex_unlock (priv->service_lock); 
    482472 
    483473        return retval; 
     
    496486        const gchar *retval; 
    497487 
    498         g_static_rec_mutex_lock (priv->service_lock); 
    499488        retval = (const gchar*)priv->host; 
    500         g_static_rec_mutex_unlock (priv->service_lock); 
    501489 
    502490        return retval; 
     
    515503        TnyGetPassFunc retval; 
    516504 
    517         g_static_rec_mutex_lock (priv->service_lock); 
    518505        retval = priv->get_pass_func; 
    519         g_static_rec_mutex_unlock (priv->service_lock); 
    520506 
    521507        return retval; 
     
    534520        TnyForgetPassFunc retval; 
    535521 
    536         g_static_rec_mutex_lock (priv->service_lock); 
    537522        retval = priv->forget_pass_func; 
    538         g_static_rec_mutex_unlock (priv->service_lock); 
    539523 
    540524        return retval; 
     
    547531        const CamelService *retval; 
    548532 
    549         g_static_rec_mutex_lock (priv->service_lock); 
    550533        retval = (const CamelService *)priv->service; 
    551         g_static_rec_mutex_unlock (priv->service_lock); 
    552534 
    553535        return retval; 
     
    560542        const gchar *retval; 
    561543 
    562         g_static_rec_mutex_lock (priv->service_lock); 
    563544        retval = (const gchar*)priv->url_string; 
    564         g_static_rec_mutex_unlock (priv->service_lock); 
    565545 
    566546        return retval; 
  • trunk/libtinymail-camel/tny-session-camel.c

    r1402 r1403  
    198198                        mark_del = g_list_next (mark_del); 
    199199                } 
    200  
    201200                g_list_free (mark_del); 
    202201        } 
     
    217216} GetPassWaitResults; 
    218217 
    219 static gboolean 
    220 get_pwd_idle_handler (gpointer data) 
     218 
     219static gpointer  
     220get_pwd_thread (gpointer data) 
    221221{ 
    222222        GetPassWaitResults *results = data; 
     
    228228        g_main_loop_quit (results->loop); 
    229229 
    230         return FALSE; 
    231 } 
    232  
    233 static gpointer  
    234 get_pwd_thread (gpointer results) 
    235 { 
    236         g_idle_add (get_pwd_idle_handler, results); 
    237230        g_thread_exit (NULL); 
    238231        return NULL; 
     
    297290 
    298291                thread = g_thread_create (get_pwd_thread, &results, TRUE, NULL); 
    299                 g_thread_join (thread); 
    300292 
    301293                if (g_main_loop_is_running (results.loop)) 
     
    305297                        tny_lockable_lock (priv->ui_lock); 
    306298                } 
    307  
    308299                g_main_loop_unref (results.loop); 
     300 
     301                tny_lockable_unlock (priv->ui_lock); 
     302                tny_lockable_lock (priv->ui_lock); 
    309303 
    310304                retval = results.data; 
     
    344338        return; 
    345339} 
    346  
    347340 
    348341 
     
    355348} ForGetPassWaitResults; 
    356349 
    357 static gboolean 
    358 forget_pwd_idle_handler (gpointer data) 
     350 
     351static gpointer  
     352forget_pwd_thread (gpointer data) 
    359353{ 
    360354        ForGetPassWaitResults *results = data; 
     
    366360        g_main_loop_quit (results->loop); 
    367361 
    368         return FALSE; 
    369 } 
    370  
    371 static gpointer  
    372 forget_pwd_thread (gpointer results) 
    373 { 
    374         g_idle_add (forget_pwd_idle_handler, results); 
    375362        g_thread_exit (NULL); 
    376363        return NULL; 
     
    411398                results.account = account; 
    412399                results.func = func; 
    413  
    414400                results.loop = g_main_loop_new (NULL, TRUE); 
    415401 
    416402                thread = g_thread_create (forget_pwd_thread, &results, TRUE, NULL); 
    417                 g_thread_join (thread); 
    418                  
     403 
    419404                if (g_main_loop_is_running (results.loop)) 
    420405                { 
     
    423408                        tny_lockable_lock (priv->ui_lock); 
    424409                } 
    425  
    426410                g_main_loop_unref (results.loop); 
     411 
     412                tny_lockable_unlock (priv->ui_lock); 
     413                tny_lockable_lock (priv->ui_lock); 
    427414 
    428415                priv->in_auth_function = FALSE; 
     
    443430} AlertWaitResults; 
    444431 
    445 static gboolean 
    446 alert_idle_handler (gpointer data) 
     432 
     433static gpointer  
     434alert_thread (gpointer data) 
    447435{ 
    448436        AlertWaitResults *results = data; 
     
    456444        g_main_loop_quit (results->loop); 
    457445 
    458         return FALSE; 
    459 } 
    460  
    461 static gpointer  
    462 alert_thread (gpointer results) 
    463 { 
    464         g_idle_add (alert_idle_handler, results); 
    465446        g_thread_exit (NULL); 
    466447        return NULL; 
     
    509490 
    510491                thread = g_thread_create (alert_thread, &results, TRUE, NULL); 
    511                 g_thread_join (thread); 
    512492 
    513493                if (g_main_loop_is_running (results.loop)) 
     
    517497                        tny_lockable_lock (priv->ui_lock); 
    518498                } 
    519  
    520499                g_main_loop_unref (results.loop); 
     500 
     501                tny_lockable_unlock (priv->ui_lock); 
     502                tny_lockable_lock (priv->ui_lock); 
    521503 
    522504                priv->in_auth_function = FALSE; 
  • trunk/libtinymailui-gtk/tny-gtk-lockable.c

    r1399 r1403  
    3030{ 
    3131        gdk_threads_enter (); 
     32        gdk_flush (); 
    3233} 
    3334 
     
    3536tny_gtk_lockable_unlock (TnyLockable *self) 
    3637{ 
     38        gdk_flush (); 
    3739        gdk_threads_leave (); 
    3840} 
  • trunk/tinymail/tny-main.c

    r900 r1403  
    8484        gdk_threads_init (); 
    8585 
     86        gdk_threads_enter (); 
     87 
     88        gtk_init (&argc, &argv); 
     89 
    8690#ifdef GNOME 
    8791        gnome_vfs_init (); 
     
    130134        gtk_main(); 
    131135 
     136        gdk_threads_leave (); 
     137 
    132138#ifdef MOZEMBED 
    133         PR_ProcessExit ((PRIntn)(long)0);               
     139        PR_ProcessExit ((PRIntn)(long)0); 
    134140#endif 
    135141