Changeset 1495
- Timestamp:
- 01/29/07 01:03:07
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-session-camel.c (modified) (15 diffs)
- trunk/libtinymail-gnome-desktop/tny-gnome-device.c (modified) (1 diff)
- trunk/tinymail/tny-demoui-summary-view.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1494 r1495 1 2007-01-29 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * Finally, asynchronously connecting. Though, it's experimental. 4 1 5 2007-01-28 Philip Van Hoof <pvanhoof@gnome.org> 2 6 trunk/libtinymail-camel/tny-session-camel.c
r1485 r1495 206 206 } 207 207 208 209 typedef struct210 {211 TnySessionCamel *self;212 GMainLoop *loop;213 gchar* data;214 TnyGetPassFunc func;215 gboolean cancel;216 gchar *prompt;217 TnyAccount *account;218 } GetPassWaitResults;219 220 221 static gpointer222 get_pwd_thread (gpointer data)223 {224 GetPassWaitResults *results = data;225 226 while (!(g_main_loop_is_running (results->loop)))227 usleep (100);228 229 tny_lockable_lock (results->self->priv->ui_lock);230 results->data = results->func (results->account, results->prompt, &results->cancel);231 tny_lockable_unlock (results->self->priv->ui_lock);232 233 g_main_loop_quit (results->loop);234 235 g_thread_exit (NULL);236 return NULL;237 }238 239 240 208 static char * 241 209 tny_session_camel_get_password (CamelSession *session, CamelService *service, const char *domain, … … 250 218 gboolean found = FALSE, freeprmpt = FALSE, cancel = FALSE; 251 219 gchar *retval = NULL, *prmpt = (gchar*)prompt; 252 GetPassWaitResults results; 253 GThread *thread; gboolean inf; 220 GThread *thread; 254 221 255 222 while (G_LIKELY (copy)) … … 286 253 287 254 288 i nf = priv->in_auth_function;289 if (inf)return;255 if (priv->in_auth_function) 256 return; 290 257 291 258 g_mutex_lock (priv->colock); … … 293 260 priv->in_auth_function = TRUE; 294 261 295 results.self = self; 296 results.account = account; 297 results.prompt = prmpt; 298 results.data = NULL; 299 results.cancel = FALSE; 300 results.func = func; 301 302 results.loop = g_main_loop_new (NULL, FALSE); 303 304 thread = g_thread_create (get_pwd_thread, &results, TRUE, NULL); 305 306 tny_lockable_unlock (priv->ui_lock); 307 g_main_loop_run (results.loop); 308 tny_lockable_lock (priv->ui_lock); 309 310 g_main_loop_unref (results.loop); 311 312 g_thread_join (thread); 313 314 retval = results.data; 315 cancel = results.cancel; 262 tny_lockable_lock (self->priv->ui_lock); 263 retval = func (account, prmpt, &cancel); 264 tny_lockable_unlock (self->priv->ui_lock); 316 265 317 266 priv->in_auth_function = FALSE; … … 355 304 356 305 357 typedef struct358 {359 TnySessionCamel *self;360 GMainLoop *loop;361 TnyForgetPassFunc func;362 TnyAccount *account;363 } ForGetPassWaitResults;364 365 366 static gpointer367 forget_pwd_thread (gpointer data)368 {369 ForGetPassWaitResults *results = data;370 371 while (!(g_main_loop_is_running (results->loop)))372 usleep (100);373 374 tny_lockable_lock (results->self->priv->ui_lock);375 results->func (results->account);376 tny_lockable_unlock (results->self->priv->ui_lock);377 378 g_main_loop_quit (results->loop);379 380 g_thread_exit (NULL);381 return NULL;382 }383 306 384 307 static void … … 392 315 TnyAccount *account; 393 316 gboolean found = FALSE; 394 ForGetPassWaitResults results; 395 GThread *thread; gboolean inf; 317 GThread *thread; 396 318 397 319 while (G_LIKELY (copy)) … … 412 334 { 413 335 414 i nf = priv->in_auth_function;415 if (inf)return;336 if (priv->in_auth_function) 337 return; 416 338 417 339 g_mutex_lock (priv->colock); … … 419 341 priv->in_auth_function = TRUE; 420 342 421 results.self = self; 422 results.account = account; 423 results.func = func; 424 results.loop = g_main_loop_new (NULL, FALSE); 425 426 thread = g_thread_create (forget_pwd_thread, &results, TRUE, NULL); 427 428 tny_lockable_unlock (priv->ui_lock); 429 g_main_loop_run (results.loop); 430 tny_lockable_lock (priv->ui_lock); 431 432 g_main_loop_unref (results.loop); 433 434 g_thread_join (thread); 343 tny_lockable_lock (self->priv->ui_lock); 344 func (account); 345 tny_lockable_unlock (self->priv->ui_lock); 435 346 436 347 priv->in_auth_function = FALSE; … … 444 355 445 356 446 447 typedef struct448 {449 TnySessionCamel *self;450 GMainLoop *loop;451 TnyAlertType tnytype;452 gchar *prompt;453 gboolean retval;454 } AlertWaitResults;455 456 457 static gpointer458 alert_thread (gpointer data)459 {460 AlertWaitResults *results = data;461 462 while (!(g_main_loop_is_running (results->loop)))463 usleep (100);464 465 tny_lockable_lock (results->self->priv->ui_lock);466 results->retval = tny_account_store_alert (467 (TnyAccountStore*)results->self->priv->account_store,468 results->tnytype, (const gchar *) results->prompt);469 tny_lockable_unlock (results->self->priv->ui_lock);470 471 g_main_loop_quit (results->loop);472 473 g_thread_exit (NULL);474 return NULL;475 }476 357 477 358 /* tny_session_camel_alert_user will for example be called when SSL is on and … … 487 368 TnySessionCamelPriv *priv = self->priv; 488 369 GThread *thread; gboolean inf; 370 gboolean retval = FALSE; 489 371 490 372 if (priv->account_store) … … 492 374 TnyAccountStore *account_store = (TnyAccountStore*) priv->account_store; 493 375 TnyAlertType tnytype; 494 AlertWaitResults results;495 376 496 377 switch (type) … … 508 389 } 509 390 510 i nf = priv->in_auth_function;511 if (inf) return;391 if (priv->in_auth_function) 392 return FALSE; 512 393 513 394 g_mutex_lock (priv->colock); … … 515 396 priv->in_auth_function = TRUE; 516 397 517 results.self = self; 518 results.tnytype = tnytype; 519 results.prompt = g_strdup (prompt); 520 results.retval = FALSE; 521 results.loop = g_main_loop_new (NULL, FALSE); 522 523 thread = g_thread_create (alert_thread, &results, TRUE, NULL); 524 525 tny_lockable_unlock (priv->ui_lock); 526 g_main_loop_run (results.loop); 527 tny_lockable_lock (priv->ui_lock); 528 529 g_main_loop_unref (results.loop); 530 531 g_thread_join (thread); 398 tny_lockable_lock (self->priv->ui_lock); 399 retval = tny_account_store_alert ( 400 (TnyAccountStore*) self->priv->account_store, 401 tnytype, (const gchar *) prompt); 402 tny_lockable_unlock (self->priv->ui_lock); 532 403 533 404 priv->in_auth_function = FALSE; … … 535 406 g_mutex_unlock (priv->colock); 536 407 537 g_free (results.prompt); 538 539 return results.retval; 540 } 541 542 return FALSE; 408 } 409 410 return retval; 543 411 } 544 412 … … 813 681 camel_session_set_online ((CamelSession *) self, online); 814 682 815 /* TODO: This makes a mainloop (above) take over in the new thread 816 g_thread_create (background_connect_thread, info, FALSE, NULL); */817 818 background_connect_thread (info);683 /* TODO: This makes a mainloop (above) take over in the new thread */ 684 g_thread_create (background_connect_thread, info, FALSE, NULL); 685 686 /* background_connect_thread (info); */ 819 687 820 688 return; trunk/libtinymail-gnome-desktop/tny-gnome-device.c
r1065 r1495 133 133 g_print (_("Invalid network manager installation. Going to assume Offline status\n")); 134 134 priv->invnm = TRUE; 135 136 libnm_glib_unregister_callback (priv->nm_ctx, priv->callback_id); 137 libnm_glib_shutdown (priv->nm_ctx); 138 135 139 case LIBNM_NO_NETWORK_CONNECTION: 136 140 default: trunk/tinymail/tny-demoui-summary-view.c
r1485 r1495 691 691 692 692 priv->last_mailbox_correct_select_set = FALSE; 693 priv->online_button = gtk_toggle_button_new ();693 priv->online_button = gtk_toggle_button_new_with_label (GO_ONLINE_TXT); 694 694 priv->current_accounts = NULL; 695 695
