1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/gmyth-upnp/test/main.c Fri Feb 01 22:17:33 2008 +0000
1.3 @@ -0,0 +1,49 @@
1.4 +#include <glib.h>
1.5 +
1.6 +#include "gmyth_upnp.h"
1.7 +
1.8 +static void
1.9 +_device_found_cb (GMythUPnP *upnp,
1.10 + GMythBackendInfo *info,
1.11 + gpointer data)
1.12 +{
1.13 + g_debug ("BACKEND FOUND: %s", info->hostname);
1.14 +}
1.15 +
1.16 +static void
1.17 +_device_lost_cb (GMythUPnP *upnp,
1.18 + GMythBackendInfo *info,
1.19 + gpointer data)
1.20 +{
1.21 + g_debug ("BACKEND LOST: %s", info->hostname);
1.22 +}
1.23 +
1.24 +
1.25 +
1.26 +int main (int argc, char** argv)
1.27 +{
1.28 + GMythUPnP *o;
1.29 + GMainLoop *loop;
1.30 +
1.31 + g_type_init ();
1.32 + g_thread_init (NULL);
1.33 +
1.34 + o = gmyth_upnp_get_instance ();
1.35 + g_signal_connect (o,
1.36 + "device-found",
1.37 + G_CALLBACK (_device_found_cb),
1.38 + NULL);
1.39 + g_signal_connect (o,
1.40 + "device-lost",
1.41 + G_CALLBACK (_device_lost_cb),
1.42 + NULL);
1.43 +
1.44 +
1.45 + gmyth_upnp_search (o);
1.46 +
1.47 + loop = g_main_loop_new (NULL, FALSE);
1.48 + g_main_loop_run (loop);
1.49 + g_object_unref (o);
1.50 +
1.51 + return 0;
1.52 +}