mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-gtk
synced 2026-02-01 17:49:50 +00:00
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>
This commit is contained in:
parent
1d9a7b7291
commit
b576e3a8df
@ -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
|
||||
*/
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user