[telepathy-mission-control/master] _mcd_account_delete: return successfully if the account wasn't in the key file

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 14 07:14:27 PDT 2009


This needs to work if we're going to add accounts to the AM before
checking for validity.
---
 src/mcd-account.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index 5c37295..4387aee 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -415,13 +415,23 @@ _mcd_account_delete (McdAccount *account, GError **error)
     McdAccountPrivate *priv = account->priv;
     gchar *data_dir_str;
     GDir *data_dir;
+    GError *kf_error = NULL;
 
-    g_key_file_remove_group (priv->keyfile, priv->unique_name, error);
-    if (error && *error)
+    if (!g_key_file_remove_group (priv->keyfile, priv->unique_name,
+                                  &kf_error))
     {
-        g_warning ("Could not remove GConf dir (%s)",
-                   error ? (*error)->message : "");
-        return FALSE;
+        if (kf_error->domain == G_KEY_FILE_ERROR &&
+            kf_error->code == G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
+        {
+            DEBUG ("account not found in key file, doing nothing");
+            g_clear_error (&kf_error);
+        }
+        else
+        {
+            g_warning ("Could not remove group (%s)", kf_error->message);
+            g_propagate_error (error, kf_error);
+            return FALSE;
+        }
     }
 
     data_dir_str = get_account_data_path (priv);
-- 
1.5.6.5




More information about the telepathy-commits mailing list