diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-07-22 02:11:50 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-07-22 02:11:50 +0800 |
commit | 2e87bc47e7c03fa0d2145b2c3904df545b941a76 (patch) | |
tree | 1ed65f4ba65129f3c0d71e26e7a5ea12e46d7904 /libempathy/empathy-account.c | |
parent | 067e77dceb1e0c01f33ce4c743e88c7214403b8a (diff) | |
download | gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar.gz gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar.bz2 gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar.lz gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar.xz gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.tar.zst gsoc2013-empathy-2e87bc47e7c03fa0d2145b2c3904df545b941a76.zip |
Add api to remove accounts
Diffstat (limited to 'libempathy/empathy-account.c')
-rw-r--r-- | libempathy/empathy-account.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c index 51dd26316..8d4909586 100644 --- a/libempathy/empathy-account.c +++ b/libempathy/empathy-account.c @@ -987,3 +987,51 @@ empathy_account_update_settings_finish (EmpathyAccount *account, return TRUE; } + +static void +empathy_account_remove_cb (TpAccount *proxy, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data); + + if (error != NULL) + { + g_simple_async_result_set_from_error (result, (GError *) error); + } + + g_simple_async_result_complete (result); + g_object_unref (G_OBJECT (result)); +} + +void +empathy_account_remove_async (EmpathyAccount *account, + GAsyncReadyCallback callback, gpointer user_data) +{ + EmpathyAccountPriv *priv = GET_PRIV (account); + GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (account), + callback, user_data, empathy_account_remove_finish); + + tp_cli_account_call_remove (priv->account, + -1, + empathy_account_remove_cb, + result, + NULL, + G_OBJECT (account)); +} + +gboolean +empathy_account_remove_finish (EmpathyAccount *account, + GAsyncResult *result, GError **error) +{ + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), + error)) + return FALSE; + + g_return_val_if_fail (g_simple_async_result_is_valid (result, + G_OBJECT (account), empathy_account_update_settings_finish), FALSE); + + return TRUE; +} + |