static void soup_address_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (object); switch (prop_id) { case PROP_NAME: g_value_set_string (value, priv->name); break; case PROP_FAMILY: if (priv->sockaddr) g_value_set_enum (value, SOUP_ADDRESS_GET_FAMILY (priv)); else g_value_set_enum (value, 0); break; case PROP_PORT: g_value_set_int (value, priv->port); break; case PROP_PHYSICAL: g_value_set_string (value, soup_address_get_physical (SOUP_ADDRESS (object))); break; case PROP_PROTOCOL: g_value_set_string (value, priv->protocol); break; case PROP_SOCKADDR: g_value_set_pointer (value, priv->sockaddr); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static GSocketAddressEnumerator * soup_address_connectable_proxy_enumerate (GSocketConnectable *connectable) { SoupAddress *addr = SOUP_ADDRESS (connectable); SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); GSocketAddressEnumerator *proxy_enum; SoupURI *uri; char *uri_string; /* We cheerily assume "http" here because you shouldn't be * using SoupAddress any more if you're not doing HTTP anyway. */ uri = soup_uri_new (NULL); soup_uri_set_scheme (uri, priv->protocol ? priv->protocol : "http"); soup_uri_set_host (uri, priv->name ? priv->name : soup_address_get_physical (addr)); soup_uri_set_port (uri, priv->port); soup_uri_set_path (uri, ""); uri_string = soup_uri_to_string_internal (uri, FALSE, TRUE); proxy_enum = g_object_new (G_TYPE_PROXY_ADDRESS_ENUMERATOR, "connectable", connectable, "uri", uri_string, NULL); g_free (uri_string); soup_uri_free (uri); return proxy_enum; }
static void soup_address_finalize (GObject *object) { SoupAddress *addr = SOUP_ADDRESS (object); SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); g_free (priv->sockaddr); g_free (priv->name); g_free (priv->physical); g_mutex_clear (&priv->lock); G_OBJECT_CLASS (soup_address_parent_class)->finalize (object); }
static GSocketAddressEnumerator * soup_address_connectable_proxy_enumerate (GSocketConnectable *connectable) { SoupAddress *addr = SOUP_ADDRESS (connectable); SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); GSocketAddressEnumerator *proxy_enum; char *uri; /* We cheerily assume "http" here because you shouldn't be * using SoupAddress any more if you're not doing HTTP anyway. */ uri = g_strdup_printf ("%s://%s:%u", priv->protocol ? priv->protocol : "http", priv->name ? priv->name : soup_address_get_physical (addr), priv->port); proxy_enum = g_object_new (G_TYPE_PROXY_ADDRESS_ENUMERATOR, "connectable", connectable, "uri", uri, NULL); g_free (uri); return proxy_enum; }