[gssdp] Make host-ip writable during construction



commit e35a6aacb6f3e653767a76bee120a42dd21b4a40
Author: Jens Georg <mail jensge org>
Date:   Mon Dec 7 23:55:13 2015 +0100

    Make host-ip writable during construction
    
    So we can avoid calling get_host_ip alltogether if the creator knows
    which IP on the device is used.
    
    Signed-off-by: Jens Georg <mail jensge org>

 libgssdp/gssdp-client.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index ab25469..b3ec56d 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -397,6 +397,9 @@ gssdp_client_set_property (GObject      *object,
         case PROP_NETWORK:
                 client->priv->device.network = g_value_dup_string (value);
                 break;
+        case PROP_HOST_IP:
+                client->priv->device.host_ip = g_value_dup_string (value);
+                break;
         case PROP_ACTIVE:
                 client->priv->active = g_value_get_boolean (value);
                 break;
@@ -561,7 +564,8 @@ gssdp_client_class_init (GSSDPClientClass *klass)
                                       "The IP address of the associated"
                                       "network interface",
                                       NULL,
-                                      G_PARAM_READABLE |
+                                      G_PARAM_READWRITE |
+                                      G_PARAM_CONSTRUCT |
                                       G_PARAM_STATIC_NAME |
                                       G_PARAM_STATIC_NICK |
                                       G_PARAM_STATIC_BLURB));
@@ -1796,6 +1800,12 @@ init_network_info (GSSDPClient *client, GError **error)
             client->priv->device.host_ip == NULL)
                 get_host_ip (&(client->priv->device));
 
+        if (client->priv->device.host_addr == NULL) {
+                client->priv->device.host_addr =
+                                g_inet_address_new_from_string
+                                    (client->priv->device.host_ip);
+        }
+
         if (client->priv->device.iface_name == NULL) {
                 g_set_error_literal (error,
                                      GSSDP_ERROR,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]