From 816babd47ffe25842f68144f9197cfef73759796 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 16 Feb 2016 12:03:02 +0100 Subject: Set host and connect in constructed method --- uca-net-camera.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/uca-net-camera.c b/uca-net-camera.c index 6088ef3..d755a07 100644 --- a/uca-net-camera.c +++ b/uca-net-camera.c @@ -232,6 +232,19 @@ ufo_net_camera_initable_init (GInitable *initable, return TRUE; } +static void +uca_net_camera_constructed (GObject *object) +{ + UcaNetCameraPrivate *priv; + + priv = UCA_NET_CAMERA_GET_PRIVATE (object); + + if (priv->host == NULL) + priv->host = g_strdup ("localhost"); + + priv->connection = g_socket_client_connect_to_host (priv->client, priv->host, 8989, NULL, &priv->construct_error); +} + static void uca_net_camera_initable_iface_init (GInitableIface *iface) { @@ -246,6 +259,7 @@ uca_net_camera_class_init (UcaNetCameraClass *klass) oclass->set_property = uca_net_camera_set_property; oclass->get_property = uca_net_camera_get_property; + oclass->constructed = uca_net_camera_constructed; oclass->dispose = uca_net_camera_dispose; oclass->finalize = uca_net_camera_finalize; @@ -282,11 +296,6 @@ uca_net_camera_init (UcaNetCamera *self) priv->construct_error = NULL; priv->client = g_socket_client_new (); - - if (priv->host == NULL) - priv->host = g_strdup ("localhost"); - - priv->connection = g_socket_client_connect_to_host (priv->client, priv->host, 8989, NULL, &priv->construct_error); } G_MODULE_EXPORT GType -- cgit v1.2.3