1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 #include <libecal/e-cal.h>
6 #include "ecal-test-utils.h"
8 #define SET_MODE_TIMEOUT 30
9 #define MODE_FINAL CAL_MODE_LOCAL
11 static void cal_set_mode_timeout_cb (gpointer user_data) __attribute__ ((noreturn));
13 static guint cal_set_mode_timeout_id = 0;
16 cal_set_mode_cb (ECalTestClosure *closure)
18 g_source_remove (cal_set_mode_timeout_id);
20 if (closure->mode != MODE_FINAL) {
21 g_warning ("set mode to %d, but we expected %d", closure->mode,
25 g_main_loop_quit ((GMainLoop *) closure->user_data);
29 cal_set_mode_timeout_cb (gpointer user_data)
31 g_warning ("failed to get a confirmation for the new calendar mode we "
32 "set (within a reasonable time frame)");
46 cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
47 ecal_test_utils_cal_open (cal, FALSE);
49 cal_set_mode_timeout_id = g_timeout_add_seconds (SET_MODE_TIMEOUT,
50 (GSourceFunc) cal_set_mode_timeout_cb, cal);
52 loop = g_main_loop_new (NULL, TRUE);
53 ecal_test_utils_cal_set_mode (cal, MODE_FINAL,
54 (GSourceFunc) cal_set_mode_cb, loop);
56 g_main_loop_run (loop);