[gnome-boxes] Implement Display.get_pixbuf()



commit 6c34eaec3f1872f88f3272682db5af09b7a12654
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Wed Nov 2 12:54:06 2011 +0100

    Implement Display.get_pixbuf()

 src/display.vala       |    2 ++
 src/spice-display.vala |   15 ++++++++++-----
 src/vnc-display.vala   |    4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/display.vala b/src/display.vala
index ffbd72e..fbcf3f7 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -15,6 +15,8 @@ private abstract class Boxes.Display: GLib.Object, Boxes.IProperties {
     public signal void disconnected ();
 
     public abstract Gtk.Widget? get_display (int n) throws Boxes.Error;
+    public abstract Gdk.Pixbuf get_pixbuf (int n) throws Boxes.Error;
+
     public abstract void connect_it ();
     public abstract void disconnect_it ();
 
diff --git a/src/spice-display.vala b/src/spice-display.vala
index ab59ffc..822f0e6 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -30,18 +30,23 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IProperties {
     public override Gtk.Widget? get_display (int n) throws Boxes.Error {
         var display = displays.lookup (n) as Spice.Display;
 
-        if (display == null)
+        if (display == null) {
             display = new Spice.Display (session, n);
 
-        if (display == null)
-            throw new Boxes.Error.INVALID ("invalid display");
+            if (display == null)
+                throw new Boxes.Error.INVALID ("invalid display");
 
-        display.resize_guest = true;
-        display.scaling = true;
+            display.resize_guest = true;
+            display.scaling = true;
+        }
 
         return display;
     }
 
+    public override Gdk.Pixbuf get_pixbuf (int n) throws Boxes.Error {
+        return (get_display (n) as Spice.Display).get_pixbuf ();
+    }
+
     public override void connect_it () {
         // FIXME: vala does't want to put this in ctor..
         if (channel_new_id == 0)
diff --git a/src/vnc-display.vala b/src/vnc-display.vala
index 890287b..2611376 100644
--- a/src/vnc-display.vala
+++ b/src/vnc-display.vala
@@ -90,6 +90,10 @@ private class Boxes.VncDisplay: Boxes.Display {
         return display;
     }
 
+    public override Gdk.Pixbuf get_pixbuf (int n) throws Boxes.Error {
+        return display.get_pixbuf ();
+    }
+
     public override void connect_it () {
         // FIXME: we ignore return value which seems to be inconsistent
         display.set_credential (DisplayCredential.USERNAME, username);



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