static gboolean
test_sync (ECalClient *cal_client)
{
	GError *error = NULL;
	GSList *attachment_uris = NULL;
	const gchar *uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");

	g_return_val_if_fail (uid != NULL, FALSE);

	if (!e_cal_client_get_attachment_uris_sync (cal_client, uid, NULL, &attachment_uris, NULL, &error)) {
		report_error ("get attachment uris sync", &error);
		return FALSE;
	}

	return manage_result (attachment_uris);
}
static void
test_send_objects_sync (ETestServerFixture *fixture,
                        gconstpointer user_data)
{
	ECalClient *cal_client;
	GError *error = NULL;
	icalcomponent *icalcomp, *modified_icalcomp = NULL;
	GSList *users = NULL;

	cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);

	icalcomp = create_object ();
	if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error))
		g_error ("send objects sync: %s", error->message);

	icalcomponent_free (icalcomp);
	manage_result (users, modified_icalcomp);
}
static void
async_send_result_ready (GObject *source_object,
                         GAsyncResult *result,
                         gpointer user_data)
{
	ECalClient *cal_client;
	GError *error = NULL;
	GSList *users = NULL;
	icalcomponent *modified_icalcomp = NULL;
	GMainLoop *loop = (GMainLoop *) user_data;

	cal_client = E_CAL_CLIENT (source_object);

	if (!e_cal_client_send_objects_finish (cal_client, result, &users, &modified_icalcomp, &error))
		g_error ("send objects finish: %s", error->message);

	manage_result (users, modified_icalcomp);
	g_main_loop_quit (loop);
}
static gboolean
test_sync (ECalClient *cal_client)
{
	GError *error = NULL;
	icalcomponent *icalcomp, *modified_icalcomp = NULL;
	GSList *users = NULL;

	icalcomp = create_object ();

	if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error)) {
		report_error ("send objects sync", &error);
		icalcomponent_free (icalcomp);
		return FALSE;
	}

	icalcomponent_free (icalcomp);

	return manage_result (users, modified_icalcomp);
}
/* asynchronous callback with a main-loop running */
static void
async_attachment_uris_result_ready (GObject *source_object,
                                    GAsyncResult *result,
                                    gpointer user_data)
{
	ECalClient *cal_client;
	GError *error = NULL;
	GSList *attachment_uris = NULL;

	cal_client = E_CAL_CLIENT (source_object);

	if (!e_cal_client_get_attachment_uris_finish (cal_client, result, &attachment_uris, &error)) {
		report_error ("get attachment uris finish", &error);
		stop_main_loop (1);
		return;
	}

	stop_main_loop (manage_result (attachment_uris) ? 0 : 1);
}
/* asynchronous callback with a main-loop running */
static void
async_send_result_ready (GObject *source_object,
                         GAsyncResult *result,
                         gpointer user_data)
{
	ECalClient *cal_client;
	GError *error = NULL;
	GSList *users = NULL;
	icalcomponent *modified_icalcomp = NULL;

	cal_client = E_CAL_CLIENT (source_object);

	if (!e_cal_client_send_objects_finish (cal_client, result, &users, &modified_icalcomp, &error)) {
		report_error ("send objects finish", &error);
		stop_main_loop (1);
		return;
	}

	stop_main_loop (manage_result (users, modified_icalcomp) ? 0 : 1);
}