diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2013-03-29 04:52:23 +0200 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2013-04-08 17:57:53 +0300 |
commit | 3d71b44d090fa19e4ac7af3557c1b4924b9c9929 (patch) | |
tree | 5562397db9d70ce11b6f582224c80e2e84036c13 | |
parent | c9d6e2e48ec3b671020d21067c683916e337f4cf (diff) |
broker: Purge stale box configs from newly added sources
After adding a new source, purge all stale box configs.
https://bugzilla.gnome.org/show_bug.cgi?id=683489
-rw-r--r-- | src/app.vala | 13 | ||||
-rw-r--r-- | src/libvirt-broker.vala | 2 | ||||
-rw-r--r-- | src/ovirt-broker.vala | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/app.vala b/src/app.vala index 872d8e8..e843ee3 100644 --- a/src/app.vala +++ b/src/app.vala @@ -4,7 +4,18 @@ using Gdk; using Clutter; private abstract class Boxes.Broker : GLib.Object { - public abstract async void add_source (CollectionSource source); + // Overriding subclass should chain-up at the end of its implementation + public virtual async void add_source (CollectionSource source) { + var used_configs = new GLib.List<BoxConfig> (); + foreach (var item in App.app.collection.items.data) { + if (!(item is Machine)) + continue; + + used_configs.append ((item as Machine).config); + } + + source.purge_stale_box_configs (used_configs); + } } private enum Boxes.AppPage { diff --git a/src/libvirt-broker.vala b/src/libvirt-broker.vala index 4e0185f..2a71768 100644 --- a/src/libvirt-broker.vala +++ b/src/libvirt-broker.vala @@ -100,6 +100,8 @@ private class Boxes.LibvirtBroker : Boxes.Broker { debug ("New domain '%s'", domain.get_name ()); try_add_new_domain (source, connection, domain); }); + + yield base.add_source (source); } } diff --git a/src/ovirt-broker.vala b/src/ovirt-broker.vala index b3f7f35..6e84b53 100644 --- a/src/ovirt-broker.vala +++ b/src/ovirt-broker.vala @@ -68,5 +68,7 @@ private class Boxes.OvirtBroker : Boxes.Broker { foreach (var vm in proxy.get_vms ()) { add_vm (source, proxy, vm); } + + yield base.add_source (source); } } |