Coding style and whitespace cleanups.
[platform/upstream/evolution-data-server.git] / tests / libecal / test-search.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 #include <stdlib.h>
4 #include <libecal/e-cal.h>
5
6 gint
7 main (gint argc, gchar **argv)
8 {
9         ECal *ecal;
10         GList *l, *objects;
11
12         g_type_init ();
13
14         if (argc < 3) {
15                 printf ("usage: test-search <uid> <query>\n");
16                 exit (0);
17         }
18
19         ecal = e_cal_new_from_uri (argv[1], E_CAL_SOURCE_TYPE_EVENT);
20
21         if (!e_cal_open (ecal, TRUE, NULL)) {
22                 printf ("failed to open calendar\n");
23                 exit (0);
24         }
25
26         if (!e_cal_get_object_list_as_comp (ecal, argv[2], &objects, NULL)) {
27                 printf ("failed to get objects\n");
28                 exit (0);
29         }
30
31         printf ("Received %d objects\n", g_list_length (objects));
32         for (l = objects; l; l = l->next) {
33                 ECalComponent *comp = E_CAL_COMPONENT (l->data);
34                 gchar *str;
35
36                 str = e_cal_component_get_as_string (comp);
37                 printf ("%s\n", str);
38
39                 g_free (str);
40                 g_object_unref (comp);
41         }
42
43         g_list_free (objects);
44
45         g_object_unref (ecal);
46
47         return 0;
48 }