diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-08-26 18:17:21 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-08-26 19:31:36 +0400 |
commit | b576e3a8df111aa73b9ee20381b2425a14bd3823 (patch) | |
tree | 4f7f26cc012b4182de712af1539279df2a8c779d | |
parent | 1d9a7b7291b57d0780d686263a0bef5d77ad86c0 (diff) |
channel: add read-only socket property
Channel users (such as spice widget) may want to know some connection
details. Instead of exposing various connection properties, we may as
well just have a GSocket property, with a strong warning on usage.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r-- | src/spice-channel.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/spice-channel.c b/src/spice-channel.c index 4e792a2..95662f3 100644 --- a/src/spice-channel.c +++ b/src/spice-channel.c @@ -85,6 +85,7 @@ enum { PROP_CHANNEL_TYPE, PROP_CHANNEL_ID, PROP_TOTAL_READ_BYTES, + PROP_SOCKET, }; /* Signals */ @@ -215,6 +216,9 @@ static void spice_channel_get_property(GObject *gobject, case PROP_TOTAL_READ_BYTES: g_value_set_ulong(value, c->total_read_bytes); break; + case PROP_SOCKET: + g_value_set_object(value, c->sock); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); break; @@ -318,6 +322,25 @@ static void spice_channel_class_init(SpiceChannelClass *klass) G_PARAM_STATIC_STRINGS)); /** + * SpiceChannel:socket: + * + * Get the underlying #GSocket. Note that you should not read or + * write any data to it directly since this will likely corrupt + * the channel stream. This property is mainly useful to get some + * connections details. + * + * Since: 0.33 + */ + g_object_class_install_property + (gobject_class, PROP_SOCKET, + g_param_spec_object("socket", + "Socket", + "Underlying GSocket", + G_TYPE_SOCKET, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /** * SpiceChannel::channel-event: * @channel: the channel that emitted the signal * @event: a #SpiceChannelEvent |