[svn r712] GObject's signal handling on receiving UPnP device notifications.
1.1 --- a/gmyth-upnp/src/gmyth_upnp.c Thu May 24 01:25:19 2007 +0100
1.2 +++ b/gmyth-upnp/src/gmyth_upnp.c Thu May 24 01:26:10 2007 +0100
1.3 @@ -8,8 +8,6 @@
1.4 *
1.5 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
1.6 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
1.7 - *
1.8 - *//*
1.9 *
1.10 * This program is free software; you can redistribute it and/or modify
1.11 * it under the terms of the GNU Lesser General Public License as published by
1.12 @@ -178,13 +176,29 @@
1.13 G_OBJECT_CLASS (gmyth_upnp_parent_class)->finalize (object);
1.14 }
1.15
1.16 +gchar *
1.17 +gmyth_upnp_device_status_to_string( GMythUPnPDeviceStatus status )
1.18 +{
1.19 + if ( status == CgUpnpDeviceStatusAdded )
1.20 + return "Added";
1.21 + else if ( status == CgUpnpDeviceStatusUpdated )
1.22 + return "Updated";
1.23 + else if ( status == CgUpnpDeviceStatusInvalid )
1.24 + return "Invalid";
1.25 + else if ( status == CgUpnpDeviceStatusRemoved )
1.26 + return "Removed";
1.27 +
1.28 + return "";
1.29 +}
1.30 +
1.31 /**
1.32 * GObject's signal handler
1.33 */
1.34 static void
1.35 _mythtv_device_found( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar* udn )
1.36 {
1.37 - g_debug( "status = %d, UDN = %s\n", status, udn );
1.38 + g_debug( "Device: [status = %s, UDN = %s]\n",
1.39 + gmyth_upnp_device_status_to_string( status ), udn );
1.40 }
1.41
1.42 /**
1.43 @@ -250,6 +264,8 @@
1.44 gmyth_upnp->port = gmyth_uri_get_port( uri );
1.45 gmyth_upnp->protocol = gmyth_uri_get_protocol( uri );
1.46
1.47 + gmyth_debug("MythTV UPnP service [ %s, %d ].", gmyth_upnp->host, gmyth_upnp->port);
1.48 +
1.49 upnp_servers_list = g_list_append( upnp_servers_list, gmyth_upnp );
1.50
1.51 if ( uri != NULL )
2.1 --- a/gmyth-upnp/src/gmyth_upnp.h Thu May 24 01:25:19 2007 +0100
2.2 +++ b/gmyth-upnp/src/gmyth_upnp.h Thu May 24 01:26:10 2007 +0100
2.3 @@ -9,8 +9,6 @@
2.4 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
2.5 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
2.6 *
2.7 - *//*
2.8 - *
2.9 * This program is free software; you can redistribute it and/or modify
2.10 * it under the terms of the GNU Lesser General Public License as published by
2.11 * the Free Software Foundation; either version 2 of the License, or
2.12 @@ -63,7 +61,7 @@
2.13 GMYTH_UPNP_DEVICE_REMOVED
2.14 } GMythUPnPDeviceStatus;
2.15
2.16 -typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev, gpointer obj );
2.17 +typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev );
2.18
2.19 struct _GMythUPnPClass
2.20 {
2.21 @@ -109,6 +107,8 @@
2.22
2.23 GMythBackendInfo* gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp );
2.24
2.25 +gchar * gmyth_upnp_device_status_to_string( GMythUPnPDeviceStatus status );
2.26 +
2.27 G_END_DECLS
2.28
2.29 #endif /* _GMYTH_UPNP_H_ */