static void e_book_backend_vcf_start_book_view (EBookBackend *backend, EDataBookView *book_view) { VCFBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_VCF (backend)); d(printf ("starting book view thread\n")); closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL); e_flag_wait (closure->running); /* at this point we know the book view thread is actually running */ d(printf ("returning from start_book_view\n")); }
static void e_book_backend_webdav_start_view (EBookBackend *backend, EDataBookView *book_view) { EBookBackendWebdav *webdav = E_BOOK_BACKEND_WEBDAV (backend); EBookBackendWebdavPrivate *priv = webdav->priv; EBookBackendSExp *sexp; const gchar *query; GList *contacts; GList *l; sexp = e_data_book_view_get_sexp (book_view); query = e_book_backend_sexp_text (sexp); g_mutex_lock (&priv->cache_lock); contacts = e_book_backend_cache_get_contacts (priv->cache, query); g_mutex_unlock (&priv->cache_lock); for (l = contacts; l != NULL; l = g_list_next (l)) { EContact *contact = l->data; e_data_book_view_notify_update (book_view, contact); g_object_unref (contact); } g_list_free (contacts); /* this way the UI is notified about cached contacts immediately, * and the update thread notifies about possible changes only */ e_data_book_view_notify_complete (book_view, NULL /* Success */); if (e_backend_get_online (E_BACKEND (backend))) { WebdavBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_WEBDAV (backend)); closure->thread = g_thread_new (NULL, book_view_thread, book_view); e_flag_wait (closure->running); } }