[Spice-devel] [PATCH 2/3] spice-channel: add property total-bytes-read
Alon Levy
alevy at redhat.com
Fri Jul 1 20:06:39 PDT 2011
---
gtk/spice-channel-priv.h | 2 ++
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;
}
--
1.7.5.4
More information about the Spice-devel
mailing list