[gnome-boxes/wip/clone: 5/16] selectionbar: Don't open under-import VMs



commit c92699f00427f1c1a0a7713869d339191726b0b8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 3 18:02:58 2016 +0100

    selectionbar: Don't open under-import VMs
    
    If the VM is being imported, do not allow it to be launched from
    selection mode. We already don't allow it to be launched via mouse
    click.

 src/selectionbar.vala |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 153fdaa..e7440e6 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -144,9 +144,30 @@ private class Boxes.Selectionbar: Gtk.Revealer {
     }
 
     private void update_open_btn () {
+        foreach (var item in App.app.collection.items.data) {
+            var importing_id = item.get_data<ulong> ("importing_id");
+            if (importing_id > 0) {
+                item.disconnect (importing_id);
+                item.set_data<ulong> ("importing_id", 0);
+            }
+        }
+
         var items = App.app.selected_items.length ();
+        var sensitive = items > 0;
+        foreach (var item in App.app.selected_items) {
+            ulong importing_id = 0;
+            importing_id = item.notify["importing"].connect (() => {
+                update_open_btn ();
+            });
+            item.set_data<ulong> ("importing_id", importing_id);
+
+            if (item is LibvirtMachine && (item as LibvirtMachine).importing) {
+                sensitive = false;
+                break;
+            }
+        }
+        open_btn.sensitive = sensitive;
 
-        open_btn.sensitive = items > 0;
         // Translators: This is a button to open box(es) in new window(s)
         if (items == 0)
             open_btn.label = C_("0 items selected", "_Open in new window");


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