[gnome-boxes] spice: use SpiceDisplay:ready property



commit c7a26a531bd257d3c6a056ba0f1f9e0259b7514d
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Fri Jul 20 03:43:26 2012 +0200

    spice: use SpiceDisplay:ready property
    
    Requires spice-gtk 0.12.101
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680293

 configure.ac           |    2 +-
 src/spice-display.vala |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4c7d6ac..2111805 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ GTK_VNC_MIN_VERSION=0.4.4
 LIBVIRT_GLIB_MIN_VERSION=0.1.1
 LIBVIRT_GCONFIG_MIN_VERSION=0.1.0
 LIBXML2_MIN_VERSION=2.7.8
-SPICE_GTK_MIN_VERSION=0.9
+SPICE_GTK_MIN_VERSION=0.12.101
 GUDEV_MIN_VERSION=165
 OSINFO_MIN_VERSION=0.1.1
 TRACKER_SPARQL=0.13.1
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 200782c..a38a138 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -96,6 +96,8 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IPropertiesProvider {
         // FIXME: vala does't want to put this in ctor..
         if (channel_new_id == 0)
             channel_new_id = session.channel_new.connect ((channel) => {
+                var id = channel.channel_id;
+
                 if (channel is Spice.MainChannel) {
                     var main = channel as Spice.MainChannel;
                     main.channel_event.connect (main_event);
@@ -106,11 +108,18 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IPropertiesProvider {
                 }
 
                 if (channel is Spice.DisplayChannel) {
-                    var display = channel as DisplayChannel;
-
-                    // FIXME: should show only when mark received? not reliable yet:
-                    show (display.channel_id);
-                    // display.display_mark.connect ((mark) => { show (display.channel_id); });
+                    if (id != 0)
+                        return;
+
+                    try {
+                        var display = get_display (id) as Spice.Display;
+                        display.notify["ready"].connect (() => {
+                            if (display.ready)
+                                show (display.channel_id);
+                            else
+                                hide (display.channel_id);
+                        });
+                    } catch (Boxes.Error error) { warning (error.message); }
                 }
             });
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]