[gnome-boxes/wip/show-activity: 1/3] tmp: show activity on under construction boxes



commit 2ebd9046d9b27240c67d4385aee755dab3cc617a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Jun 10 17:42:12 2013 +0300

    tmp: show activity on under construction boxes

 libgd                    |    2 +-
 src/collection-view.vala |   15 ++++++++++++++-
 src/libvirt-machine.vala |   12 +++++++++++-
 src/machine.vala         |    1 +
 4 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/libgd b/libgd
index 2fb32d9..de5f515 160000
--- a/libgd
+++ b/libgd
@@ -1 +1 @@
-Subproject commit 2fb32d9f7adf17e497340fb91d444caa741e4ce2
+Subproject commit de5f515f7aa8f31fa09ddb0ce89ef4ca0416ce38
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 78f8835..eff721a 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -26,6 +26,7 @@ private class Boxes.CollectionView: Boxes.UI {
         TITLE = Gd.MainColumns.PRIMARY_TEXT,
         INFO = Gd.MainColumns.SECONDARY_TEXT,
         SELECTED = Gd.MainColumns.SELECTED,
+        UNDER_CONSTRUCTION = Gd.MainColumns.SHOW_ACTIVITY,
         ITEM = Gd.MainColumns.LAST,
 
         LAST
@@ -123,6 +124,7 @@ private class Boxes.CollectionView: Boxes.UI {
 
     private Gtk.TreeIter append (string title,
                                  string? info,
+                                 bool under_construction,
                                  CollectionItem item) {
         Gtk.TreeIter iter;
 
@@ -133,6 +135,7 @@ private class Boxes.CollectionView: Boxes.UI {
             model.set (iter, ModelColumns.INFO, info);
         model.set (iter, ModelColumns.SELECTED, false);
         model.set (iter, ModelColumns.ITEM, item);
+        model.set (iter, ModelColumns.UNDER_CONSTRUCTION, under_construction);
         update_screenshot (iter);
 
         item.set_data<Gtk.TreeIter?> ("iter", iter);
@@ -148,7 +151,7 @@ private class Boxes.CollectionView: Boxes.UI {
             return;
         }
 
-        var iter = append (machine.name, machine.info, item);
+        var iter = append (machine.name, machine.info,  machine.under_construction, item);
         var pixbuf_id = machine.notify["pixbuf"].connect (() => {
             // apparently iter is stable after insertion/removal/sort
             update_screenshot (iter);
@@ -175,6 +178,13 @@ private class Boxes.CollectionView: Boxes.UI {
         });
         item.set_data<ulong> ("info_id", info_id);
 
+        var under_construct_id = machine.notify["under-construction"].connect (() => {
+            // apparently iter is stable after insertion/removal/sort
+            model.set (iter, ModelColumns.UNDER_CONSTRUCTION, machine.under_construction);
+            main_view.queue_draw ();
+        });
+        item.set_data<ulong> ("under_construct_id", under_construct_id);
+
         item.ui_state = App.app.ui_state;
         actor_remove (item.actor);
 
@@ -216,6 +226,8 @@ private class Boxes.CollectionView: Boxes.UI {
         item.disconnect (name_id);
         var info_id = item.get_data<ulong> ("info_id");
         item.disconnect (info_id);
+        var under_construct_id = item.get_data<ulong> ("under_construct_id");
+        item.disconnect (under_construct_id);
 
         if (item as Machine != null) {
             var machine = item as Machine;
@@ -282,6 +294,7 @@ private class Boxes.CollectionView: Boxes.UI {
                                    typeof (Gdk.Pixbuf),
                                    typeof (long),
                                    typeof (bool),
+                                   typeof (bool),
                                    typeof (CollectionItem));
         model.set_default_sort_func ((model, a, b) => {
             CollectionItem item_a, item_b;
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 13c55e7..6c1bca4 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -7,7 +7,17 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
     public GVirConfig.Domain domain_config { get; set; }
     public GVir.Connection connection { get; set; }
     public GVir.StorageVol? storage_volume { get; set; }
-    public VMCreator? vm_creator { get; set; } // Under installation if this is set to non-null
+    private VMCreator? _vm_creator; // Under installation if this is set to non-null
+    public VMCreator? vm_creator {
+        get {
+            return _vm_creator;
+        }
+
+        set {
+            _vm_creator = value;
+            under_construction = (value != null);
+        }
+    }
 
     private LibvirtMachineProperties properties;
 
diff --git a/src/machine.vala b/src/machine.vala
index fcdab2f..c7eadd3 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -15,6 +15,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     public bool suspend_at_exit;
 
     public bool can_save { get; protected set; default = false; }
+    public bool under_construction { get; protected set; default = false; }
 
     public signal void got_error (string message);
 


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