[gnome-boxes] Unify deletion of machines a bit
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Unify deletion of machines a bit
- Date: Wed, 27 Jun 2012 17:42:24 +0000 (UTC)
commit e0cfff8dcece6d8887d90ea32f5071668a3207f6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jun 27 03:16:47 2012 +0300
Unify deletion of machines a bit
This fixes the regression of ghost item in collection view when VM
creation is canceled at the 'review' page.
https://bugzilla.gnome.org/show_bug.cgi?id=678933
src/app.vala | 8 ++++++--
src/vm-creator.vala | 5 ++---
src/wizard.vala | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 8d8802e..6c40220 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -192,6 +192,11 @@ private class Boxes.App: Boxes.UI {
}
}
+ public void delete_machine (Machine machine, bool by_user = true) {
+ machine.delete (by_user); // Will also delete associated storage volume if by_user is 'true'
+ collection.remove_item (machine);
+ }
+
private async void setup_libvirt (CollectionSource source) {
if (connections.lookup (source.name) != null)
return;
@@ -225,8 +230,7 @@ private class Boxes.App: Boxes.UI {
if (machine == null)
return; // Looks like we removed the domain ourselves. Nothing to do then..
- machine.delete (false);
- collection.remove_item (machine);
+ delete_machine (machine, false);
});
connection.domain_added.connect ((connection, domain) => {
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 7a6e580..fb558f0 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -120,10 +120,9 @@ private class Boxes.VMCreator {
if (!configurator.is_live_config (config))
return;
- // No installation during live session, so lets delete the domain and its storage volume.
+ // No installation during live session, so lets delete the VM
domain.disconnect (stopped_id);
- domain.delete (0);
- volume.delete (0);
+ App.app.delete_machine (machine);
} catch (GLib.Error error) {
warning ("Failed to delete domain '%s' or its volume: %s", domain.get_name (), error.message);
}
diff --git a/src/wizard.vala b/src/wizard.vala
index ce74099..1579622 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -609,7 +609,7 @@ private class Boxes.Wizard: Boxes.UI {
private void destroy_machine () {
if (machine != null) {
- machine.delete ();
+ App.app.delete_machine (machine);
machine = null;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]