[gnome-boxes] Delete configuration when deleting a machine



commit 8d14d2017f3477e329117bf50c437c2ec6dcb843
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Sep 6 11:12:39 2012 +0200

    Delete configuration when deleting a machine
    
    If we keep the configuration around, it will show up in search
    results.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683467

 src/display-config.vala |    9 +++++++++
 src/machine.vala        |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/display-config.vala b/src/display-config.vala
index 7cf1a82..fef01e8 100644
--- a/src/display-config.vala
+++ b/src/display-config.vala
@@ -39,6 +39,15 @@ public class Boxes.DisplayConfig: GLib.Object, Boxes.IConfig {
         this.group = group;
     }
 
+    public void delete () {
+        try {
+            keyfile.remove_group (group);
+        } catch (GLib.Error error) {
+        }
+
+        save ();
+    }
+
     private void remove_category (string category) {
         string[] categories = {};
 
diff --git a/src/machine.vala b/src/machine.vala
index e1f742e..6463e18 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -423,6 +423,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             App.app.disconnect (ui_state_id);
             ui_state_id = 0;
         }
+
+        config.delete ();
     }
 
     public override void ui_state_changed () {



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