root/trunk/libnotify/tests/test-server-info.c

Revision 2755 (checked in by chipx86, 3 years ago)

Patch by jensgr to fix some C99 usage in the tests code.

Line 
1 /*
2  * @file tests/test-server-info.c Retrieves the server info and caps
3  *
4  * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA  02111-1307, USA.
20  */
21
22 #include <libnotify/notify.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25
26 int
27 main(int argc, char **argv)
28 {
29     GList *l, *caps;
30     char *name, *vendor, *version, *spec_version;
31
32     notify_init("TestCaps");
33
34     if (!notify_get_server_info(&name, &vendor, &version, &spec_version))
35     {
36         fprintf(stderr, "Failed to receive server info.\n");
37         exit(1);
38     }
39
40     printf("Name:         %s\n", name);
41     printf("Vendor:       %s\n", vendor);
42     printf("Version:      %s\n", version);
43     printf("Spec Version: %s\n", spec_version);
44     printf("Capabilities:\n");
45
46     caps = notify_get_server_caps();
47
48     if (caps == NULL)
49     {
50         fprintf(stderr, "Failed to receive server caps.\n");
51         exit(1);
52     }
53
54     for (l = caps; l != NULL; l = l->next)
55         printf("\t%s\n", (char *)l->data);
56
57     g_list_foreach(caps, (GFunc)g_free, NULL);
58     g_list_free(caps);
59
60     return 0;
61 }
Note: See TracBrowser for help on using the browser.