[gnome-boxes] ovirt: Implement OvirtMachine::take_screenshot



commit 96b285dfd35904c78365a4d5197ed218c6ae31ed
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Jul 6 10:36:47 2012 +0200

    ovirt: Implement OvirtMachine::take_screenshot
    
    This makes it possible to reuse the machinery which takes regular
    box screenshot. This implementation of take_screenshot is arguably not
    really useful since screenshots will only be taken while the box is
    maximized/fullscreen, and the disconnect_display () logic takes care of
    taking a screenshot just before going back to the collection view. Taking
    regular screenshots can have its use in case of an abnormal gnome-boxes
    termination.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681747

 src/machine.vala       |   13 +++++++++++--
 src/ovirt-machine.vala |    4 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index fe04f28..454237e 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -236,8 +236,17 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     protected virtual async void save_real () throws GLib.Error {
     }
 
-    protected virtual async Gdk.Pixbuf? take_screenshot () throws GLib.Error {
-        return null;
+    // this implementation of take_screenshot is not really useful since
+    // screenshots will only be taken while the box is maximized/fullscreen,
+    // and the disconnect_display () logic takes care of taking a screenshot
+    // just before going back to the collection view. Taking regular
+    // screenshots can have its use in case of an abnormal gnome-boxes
+    // termination.
+    protected async virtual Gdk.Pixbuf? take_screenshot () throws GLib.Error {
+        if (display == null)
+            return null;
+
+        return display.get_pixbuf (0);
     }
 
     public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags);
diff --git a/src/ovirt-machine.vala b/src/ovirt-machine.vala
index c906348..d96e0ae 100644
--- a/src/ovirt-machine.vala
+++ b/src/ovirt-machine.vala
@@ -11,7 +11,7 @@ private class Boxes.OvirtMachine: Boxes.Machine {
                          Ovirt.Vm vm) throws GLib.Error {
         base (source, vm.name);
 
-        debug ("New ovirt machine: " + name);
+        debug ("new ovirt machine: " + name);
         create_display_config (vm.uuid);
         this.proxy = proxy;
         this.vm = vm;
@@ -19,7 +19,7 @@ private class Boxes.OvirtMachine: Boxes.Machine {
         this.update_state ();
 
         load_screenshot ();
-        set_screenshot_enable (false);
+        set_screenshot_enable (true);
     }
 
     public override async void connect_display () throws GLib.Error {



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