e_book_backend_ldap_notify_online_cb (EBookBackend *backend,
                                      GParamSpec *pspec)
{
	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);

	/* Cancel all running operations */
	ldap_cancel_all_operations (backend);

	if (!e_backend_get_online (E_BACKEND (backend))) {
		/* Go offline */

		e_book_backend_set_writable (backend, FALSE);

		bl->priv->connected = FALSE;
	} else {
		/* Go online */

		e_book_backend_set_writable (backend, TRUE);

		if (e_book_backend_is_opened (backend)) {
			GError *error = NULL;

			if (!e_book_backend_ldap_connect (bl, &error)) {
				e_book_backend_notify_error (
					backend, error->message);
				g_error_free (error);
			}

			if (bl->priv->marked_for_offline && bl->priv->cache)
				generate_cache (bl);
		}
	}
}
e_book_backend_ldap_notify_online_cb (EBookBackend *backend,
                                      GParamSpec *pspec)
{
	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);

	 
	ldap_cancel_all_operations (backend);

	if (!e_backend_get_online (E_BACKEND (backend))) {
		 

		e_book_backend_set_writable (backend, FALSE);

		bl->priv->connected = FALSE;
	} else {
		 

		e_book_backend_set_writable (backend, TRUE);

		if (e_book_backend_is_opened (backend)) {
			GError *error = NULL;

			if (!e_book_backend_ldap_connect (bl, &error)) {
				e_book_backend_notify_error (
					backend, error->message);
				g_error_free (error);
			}

			if (bl->priv->marked_for_offline && bl->priv->cache)
				generate_cache (bl);
		}
	}
}