diff options
| author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-11-15 13:13:36 +0000 |
|---|---|---|
| committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-01-29 19:28:31 +0000 |
| commit | 4a56a04f6860d7d66f25398c410a1c6435c9dca7 (patch) | |
| tree | 8c26607a66e28edcd96cbc9d22f41362477749bd | |
| parent | 812378a1064b35a54adb9dc992fe55ef7c5ddae5 (diff) | |
mcp_account_storage_delete_async: be cancellable, at least in theory
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
| -rw-r--r-- | mission-control-plugins/account-storage.c | 3 | ||||
| -rw-r--r-- | mission-control-plugins/account-storage.h | 2 | ||||
| -rw-r--r-- | src/mcd-account-manager-default.c | 3 | ||||
| -rw-r--r-- | src/mcd-storage.c | 2 | ||||
| -rw-r--r-- | tests/twisted/dbus-account-plugin.c | 3 | ||||
| -rw-r--r-- | 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 a50b1bb2..8d10ad6a 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 42898a5f..1a30b5ed 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 bac90ad3..db0ede9a 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 d43a8875..0ded3492 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 9e0025ae..ea35c148 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 11c7caa9..bcb8930c 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; |
