[gnome-boxes/wip/clone: 12/16] remote-machine: Implement cloning



commit 5053a8855df06a62cc7452c76781f15ad5f9a50d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 3 21:55:39 2016 +0100

    remote-machine: Implement cloning

 src/remote-machine.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 6ff0e7c..2e48600 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -3,7 +3,7 @@ using Gtk;
 
 private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
     public override bool can_restart { get { return false; } }
-    public override bool can_clone { get { return false; } }
+    public override bool can_clone { get { return true; } }
 
     public RemoteMachine (CollectionSource source) throws Boxes.Error {
         if (source.source_type != "spice" &&
@@ -100,7 +100,12 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
     //        restart and this method is currently used for that purpose only.
     public override void restart () {}
 
-    public override async void clone () {}
+    public override async void clone () {
+        var name = "Clone of %s".printf (source.name);
+        var source = new CollectionSource (name, source.source_type, source.uri);
+        source.save ();
+        App.app.add_collection_source.begin (source);
+    }
 
     private void update_info () {
         var uri = Xml.URI.parse (source.uri);


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