telepathy-mission-control: mcp_account_storage_delete_async: be cancellable, at least in theory
Simon McVittie
smcv at kemper.freedesktop.org
Thu Jan 30 04:34:41 PST 2014
Module: telepathy-mission-control
Branch: master
Commit: 4a56a04f6860d7d66f25398c410a1c6435c9dca7
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=4a56a04f6860d7d66f25398c410a1c6435c9dca7
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Nov 15 13:13:36 2013 +0000
mcp_account_storage_delete_async: be cancellable, at least in theory
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
---
mission-control-plugins/account-storage.c | 3 +++
mission-control-plugins/account-storage.h | 2 ++
src/mcd-account-manager-default.c | 3 ++-
src/mcd-storage.c | 2 +-
tests/twisted/dbus-account-plugin.c | 3 ++-
tests/twisted/mcp-account-diversion.c | 3 ++-
6 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c
index a50b1bb..8d10ad6 100644
--- a/mission-control-plugins/account-storage.c
+++ b/mission-control-plugins/account-storage.c
@@ -115,6 +115,7 @@ static void
default_delete_async (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -666,6 +667,7 @@ mcp_account_storage_create (const McpAccountStorage *storage,
* @storage: an #McpAccountStorage instance
* @am: an #McpAccountManager instance
* @account: the unique name of the account
+ * @cancellable: (allow-none): optionally used to (try to) cancel the operation
* @callback: called on success or failure
* @user_data: data for @callback
*
@@ -687,6 +689,7 @@ void
mcp_account_storage_delete_async (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h
index 42898a5..1a30b5e 100644
--- a/mission-control-plugins/account-storage.h
+++ b/mission-control-plugins/account-storage.h
@@ -110,6 +110,7 @@ struct _McpAccountStorageIface
void (*delete_async) (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*delete_finish) (McpAccountStorage *storage,
@@ -163,6 +164,7 @@ gchar * mcp_account_storage_create (const McpAccountStorage *storage,
void mcp_account_storage_delete_async (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mcp_account_storage_delete_finish (McpAccountStorage *storage,
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index bac90ad..db0ede9 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -352,6 +352,7 @@ static void
delete_async (McpAccountStorage *self,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -361,7 +362,7 @@ delete_async (McpAccountStorage *self,
gchar *filename = NULL;
const gchar * const *iter;
- task = g_task_new (amd, NULL, callback, user_data);
+ task = g_task_new (amd, cancellable, callback, user_data);
if (sa == NULL || sa->absent)
{
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index d43a887..0ded349 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -1829,7 +1829,7 @@ mcd_storage_delete_account (McdStorage *self,
/* FIXME: stop ignoring the error (if any), and make this method async
* in order to pass the error up to McdAccount */
- mcp_account_storage_delete_async (plugin, ma, account,
+ mcp_account_storage_delete_async (plugin, ma, account, NULL,
delete_cb, g_strdup (account));
g_object_unref (plugin);
diff --git a/tests/twisted/dbus-account-plugin.c b/tests/twisted/dbus-account-plugin.c
index 9e0025a..ea35c14 100644
--- a/tests/twisted/dbus-account-plugin.c
+++ b/tests/twisted/dbus-account-plugin.c
@@ -902,12 +902,13 @@ static void
test_dbus_account_plugin_delete_async (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account_name,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage);
Account *account = lookup_account (self, account_name);
- GTask *task = g_task_new (self, NULL, callback, user_data);
+ GTask *task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, g_strdup (user_data), g_free);
diff --git a/tests/twisted/mcp-account-diversion.c b/tests/twisted/mcp-account-diversion.c
index 11c7caa..bcb8930 100644
--- a/tests/twisted/mcp-account-diversion.c
+++ b/tests/twisted/mcp-account-diversion.c
@@ -258,11 +258,12 @@ static void
delete_async (McpAccountStorage *self,
McpAccountManager *am,
const gchar *account,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
AccountDiversionPlugin *adp = ACCOUNT_DIVERSION_PLUGIN (self);
- GTask *task = g_task_new (adp, NULL, callback, user_data);
+ GTask *task = g_task_new (adp, cancellable, callback, user_data);
if (g_key_file_remove_group (adp->keyfile, account, NULL))
adp->save = TRUE;
More information about the telepathy-commits
mailing list