[gnome-boxes] libvirt-machine-props: Micro refactor



commit df1bc585c4c5d3f4ae873b3ab96a89d27dc0df21
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Mar 15 04:17:48 2013 +0200

    libvirt-machine-props: Micro refactor
    
    Instead of checking for machine being ON each time before calling
    notify_reboot_required(), better do this check in the function itself.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696242

 src/libvirt-machine-properties.vala |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 7465f39..cf35ad6 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -40,8 +40,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
 
         // This will take effect only after next reboot
         machine.domain.set_config (config);
-        if (machine.is_on ())
-            notify_reboot_required ();
+        notify_reboot_required ();
     }
 
     public void try_enable_smartcard () throws GLib.Error {
@@ -51,8 +50,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
 
         // This will take effect only after next reboot
         machine.domain.set_config (config);
-        if (machine.is_on ())
-            notify_reboot_required ();
+        notify_reboot_required ();
     }
 
     private string collect_logs () {
@@ -439,8 +437,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
                     config.set ("current-memory", ram);
                 machine.domain.set_config (config);
                 debug ("RAM changed to %llu KiB", ram);
-                if (machine.is_on ())
-                    notify_reboot_required ();
+                notify_reboot_required ();
             } catch (GLib.Error error) {
                 warning ("Failed to change RAM of box '%s' to %llu KiB: %s",
                          machine.domain.get_name (),
@@ -456,6 +453,9 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
     }
 
     private void notify_reboot_required () {
+        if (!machine.is_on ())
+            return;
+
         Notificationbar.OKFunc reboot = () => {
             debug ("Rebooting '%s'..", machine.name);
             machine.stay_on_display = true;


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