[farsight2/master] Get notification when the ip address changes
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:59 PST 2008
---
fs-upnp-simple-igd.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index aa1c36d..b62391f 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -303,12 +303,22 @@ fs_upnp_simple_igd_dispose (GObject *object)
G_OBJECT_CLASS (fs_upnp_simple_igd_parent_class)->dispose (object);
}
+
+static void
+_external_ip_address_changed (GUPnPServiceProxy *proxy, const gchar *variable,
+ GValue *value, gpointer user_data)
+{
+}
+
static void
free_proxy (struct Proxy *prox)
{
if (prox->external_ip_action)
gupnp_service_proxy_cancel_action (prox->proxy, prox->external_ip_action);
+ gupnp_service_proxy_remove_notify (prox->proxy, "ExternalIPAddress",
+ _external_ip_address_changed, prox);
+
g_object_unref (prox->proxy);
g_ptr_array_foreach (prox->proxymappings, (GFunc) stop_proxymapping, NULL);
g_ptr_array_free (prox->proxymappings, TRUE);
@@ -521,6 +531,11 @@ fs_upnp_simple_igd_gather (FsUpnpSimpleIgd *self,
prox->external_ip_action = gupnp_service_proxy_begin_action (prox->proxy,
"GetExternalIPAddress",
_service_proxy_got_external_ip_address, prox, NULL);
+
+ gupnp_service_proxy_add_notify (prox->proxy, "ExternalIPAddress",
+ G_TYPE_STRING, _external_ip_address_changed, prox);
+
+ gupnp_service_proxy_set_subscribed (prox->proxy, TRUE);
}
static void
--
1.5.6.5
More information about the farsight-commits
mailing list