2 * Copyright (C) 2006 OpenedHand Ltd.
4 * Author: Jorn Baayen <jorn@openedhand.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
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 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #include <libgssdp/gssdp.h>
27 resource_available_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
33 g_print ("resource available\n"
37 for (l = locations; l; l = l->next)
38 g_print (" Location: %s\n", (char *) l->data);
42 resource_unavailable_cb (G_GNUC_UNUSED GSSDPResourceBrowser *resource_browser,
45 g_print ("resource unavailable\n"
51 main (G_GNUC_UNUSED int argc,
52 G_GNUC_UNUSED char **argv)
55 GSSDPResourceBrowser *resource_browser;
59 #if !GLIB_CHECK_VERSION (2, 35, 0)
64 client = g_initable_new (GSSDP_TYPE_CLIENT,
69 g_printerr ("Error creating the GSSDP client: %s\n",
77 resource_browser = gssdp_resource_browser_new (client,
80 g_signal_connect (resource_browser,
82 G_CALLBACK (resource_available_cb),
84 g_signal_connect (resource_browser,
85 "resource-unavailable",
86 G_CALLBACK (resource_unavailable_cb),
89 gssdp_resource_browser_set_active (resource_browser, TRUE);
91 main_loop = g_main_loop_new (NULL, FALSE);
92 g_main_loop_run (main_loop);
93 g_main_loop_unref (main_loop);
95 g_object_unref (resource_browser);
96 g_object_unref (client);