aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-28 16:56:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-28 16:56:11 +0800
commita4d45d9997e9c55a75f147cab51184a500640ca1 (patch)
tree9a8230b4cdf5142eb37e5fcd0be7c222ec8452e2
parent838610a7545aca9f8209fef864153f0404fc7309 (diff)
downloadgsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar.gz
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar.bz2
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar.lz
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar.xz
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.tar.zst
gsoc2013-empathy-a4d45d9997e9c55a75f147cab51184a500640ca1.zip
keep our reference on the global ctx until the account has been removed
This ensures that the proccess stays running until we are actually done.
-rw-r--r--src/empathy-sanity-cleaning.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/empathy-sanity-cleaning.c b/src/empathy-sanity-cleaning.c
index b60d800ec..51015b40e 100644
--- a/src/empathy-sanity-cleaning.c
+++ b/src/empathy-sanity-cleaning.c
@@ -282,10 +282,30 @@ uoa_migration_data_free (UoaMigrationData *data)
g_slice_free (UoaMigrationData, data);
}
+#define DATA_SANITY_CTX "data-sanity-ctx"
+
+static void
+uoa_account_remove_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ TpAccount *account = TP_ACCOUNT (source);
+ GError *error = NULL;
+
+ if (!tp_account_remove_finish (account, result, &error))
+ {
+ DEBUG ("Failed to remove account '%s': %s",
+ tp_account_get_path_suffix (account), error->message);
+ g_error_free (error);
+ }
+
+ g_object_set_data (G_OBJECT (account), DATA_SANITY_CTX, NULL);
+}
+
static void
uoa_migration_done (UoaMigrationData *data)
{
- tp_account_remove_async (data->old_account, NULL, NULL);
+ tp_account_remove_async (data->old_account, uoa_account_remove_cb, NULL);
if (data->new_account != NULL)
tp_account_set_enabled_async (data->new_account, data->enabled, NULL, NULL);
@@ -368,8 +388,6 @@ uoa_account_created_cb (GObject *source,
}
}
-#define DATA_SANITY_CTX "data-sanity-ctx"
-
static void
migrate_account_to_uoa (TpAccountManager *am,
TpAccount *account)
@@ -428,31 +446,11 @@ migrate_account_to_uoa (TpAccountManager *am,
tp_account_request_create_account_async (ar, uoa_account_created_cb,
data);
- g_object_set_data (G_OBJECT (account), DATA_SANITY_CTX, NULL);
-
g_variant_unref (params);
g_object_unref (ar);
}
static void
-uoa_account_remove_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- TpAccount *account = TP_ACCOUNT (source);
- GError *error = NULL;
-
- if (!tp_account_remove_finish (account, result, &error))
- {
- DEBUG ("Failed to remove account '%s': %s",
- tp_account_get_path_suffix (account), error->message);
- g_error_free (error);
- }
-
- g_object_set_data (G_OBJECT (account), DATA_SANITY_CTX, NULL);
-}
-
-static void
uoa_plugin_install_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)