[gnome-boxes] Do not lose pending changes



commit 6eb3b04dccd002a6e1c48dcdd65bc30a2937549b
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Jul 19 15:22:30 2012 +0200

    Do not lose pending changes
    
    Use the INACTIVE config as the current config to modified, to not lose any other pending changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680293

 src/libvirt-machine.vala |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index b4065ae..3d72e57 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -81,7 +81,6 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
     public void update_domain_config () {
         try {
             domain_config = domain.get_config (GVir.DomainXMLFlags.NONE);
-            domain_config.bind_property ("title", this, "name", BindingFlags.DEFAULT);
 
             var volume = get_storage_volume (connection, domain, null);
             storage_volume_path = (volume != null)? volume.get_path () : null;
@@ -276,11 +275,13 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
 
     public void try_change_name (string name) throws Boxes.Error {
         try {
-            // We use libvirt "title" for free form user name
-            domain_config.title = name;
-
+            var config = domain.get_config (GVir.DomainXMLFlags.INACTIVE);
+            // Te use libvirt "title" for free form user name
+            config.title = name;
             // This will take effect only after next reboot, but we use pending/inactive config for name and title
-            domain.set_config (domain_config);
+            domain.set_config (config);
+
+            this.name = name;
         } catch (GLib.Error error) {
             warning ("Failed to change title of box '%s' to '%s': %s",
                      domain.get_name (), name, error.message);
@@ -485,9 +486,10 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
             Source.remove (ram_update_timeout);
 
         ram_update_timeout = Timeout.add_seconds (1, () => {
-            domain_config.memory = value;
             try {
-                domain.set_config (domain_config);
+                var config = domain.get_config (GVir.DomainXMLFlags.INACTIVE);
+                config.memory = value;
+                domain.set_config (config);
                 debug ("RAM changed to %llu", value);
                 notify_reboot_required ();
             } catch (GLib.Error error) {



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