> > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > 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. > Could be quite dangerous to expose it (well, that's the reason of the warning anyway). > Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > --- > src/spice-channel.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > 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; > @@ -317,6 +321,25 @@ static void spice_channel_class_init(SpiceChannelClass > *klass) > G_PARAM_READABLE | > 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 > + */ I think would be safer if this interface could return a NULL object so user of the object could deal with it. This will allow to interface to change implementation if needed. > + 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 Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel