diff options
author | Alon Levy <alevy@redhat.com> | 2011-07-02 05:06:39 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-07-02 18:04:05 +0200 |
commit | 391a724e2a3e06b83a051c59100398462e0aa20c (patch) | |
tree | c1cdc377961f811c8bc2847f124662eccca11cdb | |
parent | f143b2a53a92107217dc4c59d88578bf6ead9048 (diff) |
spice-channel: add property total-bytes-read
-rw-r--r-- | gtk/spice-channel-priv.h | 2 | ||||
-rw-r--r-- | gtk/spice-channel.c | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index 84da31c..dfd35eb 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -123,6 +123,8 @@ struct spice_channel { GArray *common_caps; GArray *remote_caps; GArray *remote_common_caps; + + gsize total_read_bytes; }; spice_msg_in *spice_msg_in_new(SpiceChannel *channel); diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index ab24a4b..ae3b9e7 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -74,6 +74,7 @@ enum { PROP_SESSION, PROP_CHANNEL_TYPE, PROP_CHANNEL_ID, + PROP_TOTAL_READ_BYTES, }; /* Signals */ @@ -189,6 +190,9 @@ static void spice_channel_get_property(GObject *gobject, case PROP_CHANNEL_ID: g_value_set_int(value, c->channel_id); break; + case PROP_TOTAL_READ_BYTES: + g_value_set_uint(value, c->total_read_bytes); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); break; @@ -288,6 +292,15 @@ static void spice_channel_class_init(SpiceChannelClass *klass) G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + g_object_class_install_property + (gobject_class, PROP_TOTAL_READ_BYTES, + g_param_spec_uint("total-read-bytes", + "Total read bytes", + "", + 0, UINT_MAX, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + /** * SpiceChannel::channel-event: * @channel: the channel that emitted the signal @@ -792,6 +805,7 @@ static int spice_channel_read(SpiceChannel *channel, void *data, size_t length) SPICE_DEBUG("still needs %" G_GSIZE_FORMAT, len); #endif } + c->total_read_bytes += length; return length; } |