summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2016-09-09 09:19:53 +0200
committerPavel Grunt <pgrunt@redhat.com>2016-09-14 14:33:01 +0200
commitd142a3ecdd3e9122986bbde51897a96884660e39 (patch)
tree8ef30ed94aead7c75673576cf37aafc8db6a98e4
parent6bc4d1cbb233c475fb3395135b5bc19edf63c242 (diff)
main: Introduce agent-features propertyagentfeatures
Notify on changes to make the client aware of features availability
-rw-r--r--src/channel-main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/channel-main.c b/src/channel-main.c
index 341df4f..0827e86 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -152,6 +152,7 @@ enum {
PROP_DISABLE_DISPLAY_POSITION,
PROP_DISABLE_DISPLAY_ALIGN,
PROP_MAX_CLIPBOARD,
+ PROP_AGENT_FEATURES,
};
/* Signals */
@@ -312,6 +313,9 @@ static void spice_main_get_property(GObject *object,
case PROP_MAX_CLIPBOARD:
g_value_set_int(value, spice_main_get_max_clipboard(self));
break;
+ case PROP_AGENT_FEATURES:
+ g_value_set_uint(value, c->agent_features);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -599,6 +603,22 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+ /**
+ * SpiceMainChannel:agent-features:
+ *
+ * List of agent features enabled on the SPICE server
+ *
+ * Since: 0.33
+ **/
+ g_object_class_install_property
+ (gobject_class, PROP_AGENT_FEATURES,
+ g_param_spec_uint("agent-features",
+ "Agent features",
+ "Agent features enabled on the SPICE server",
+ 0, G_MAXUINT32, SPICE_AGENT_FEATURES_FLAGS_MASK,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
/* TODO use notify instead */
/**
* SpiceMainChannel::main-mouse-update:
@@ -2109,7 +2129,10 @@ static void main_handle_agent_features(SpiceChannel *channel, SpiceMsgIn *in)
CHANNEL_DEBUG(channel, "received agent features: %x", features->flags);
- c->agent_features = features->flags;
+ if (features->flags != c->agent_features) {
+ c->agent_features = features->flags;
+ g_coroutine_object_notify(G_OBJECT(channel), "agent-features");
+ }
}
/* main context */