[gnome-boxes/wip/image-import: 18/18] selectionbar: Don't let user delete under-construction VMs



commit ab356f2faa8777801fe871902b5f9e61ea4276d6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jun 7 02:59:11 2013 +0300

    selectionbar: Don't let user delete under-construction VMs
    
    While the ideal solution is probably to make it possible for user to
    delete under construciton VMs too, it would be pretty difficult to
    implement with us launching external processes as part of such
    construction. Keeping in mind also that this only affects imported (from
    installed media) VMs and importing usually takes much less time than
    installations, I think this is not bad at least as a temporary work
    around.

 src/selectionbar.vala |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 0fc24cc..cdec98c 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -102,6 +102,7 @@ private class Boxes.Selectionbar: GLib.Object {
             update_favorite_btn ();
             update_properties_btn ();
             update_pause_btn ();
+            update_delete_btn ();
         });
     }
 
@@ -157,6 +158,19 @@ private class Boxes.Selectionbar: GLib.Object {
         pause_btn.sensitive = sensitive;
     }
 
+    private void update_delete_btn () {
+        var sensitive = true;
+        foreach (var item in App.app.selected_items) {
+            if (item is LibvirtMachine && (item as LibvirtMachine).vm_creator != null) {
+                sensitive = false;
+
+                break;
+            }
+        }
+
+        remove_btn.sensitive = sensitive;
+    }
+
     private bool visible {
         set {
             fade_actor (actor, value ? 255 : 0);


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