# HG changeset patch # User rosfran # Date 1179966370 -3600 # Node ID 5cc97240e2389cc99b6d028ec3576bfb2cc0f24c # Parent 48d1f2628be16a362a1c2a19a5c8b8be0a877e3b [svn r712] GObject's signal handling on receiving UPnP device notifications. diff -r 48d1f2628be1 -r 5cc97240e238 gmyth-upnp/src/gmyth_upnp.c --- a/gmyth-upnp/src/gmyth_upnp.c Thu May 24 01:25:19 2007 +0100 +++ b/gmyth-upnp/src/gmyth_upnp.c Thu May 24 01:26:10 2007 +0100 @@ -8,8 +8,6 @@ * * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. * @author Rosfran Lins Borges - * - *//* * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -178,13 +176,29 @@ G_OBJECT_CLASS (gmyth_upnp_parent_class)->finalize (object); } +gchar * +gmyth_upnp_device_status_to_string( GMythUPnPDeviceStatus status ) +{ + if ( status == CgUpnpDeviceStatusAdded ) + return "Added"; + else if ( status == CgUpnpDeviceStatusUpdated ) + return "Updated"; + else if ( status == CgUpnpDeviceStatusInvalid ) + return "Invalid"; + else if ( status == CgUpnpDeviceStatusRemoved ) + return "Removed"; + + return ""; +} + /** * GObject's signal handler */ static void _mythtv_device_found( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar* udn ) { - g_debug( "status = %d, UDN = %s\n", status, udn ); + g_debug( "Device: [status = %s, UDN = %s]\n", + gmyth_upnp_device_status_to_string( status ), udn ); } /** @@ -250,6 +264,8 @@ gmyth_upnp->port = gmyth_uri_get_port( uri ); gmyth_upnp->protocol = gmyth_uri_get_protocol( uri ); + gmyth_debug("MythTV UPnP service [ %s, %d ].", gmyth_upnp->host, gmyth_upnp->port); + upnp_servers_list = g_list_append( upnp_servers_list, gmyth_upnp ); if ( uri != NULL ) diff -r 48d1f2628be1 -r 5cc97240e238 gmyth-upnp/src/gmyth_upnp.h --- a/gmyth-upnp/src/gmyth_upnp.h Thu May 24 01:25:19 2007 +0100 +++ b/gmyth-upnp/src/gmyth_upnp.h Thu May 24 01:26:10 2007 +0100 @@ -9,8 +9,6 @@ * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. * @author Rosfran Lins Borges * - *//* - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -63,7 +61,7 @@ GMYTH_UPNP_DEVICE_REMOVED } GMythUPnPDeviceStatus; -typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev, gpointer obj ); +typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev ); struct _GMythUPnPClass { @@ -109,6 +107,8 @@ GMythBackendInfo* gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp ); +gchar * gmyth_upnp_device_status_to_string( GMythUPnPDeviceStatus status ); + G_END_DECLS #endif /* _GMYTH_UPNP_H_ */