diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-07-19 12:24:00 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-07-19 12:28:37 +0200 |
commit | 90039a4023fd466b2b29d6e4612a82ec2cab2f38 (patch) | |
tree | 1afd4c6edc9e33635f7b4595f0c69d65b7d5bffd /uca-net-camera.c | |
parent | 63b4d9a96ba2e8266262c7f6f36b5f44af894964 (diff) | |
download | uca-net-90039a4023fd466b2b29d6e4612a82ec2cab2f38.tar.gz uca-net-90039a4023fd466b2b29d6e4612a82ec2cab2f38.tar.bz2 uca-net-90039a4023fd466b2b29d6e4612a82ec2cab2f38.tar.xz uca-net-90039a4023fd466b2b29d6e4612a82ec2cab2f38.zip |
Allow setting host via UCA_NET_HOST
Diffstat (limited to 'uca-net-camera.c')
-rw-r--r-- | uca-net-camera.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/uca-net-camera.c b/uca-net-camera.c index a2411fd..daf177f 100644 --- a/uca-net-camera.c +++ b/uca-net-camera.c @@ -519,8 +519,12 @@ uca_net_camera_constructed (GObject *object) priv = UCA_NET_CAMERA_GET_PRIVATE (object); - if (priv->host == NULL) - priv->host = g_strdup ("localhost"); + if (priv->host == NULL || !g_strcmp0 (priv->host, "")) { + const gchar *env; + + env = g_getenv ("UCA_NET_HOST"); + priv->host = env != NULL ? g_strdup (env) : g_strdup ("localhost"); + } priv->connection = g_socket_client_connect_to_host (priv->client, priv->host, UCA_NET_DEFAULT_PORT, NULL, &priv->construct_error); @@ -562,7 +566,7 @@ uca_net_camera_class_init (UcaNetCameraClass *klass) g_param_spec_string ("host", "Host name and optional port", "Host name and optional port", - "localhost", + "", G_PARAM_READWRITE | G_PARAM_CONSTRUCT); for (guint i = PROP_0 + 1; i < N_BASE_PROPERTIES; i++) @@ -581,6 +585,7 @@ uca_net_camera_init (UcaNetCamera *self) self->priv = priv = UCA_NET_CAMERA_GET_PRIVATE (self); + priv->host = NULL; priv->construct_error = NULL; priv->client = g_socket_client_new (); } |