[farsight2/master] Emit signal or error on action completeness

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:24:33 PST 2008


---
 fs-upnp-simple-igd.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 8b51620..f29385d 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -304,12 +304,27 @@ _service_proxy_got_external_ip_address (GUPnPServiceProxy *proxy,
     GUPnPServiceProxyAction *action,
     gpointer user_data)
 {
+  FsUpnpSimpleIgd *self = FS_UPNP_SIMPLE_IGD_CAST (user_data);
   GError *error = NULL;
   gchar *ip = NULL;
 
-  gupnp_service_proxy_end_action (proxy, action, &error,
-      "NewExternalIPAddress", G_TYPE_STRING, &ip,
-      NULL);
+  if (gupnp_service_proxy_end_action (proxy, action, &error,
+          "NewExternalIPAddress", G_TYPE_STRING, &ip,
+          NULL))
+  {
+    g_signal_emit (self, signals[SIGNAL_NEW_EXTERNAL_IP], 0,
+        ip);
+  }
+  else
+  {
+    GQuark detail = 0;
+    if (error)
+      detail = error->domain;
+
+    g_signal_emit (self, signals[SIGNAL_ERROR], detail,
+        error);
+  }
+  g_clear_error (&error);
 }
 
 static void
-- 
1.5.6.5




More information about the farsight-commits mailing list