summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-18 16:21:13 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-18 17:04:53 +0100
commita01677289c0a2d0ada32b254762bc2c15fa660ad (patch)
tree2469bf92efa76161cda91a014f7cbbceab04f1b7
parentb0706c6d832f6ae5e2f91ba0a3c02e37043c1589 (diff)
Notify agent-connected property change
-rw-r--r--gtk/channel-main.c14
-rw-r--r--gtk/spice-util-priv.h1
-rw-r--r--gtk/spice-util.c6
3 files changed, 19 insertions, 2 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 170610a..86e6fba 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1057,6 +1057,16 @@ static void agent_clipboard_release(SpiceMainChannel *channel, guint selection)
}
/* coroutine context */
+static void set_agent_connected(SpiceMainChannel *channel, gboolean connected)
+{
+ SpiceMainChannelPrivate *c = channel->priv;
+
+ c->agent_connected = connected;
+ SPICE_DEBUG("agent connected: %s", spice_yes_no(connected));
+ g_object_notify_main_context(G_OBJECT(channel), "agent-connected");
+}
+
+/* coroutine context */
static void agent_start(SpiceMainChannel *channel)
{
SpiceMainChannelPrivate *c = channel->priv;
@@ -1065,7 +1075,7 @@ static void agent_start(SpiceMainChannel *channel)
};
SpiceMsgOut *out;
- c->agent_connected = true;
+ set_agent_connected(channel, TRUE);
c->agent_caps_received = false;
emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE);
@@ -1084,7 +1094,7 @@ static void agent_stopped(SpiceMainChannel *channel)
{
SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(channel)->priv;
- c->agent_connected = false;
+ set_agent_connected(channel, FALSE);
c->agent_caps_received = false;
c->agent_display_config_sent = false;
emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE);
diff --git a/gtk/spice-util-priv.h b/gtk/spice-util-priv.h
index 1be0edf..7449667 100644
--- a/gtk/spice-util-priv.h
+++ b/gtk/spice-util-priv.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
gboolean spice_strv_contains(const GStrv strv, const gchar *str);
gchar* spice_uuid_to_string(const guint8 uuid[16]);
+const gchar* spice_yes_no(gboolean value);
#if GLIB_CHECK_VERSION(2,32,0)
#define STATIC_MUTEX GMutex
diff --git a/gtk/spice-util.c b/gtk/spice-util.c
index 6092a80..1c5d10f 100644
--- a/gtk/spice-util.c
+++ b/gtk/spice-util.c
@@ -204,3 +204,9 @@ gulong spice_g_signal_connect_object (gpointer instance,
return ctx->handler_id;
}
+
+G_GNUC_INTERNAL
+const gchar* spice_yes_no(gboolean value)
+{
+ return value ? "yes" : "no";
+}