summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2014-01-10 13:44:33 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2014-02-07 13:57:38 +0100
commit4277a3d8314155f947dd2ca511e3955a7e0a36eb (patch)
tree72b1ea2c8617f5d9b3bce71ee772f173e959a590
parent0eaf4920973507d11a347a278b4b7fd90a974805 (diff)
downloadspice-gtk-4277a3d8314155f947dd2ca511e3955a7e0a36eb.tar.gz
spice-gtk-4277a3d8314155f947dd2ca511e3955a7e0a36eb.tar.xz
spice-gtk-4277a3d8314155f947dd2ca511e3955a7e0a36eb.zip
port: send opened a port-event signal on init
If the port is already opened, emit a "opened" port-event on init. This simplifies user code to only handle port events.
-rw-r--r--gtk/channel-port.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gtk/channel-port.c b/gtk/channel-port.c
index 11948bb..0a8b37f 100644
--- a/gtk/channel-port.c
+++ b/gtk/channel-port.c
@@ -249,9 +249,12 @@ static void port_handle_init(SpiceChannel *channel, SpiceMsgIn *in)
g_return_if_fail(c->name == NULL);
c->name = g_strdup((gchar*)init->name);
- g_object_notify(G_OBJECT(channel), "port-name");
port_set_opened(self, init->opened);
+ if (init->opened)
+ emit_main_context(channel, SPICE_PORT_EVENT, SPICE_PORT_EVENT_OPENED);
+
+ g_object_notify_main_context(G_OBJECT(channel), "port-name");
}
/* coroutine context */