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