[gnome-boxes] Take screenshots of RemoteMachine



commit 566d39b32b1b52cbf3b5aad1054e8ffd9ef53acd
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Wed Nov 2 13:10:34 2011 +0100

    Take screenshots of RemoteMachine

 TODO                    |    1 -
 src/machine.vala        |    2 +-
 src/remote-machine.vala |   11 +++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/TODO b/TODO
index e5ac2fc..a1490db 100644
--- a/TODO
+++ b/TODO
@@ -12,7 +12,6 @@ This is not an exhaustive list of TODO items:
   - add/remove a Machine to a collection
   - remove a CollectionSource
   - spread the various screenshots in time, do not take all at the same time
-  - take screenshots of RemoteMachine (vnc/spice)
   - a rhevm-portal source collection
   - add avahi sources (code-in)
 
diff --git a/src/machine.vala b/src/machine.vala
index ea69942..229ebb8 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -108,7 +108,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IProperties {
         }
     }
 
-    public string get_screenshot_filename (string ext = "ppm") {
+    public virtual string get_screenshot_filename (string ext = "ppm") {
         return get_pkgcache (get_screenshot_prefix () + "-screenshot." + ext);
     }
 
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 942328d..b01f207 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -25,12 +25,23 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IProperties {
         }
     }
 
+    public override string get_screenshot_filename (string ext = "jpg") {
+        return base.get_screenshot_filename (ext);
+    }
+
     public override void disconnect_display () {
         _connect_display = false;
 
         app.display_page.remove_display ();
 
         if (display != null) {
+            try {
+                var pixbuf = display.get_pixbuf (0);
+                pixbuf.save (get_screenshot_filename (), "jpeg");
+                update_screenshot ();
+            } catch (GLib.Error err) {
+                warning (err.message);
+            }
             display.disconnect_it ();
             display = null;
         }



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