[Spice-devel] [PATCH spice-gtk 2/4] spicy-ss: quit when channel error

Marc-André Lureau marcandre.lureau at gmail.com
Wed Apr 10 06:37:43 PDT 2013


---
 gtk/spicy-screenshot.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gtk/spicy-screenshot.c b/gtk/spicy-screenshot.c
index 2595d0c..43664b6 100644
--- a/gtk/spicy-screenshot.c
+++ b/gtk/spicy-screenshot.c
@@ -95,10 +95,28 @@ static void invalidate(SpiceChannel *channel,
     g_main_loop_quit(mainloop);
 }
 
+static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
+                               gpointer data)
+{
+    switch (event) {
+    case SPICE_CHANNEL_OPENED:
+        break;
+    default:
+        g_warning("main channel event: %d", event);
+        g_main_loop_quit(mainloop);
+    }
+}
+
 static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer *data)
 {
     int id;
 
+    if (SPICE_IS_MAIN_CHANNEL(channel)) {
+        g_signal_connect(channel, "channel-event",
+                         G_CALLBACK(main_channel_event), data);
+        return;
+    }
+
     if (!SPICE_IS_DISPLAY_CHANNEL(channel))
         return;
 
-- 
1.8.1.1.439.g50a6b54



More information about the Spice-devel mailing list