[libsecret/wip/nielsdg/gtask-secret-collection: 2/2] methods: Port to GTask




commit 2d6cb5526ea4c6b6b5499a8a3deb96a2b7f7c48f
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Dec 29 00:58:06 2019 +0100

    methods: Port to GTask
    
    `GSimpleAsyncResult` is deprecated in favor of `GTask`.

 libsecret/secret-methods.c | 550 ++++++++++++++++++++++-----------------------
 1 file changed, 267 insertions(+), 283 deletions(-)
---
diff --git a/libsecret/secret-methods.c b/libsecret/secret-methods.c
index e0ccce4..c4decf8 100644
--- a/libsecret/secret-methods.c
+++ b/libsecret/secret-methods.c
@@ -38,7 +38,6 @@
 
 typedef struct {
        SecretService *service;
-       GCancellable *cancellable;
        GHashTable *items;
        gchar **unlocked;
        gchar **locked;
@@ -52,7 +51,6 @@ search_closure_free (gpointer data)
 {
        SearchClosure *closure = data;
        g_clear_object (&closure->service);
-       g_clear_object (&closure->cancellable);
        g_hash_table_unref (closure->items);
        g_variant_unref (closure->attributes);
        g_strfreev (closure->unlocked);
@@ -90,13 +88,13 @@ on_search_secrets (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
+       GTask *task = G_TASK (user_data);
 
        /* Note that we ignore any unlock failure */
        secret_item_load_secrets_finish (result, NULL);
+       g_task_return_boolean (task, TRUE);
 
-       g_simple_async_result_complete (async);
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
@@ -104,8 +102,9 @@ on_search_unlocked (GObject *source,
                     GAsyncResult *result,
                     gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       SearchClosure *search = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       SearchClosure *search = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GList *items;
 
        /* Note that we ignore any unlock failure */
@@ -114,41 +113,42 @@ on_search_unlocked (GObject *source,
        /* If loading secrets ... locked items automatically ignored */
        if (search->flags & SECRET_SEARCH_LOAD_SECRETS) {
                items = g_hash_table_get_values (search->items);
-               secret_item_load_secrets (items, search->cancellable,
-                                         on_search_secrets, g_object_ref (async));
+               secret_item_load_secrets (items, cancellable,
+                                         on_search_secrets, g_object_ref (task));
                g_list_free (items);
 
        /* No additional options, just complete */
        } else {
-               g_simple_async_result_complete (async);
+               g_task_return_boolean (task, TRUE);
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
-secret_search_unlock_load_or_complete (GSimpleAsyncResult *async,
+secret_search_unlock_load_or_complete (GTask *task,
                                        SearchClosure *search)
 {
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GList *items;
 
        /* If unlocking then unlock all the locked items */
        if (search->flags & SECRET_SEARCH_UNLOCK) {
                items = search_closure_build_items (search, search->locked);
-               secret_service_unlock (search->service, items, search->cancellable,
-                                      on_search_unlocked, g_object_ref (async));
+               secret_service_unlock (search->service, items, cancellable,
+                                      on_search_unlocked, g_object_ref (task));
                g_list_free_full (items, g_object_unref);
 
        /* If loading secrets ... locked items automatically ignored */
        } else if (search->flags & SECRET_SEARCH_LOAD_SECRETS) {
                items = g_hash_table_get_values (search->items);
-               secret_item_load_secrets (items, search->cancellable,
-                                         on_search_secrets, g_object_ref (async));
+               secret_item_load_secrets (items, cancellable,
+                                         on_search_secrets, g_object_ref (task));
                g_list_free (items);
 
        /* No additional options, just complete */
        } else {
-               g_simple_async_result_complete (async);
+               g_task_return_boolean (task, TRUE);
        }
 }
 
@@ -157,39 +157,43 @@ on_search_loaded (GObject *source,
                   GAsyncResult *result,
                   gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       SearchClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
+       GTask *task = G_TASK (user_data);
+       SearchClosure *closure = g_task_get_task_data (task);
        GError *error = NULL;
        SecretItem *item;
 
        closure->loading--;
 
        item = secret_item_new_for_dbus_path_finish (result, &error);
-       if (error != NULL)
-               g_simple_async_result_take_error (res, error);
+       if (error != NULL) {
+               g_task_return_error (task, g_steal_pointer (&error));
+               g_clear_object (&task);
+               return;
+       }
 
        if (item != NULL)
                search_closure_take_item (closure, item);
 
        /* We're done loading, lets go to the next step */
        if (closure->loading == 0)
-               secret_search_unlock_load_or_complete (res, closure);
+               secret_search_unlock_load_or_complete (task, closure);
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
 search_load_item_async (SecretService *self,
-                        GSimpleAsyncResult *res,
+                        GTask *task,
                         SearchClosure *closure,
                         const gchar *path)
 {
+       GCancellable *cancellable = g_task_get_cancellable (task);
        SecretItem *item;
 
        item = _secret_service_find_item_instance (self, path);
        if (item == NULL) {
-               secret_item_new_for_dbus_path (self, path, SECRET_ITEM_NONE, closure->cancellable,
-                                              on_search_loaded, g_object_ref (res));
+               secret_item_new_for_dbus_path (self, path, SECRET_ITEM_NONE, cancellable,
+                                              on_search_loaded, g_object_ref (task));
                closure->loading++;
        } else {
                search_closure_take_item (closure, item);
@@ -201,8 +205,8 @@ on_search_paths (GObject *source,
                  GAsyncResult *result,
                  gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       SearchClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
+       GTask *task = G_TASK (user_data);
+       SearchClosure *closure = g_task_get_task_data (task);
        SecretService *self = closure->service;
        GError *error = NULL;
        gint want = 1;
@@ -218,20 +222,19 @@ on_search_paths (GObject *source,
                count = 0;
 
                for (i = 0; count < want && closure->unlocked[i] != NULL; i++, count++)
-                       search_load_item_async (self, res, closure, closure->unlocked[i]);
+                       search_load_item_async (self, task, closure, closure->unlocked[i]);
                for (i = 0; count < want && closure->locked[i] != NULL; i++, count++)
-                       search_load_item_async (self, res, closure, closure->locked[i]);
+                       search_load_item_async (self, task, closure, closure->locked[i]);
 
                /* No items loading, complete operation now */
                if (closure->loading == 0)
-                       secret_search_unlock_load_or_complete (res, closure);
+                       secret_search_unlock_load_or_complete (task, closure);
 
        } else {
-               g_simple_async_result_take_error (res, error);
-               g_simple_async_result_complete (res);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -239,22 +242,22 @@ on_search_service (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       SearchClosure *search = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       SearchClosure *search = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
 
        search->service = secret_service_get_finish (result, &error);
        if (error == NULL) {
                _secret_service_search_for_paths_variant (search->service, search->attributes,
-                                                         search->cancellable, on_search_paths,
-                                                         g_object_ref (async));
+                                                         cancellable, on_search_paths,
+                                                         g_steal_pointer (&task));
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -295,7 +298,7 @@ secret_service_search (SecretService *service,
                        GAsyncReadyCallback callback,
                        gpointer user_data)
 {
-       GSimpleAsyncResult *res;
+       GTask *task;
        SearchClosure *closure;
        const gchar *schema_name = NULL;
 
@@ -310,28 +313,27 @@ secret_service_search (SecretService *service,
        if (schema != NULL && !(schema->flags & SECRET_SCHEMA_DONT_MATCH_NAME))
                schema_name = schema->name;
 
-       res = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
-                                        secret_service_search);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, secret_service_search);
        closure = g_slice_new0 (SearchClosure);
-       closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
        closure->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
        closure->flags = flags;
        closure->attributes = _secret_attributes_to_variant (attributes, schema_name);
        g_variant_ref_sink (closure->attributes);
-       g_simple_async_result_set_op_res_gpointer (res, closure, search_closure_free);
+       g_task_set_task_data (task, closure, search_closure_free);
 
        if (service) {
                closure->service = g_object_ref (service);
                _secret_service_search_for_paths_variant (closure->service, closure->attributes,
-                                                         closure->cancellable, on_search_paths,
-                                                         g_object_ref (res));
+                                                         cancellable, on_search_paths,
+                                                         g_steal_pointer (&task));
 
        } else {
                secret_service_get (SECRET_SERVICE_NONE, cancellable,
-                                   on_search_service, g_object_ref (res));
+                                   on_search_service, g_steal_pointer (&task));
        }
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 /**
@@ -350,21 +352,19 @@ secret_service_search_finish (SecretService *service,
                               GAsyncResult *result,
                               GError **error)
 {
-       GSimpleAsyncResult *res;
        SearchClosure *closure;
        GList *items = NULL;
 
        g_return_val_if_fail (service == NULL || SECRET_IS_SERVICE (service), NULL);
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                             secret_service_search), NULL);
-
-       res = G_SIMPLE_ASYNC_RESULT (result);
+       g_return_val_if_fail (g_task_is_valid (result, service), NULL);
 
-       if (_secret_util_propagate_error (res, error))
+       if (!g_task_propagate_boolean (G_TASK (result), error)) {
+               _secret_util_strip_remote_error (error);
                return NULL;
+       }
 
-       closure = g_simple_async_result_get_op_res_gpointer (res);
+       closure = g_task_get_task_data (G_TASK (result));
        if (closure->unlocked)
                items = search_closure_build_items (closure, closure->unlocked);
        if (closure->locked)
@@ -566,11 +566,9 @@ _secret_service_decode_get_secrets_all (SecretService *self,
 }
 
 typedef struct {
-       GCancellable *cancellable;
        GPtrArray *paths;
        GHashTable *objects;
        gchar **xlocked;
-       guint count;
        gboolean locking;
 } XlockClosure;
 
@@ -578,8 +576,6 @@ static void
 xlock_closure_free (gpointer data)
 {
        XlockClosure *closure = data;
-       if (closure->cancellable)
-               g_object_unref (closure->cancellable);
        g_ptr_array_free (closure->paths, TRUE);
        g_strfreev (closure->xlocked);
        g_hash_table_unref (closure->objects);
@@ -591,15 +587,17 @@ on_xlock_paths (GObject *source,
                 GAsyncResult *result,
                 gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       XlockClosure *xlock = g_simple_async_result_get_op_res_gpointer (async);
+       SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       XlockClosure *xlock = g_task_get_task_data (task);
        GVariant *lockval;
        GDBusProxy *object;
        GError *error = NULL;
+       gint count;
        gint i;
 
-       xlock->count = _secret_service_xlock_paths_finish (SECRET_SERVICE (source), result,
-                                                          &xlock->xlocked, &error);
+       count = _secret_service_xlock_paths_finish (service, result,
+                                                   &xlock->xlocked, &error);
 
        if (error == NULL) {
                /*
@@ -615,13 +613,13 @@ on_xlock_paths (GObject *source,
                                g_dbus_proxy_set_cached_property (object, "Locked", lockval);
                }
                g_variant_unref (lockval);
+               g_task_return_int (task, count);
 
        } else {
-               g_simple_async_result_take_error (async, error);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_simple_async_result_complete (async);
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
@@ -629,8 +627,9 @@ on_xlock_service (GObject *source,
                   GAsyncResult *result,
                   gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       XlockClosure *xlock = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       XlockClosure *xlock = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        SecretService *service;
 
@@ -638,16 +637,15 @@ on_xlock_service (GObject *source,
        if (error == NULL) {
                _secret_service_xlock_paths_async (service, xlock->locking ? "Lock" : "Unlock",
                                                   (const gchar **)xlock->paths->pdata,
-                                                  xlock->cancellable, on_xlock_paths,
-                                                  g_object_ref (async));
+                                                  cancellable, on_xlock_paths,
+                                                  g_steal_pointer (&task));
                g_object_unref (service);
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
@@ -658,17 +656,16 @@ service_xlock_async (SecretService *service,
                      GAsyncReadyCallback callback,
                      gpointer user_data)
 {
-       GSimpleAsyncResult *async;
+       GTask *task;
        XlockClosure *xlock;
        const gchar *path;
        GList *l;
 
-       async = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
-                                          service_xlock_async);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, service_xlock_async);
        xlock = g_slice_new0 (XlockClosure);
        xlock->objects = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
        xlock->locking = locking;
-       xlock->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
        xlock->paths = g_ptr_array_new ();
 
        for (l = objects; l != NULL; l = g_list_next (l)) {
@@ -678,19 +675,19 @@ service_xlock_async (SecretService *service,
        }
        g_ptr_array_add (xlock->paths, NULL);
 
-       g_simple_async_result_set_op_res_gpointer (async, xlock, xlock_closure_free);
+       g_task_set_task_data (task, xlock, xlock_closure_free);
 
        if (service == NULL) {
                secret_service_get (SECRET_SERVICE_NONE, cancellable,
-                                   on_xlock_service, g_object_ref (async));
+                                   on_xlock_service, g_steal_pointer (&task));
        } else {
                _secret_service_xlock_paths_async (service, xlock->locking ? "Lock" : "Unlock",
                                                   (const gchar **)xlock->paths->pdata,
-                                                  xlock->cancellable, on_xlock_paths,
-                                                  g_object_ref (async));
+                                                  cancellable, on_xlock_paths,
+                                                  g_steal_pointer (&task));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static gint
@@ -699,19 +696,20 @@ service_xlock_finish (SecretService *service,
                       GList **xlocked,
                       GError **error)
 {
-       GSimpleAsyncResult *async;
        XlockClosure *xlock;
        GDBusProxy *object;
+       gint count;
        gint i;
 
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                                                             service_xlock_async), -1);
+       g_return_val_if_fail (g_task_is_valid (result, service), -1);
 
-       async = G_SIMPLE_ASYNC_RESULT (result);
-       if (_secret_util_propagate_error (async, error))
+       count = g_task_propagate_int (G_TASK (result), error);
+       if (count == -1) {
+               _secret_util_strip_remote_error (error);
                return -1;
+       }
 
-       xlock = g_simple_async_result_get_op_res_gpointer (async);
+       xlock = g_task_get_task_data (G_TASK (result));
        if (xlocked) {
                *xlocked = NULL;
                for (i = 0; xlock->xlocked[i] != NULL; i++) {
@@ -721,7 +719,7 @@ service_xlock_finish (SecretService *service,
                }
        }
 
-       return xlock->count;
+       return count;
 }
 
 /**
@@ -953,7 +951,6 @@ secret_service_unlock_sync (SecretService *service,
 }
 
 typedef struct {
-       GCancellable *cancellable;
        gchar *collection_path;
        SecretValue *value;
        GHashTable *properties;
@@ -965,8 +962,6 @@ static void
 store_closure_free (gpointer data)
 {
        StoreClosure *store = data;
-       if (store->cancellable)
-               g_object_unref (store->cancellable);
        g_free (store->collection_path);
        secret_value_unref (store->value);
        g_hash_table_unref (store->properties);
@@ -983,9 +978,10 @@ on_store_keyring (GObject *source,
                   GAsyncResult *result,
                   gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       StoreClosure *store = g_simple_async_result_get_op_res_gpointer (async);
        SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       StoreClosure *store = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        gchar *path;
 
@@ -994,15 +990,16 @@ on_store_keyring (GObject *source,
                store->created_collection = TRUE;
                secret_service_create_item_dbus_path (service, store->collection_path,
                                                      store->properties, store->value,
-                                                     SECRET_ITEM_CREATE_REPLACE, store->cancellable,
-                                                     on_store_create, g_object_ref (async));
+                                                     SECRET_ITEM_CREATE_REPLACE,
+                                                     cancellable,
+                                                     on_store_create,
+                                                     g_steal_pointer (&task));
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
        g_free (path);
+       g_clear_object (&task);
 }
 
 static void
@@ -1010,9 +1007,10 @@ on_store_unlock (GObject *source,
                  GAsyncResult *result,
                  gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       StoreClosure *store = g_simple_async_result_get_op_res_gpointer (async);
        SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       StoreClosure *store = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
 
        secret_service_unlock_dbus_paths_finish (service, result, NULL, &error);
@@ -1020,14 +1018,15 @@ on_store_unlock (GObject *source,
                store->unlocked_collection = TRUE;
                secret_service_create_item_dbus_path (service, store->collection_path,
                                                      store->properties, store->value,
-                                                     SECRET_ITEM_CREATE_REPLACE, store->cancellable,
-                                                     on_store_create, g_object_ref (async));
+                                                     SECRET_ITEM_CREATE_REPLACE,
+                                                     cancellable,
+                                                     on_store_create,
+                                                     g_steal_pointer (&task));
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
@@ -1035,9 +1034,10 @@ on_store_create (GObject *source,
                  GAsyncResult *result,
                  gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       StoreClosure *store = g_simple_async_result_get_op_res_gpointer (async);
        SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       StoreClosure *store = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        GHashTable *properties;
 
@@ -1054,24 +1054,32 @@ on_store_create (GObject *source,
            g_strcmp0 (store->collection_path, SECRET_ALIAS_PREFIX "default") == 0) {
                properties = _secret_collection_properties_new (_("Default keyring"));
                secret_service_create_collection_dbus_path (service, properties, "default",
-                                                           SECRET_COLLECTION_CREATE_NONE, store->cancellable,
-                                                           on_store_keyring, g_object_ref (async));
+                                                           SECRET_COLLECTION_CREATE_NONE,
+                                                           cancellable,
+                                                           on_store_keyring,
+                                                           g_steal_pointer (&task));
                g_hash_table_unref (properties);
                g_error_free (error);
+               g_clear_object (&task);
+               return;
+       }
 
-       } else if (!store->unlocked_collection &&
+       if (!store->unlocked_collection &&
                   g_error_matches (error, SECRET_ERROR, SECRET_ERROR_IS_LOCKED)) {
                const gchar *paths[2] = { store->collection_path, NULL };
-               secret_service_unlock_dbus_paths (service, paths, store->cancellable,
-                                                 on_store_unlock, g_object_ref (async));
+               secret_service_unlock_dbus_paths (service, paths, cancellable,
+                                                 on_store_unlock, g_steal_pointer (&task));
                g_error_free (error);
-       } else {
-               if (error != NULL)
-                       g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_clear_object (&task);
+               return;
        }
 
-       g_object_unref (async);
+       if (error != NULL)
+               g_task_return_error (task, g_steal_pointer (&error));
+       else
+               g_task_return_boolean (task, TRUE);
+
+       g_clear_object (&task);
 }
 
 static void
@@ -1079,8 +1087,9 @@ on_store_service (GObject *source,
                   GAsyncResult *result,
                   gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       StoreClosure *store = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       StoreClosure *store = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        SecretService *service;
        GError *error = NULL;
 
@@ -1088,16 +1097,17 @@ on_store_service (GObject *source,
        if (error == NULL) {
                secret_service_create_item_dbus_path (service, store->collection_path,
                                                      store->properties, store->value,
-                                                     SECRET_ITEM_CREATE_REPLACE, store->cancellable,
-                                                     on_store_create, g_object_ref (async));
+                                                     SECRET_ITEM_CREATE_REPLACE,
+                                                     cancellable,
+                                                     on_store_create,
+                                                     g_steal_pointer (&task));
                g_object_unref (service);
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1140,7 +1150,7 @@ secret_service_store (SecretService *service,
                       GAsyncReadyCallback callback,
                       gpointer user_data)
 {
-       GSimpleAsyncResult *async;
+       GTask *task;
        StoreClosure *store;
        const gchar *schema_name;
        GVariant *propval;
@@ -1155,11 +1165,10 @@ secret_service_store (SecretService *service,
        if (schema != NULL && !_secret_attributes_validate (schema, attributes, G_STRFUNC, FALSE))
                return;
 
-       async = g_simple_async_result_new  (G_OBJECT (service), callback, user_data,
-                                           secret_service_store);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, secret_service_store);
        store = g_slice_new0 (StoreClosure);
        store->collection_path = _secret_util_collection_to_path (collection);
-       store->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
        store->value = secret_value_ref (value);
        store->properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
                                                   (GDestroyNotify)g_variant_unref);
@@ -1176,20 +1185,22 @@ secret_service_store (SecretService *service,
                             SECRET_ITEM_INTERFACE ".Attributes",
                             g_variant_ref_sink (propval));
 
-       g_simple_async_result_set_op_res_gpointer (async, store, store_closure_free);
+       g_task_set_task_data (task, store, store_closure_free);
 
        if (service == NULL) {
                secret_service_get (SECRET_SERVICE_OPEN_SESSION, cancellable,
-                                   on_store_service, g_object_ref (async));
+                                   on_store_service, g_steal_pointer (&task));
 
        } else {
                secret_service_create_item_dbus_path (service, store->collection_path,
                                                      store->properties, store->value,
-                                                     SECRET_ITEM_CREATE_REPLACE, store->cancellable,
-                                                     on_store_create, g_object_ref (async));
+                                                     SECRET_ITEM_CREATE_REPLACE,
+                                                     cancellable,
+                                                     on_store_create,
+                                                     g_steal_pointer (&task));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1208,12 +1219,13 @@ secret_service_store_finish (SecretService *service,
                              GError **error)
 {
        g_return_val_if_fail (service == NULL || SECRET_IS_SERVICE (service), FALSE);
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                                                             secret_service_store), FALSE);
+       g_return_val_if_fail (g_task_is_valid (result, service), FALSE);
        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-       if (_secret_util_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+       if (!g_task_propagate_boolean (G_TASK (result), error)) {
+               _secret_util_strip_remote_error (error);
                return FALSE;
+       }
 
        return TRUE;
 }
@@ -1289,39 +1301,23 @@ secret_service_store_sync (SecretService *service,
        return ret;
 }
 
-typedef struct {
-       GVariant *attributes;
-       SecretValue *value;
-       GCancellable *cancellable;
-} LookupClosure;
-
-static void
-lookup_closure_free (gpointer data)
-{
-       LookupClosure *closure = data;
-       g_variant_unref (closure->attributes);
-       if (closure->value)
-               secret_value_unref (closure->value);
-       g_clear_object (&closure->cancellable);
-       g_slice_free (LookupClosure, closure);
-}
-
 static void
 on_lookup_get_secret (GObject *source,
                       GAsyncResult *result,
                       gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
+       GTask *task = G_TASK (user_data);
        SecretService *self = SECRET_SERVICE (source);
+       SecretValue *value;
        GError *error = NULL;
 
-       closure->value = secret_service_get_secret_for_dbus_path_finish (self, result, &error);
+       value = secret_service_get_secret_for_dbus_path_finish (self, result, &error);
        if (error != NULL)
-               g_simple_async_result_take_error (res, error);
+               g_task_return_error (task, g_steal_pointer (&error));
+       else
+               g_task_return_pointer (task, value, secret_value_unref);
 
-       g_simple_async_result_complete (res);
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -1329,30 +1325,28 @@ on_lookup_unlocked (GObject *source,
                     GAsyncResult *result,
                     gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
        SecretService *self = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        gchar **unlocked = NULL;
 
-       secret_service_unlock_dbus_paths_finish (SECRET_SERVICE (source),
-                                                result, &unlocked, &error);
+       secret_service_unlock_dbus_paths_finish (self, result, &unlocked, &error);
        if (error != NULL) {
-               g_simple_async_result_take_error (res, error);
-               g_simple_async_result_complete (res);
+               g_task_return_error (task, g_steal_pointer (&error));
 
        } else if (unlocked && unlocked[0]) {
                secret_service_get_secret_for_dbus_path (self, unlocked[0],
-                                                        closure->cancellable,
+                                                        cancellable,
                                                         on_lookup_get_secret,
-                                                        g_object_ref (res));
+                                                        g_steal_pointer (&task));
 
        } else {
-               g_simple_async_result_complete (res);
+               g_task_return_pointer (task, NULL, NULL);
        }
 
        g_strfreev (unlocked);
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -1360,38 +1354,37 @@ on_lookup_searched (GObject *source,
                     GAsyncResult *result,
                     gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       LookupClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
        SecretService *self = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        gchar **unlocked = NULL;
        gchar **locked = NULL;
 
        secret_service_search_for_dbus_paths_finish (self, result, &unlocked, &locked, &error);
        if (error != NULL) {
-               g_simple_async_result_take_error (res, error);
-               g_simple_async_result_complete (res);
+               g_task_return_error (task, g_steal_pointer (&error));
 
        } else if (unlocked && unlocked[0]) {
                secret_service_get_secret_for_dbus_path (self, unlocked[0],
-                                                        closure->cancellable,
+                                                        cancellable,
                                                         on_lookup_get_secret,
-                                                        g_object_ref (res));
+                                                        g_steal_pointer (&task));
 
        } else if (locked && locked[0]) {
                const gchar *paths[] = { locked[0], NULL };
                secret_service_unlock_dbus_paths (self, paths,
-                                                 closure->cancellable,
+                                                 cancellable,
                                                  on_lookup_unlocked,
-                                                 g_object_ref (res));
+                                                 g_steal_pointer (&task));
 
        } else {
-               g_simple_async_result_complete (res);
+               g_task_return_pointer (task, NULL, NULL);
        }
 
        g_strfreev (unlocked);
        g_strfreev (locked);
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -1399,24 +1392,25 @@ on_lookup_service (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       LookupClosure *lookup = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       GVariant *attributes = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        SecretService *service;
        GError *error = NULL;
 
        service = secret_service_get_finish (result, &error);
        if (error == NULL) {
-               _secret_service_search_for_paths_variant (service, lookup->attributes,
-                                                         lookup->cancellable,
-                                                         on_lookup_searched, g_object_ref (async));
+               _secret_service_search_for_paths_variant (service, attributes,
+                                                         cancellable,
+                                                         on_lookup_searched,
+                                                         g_steal_pointer (&task));
                g_object_unref (service);
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1446,8 +1440,8 @@ secret_service_lookup (SecretService *service,
                        gpointer user_data)
 {
        const gchar *schema_name = NULL;
-       GSimpleAsyncResult *res;
-       LookupClosure *closure;
+       GTask *task;
+       GVariant *attributes_v;
 
        g_return_if_fail (service == NULL || SECRET_IS_SERVICE (service));
        g_return_if_fail (attributes != NULL);
@@ -1460,24 +1454,24 @@ secret_service_lookup (SecretService *service,
        if (schema != NULL && !(schema->flags & SECRET_SCHEMA_DONT_MATCH_NAME))
                schema_name = schema->name;
 
-       res = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
-                                        secret_service_lookup);
-       closure = g_slice_new0 (LookupClosure);
-       closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
-       closure->attributes = _secret_attributes_to_variant (attributes, schema_name);
-       g_variant_ref_sink (closure->attributes);
-       g_simple_async_result_set_op_res_gpointer (res, closure, lookup_closure_free);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, secret_service_lookup);
+
+       attributes_v = _secret_attributes_to_variant (attributes, schema_name);
+       g_variant_ref_sink (attributes_v);
+       g_task_set_task_data (task, attributes_v, (GDestroyNotify) g_variant_unref);
 
        if (service == NULL) {
                secret_service_get (SECRET_SERVICE_OPEN_SESSION, cancellable,
-                                   on_lookup_service, g_object_ref (res));
+                                   on_lookup_service, g_steal_pointer (&task));
        } else {
-               _secret_service_search_for_paths_variant (service, closure->attributes,
-                                                         closure->cancellable,
-                                                         on_lookup_searched, g_object_ref (res));
+               _secret_service_search_for_paths_variant (service, attributes_v,
+                                                         cancellable,
+                                                         on_lookup_searched,
+                                                         g_steal_pointer (&task));
        }
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 /**
@@ -1498,22 +1492,18 @@ secret_service_lookup_finish (SecretService *service,
                               GAsyncResult *result,
                               GError **error)
 {
-       GSimpleAsyncResult *res;
-       LookupClosure *closure;
        SecretValue *value;
 
        g_return_val_if_fail (service == NULL || SECRET_IS_SERVICE (service), NULL);
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                             secret_service_lookup), NULL);
+       g_return_val_if_fail (g_task_is_valid (result, service), NULL);
 
-       res = G_SIMPLE_ASYNC_RESULT (result);
-       if (_secret_util_propagate_error (res, error))
+       value = g_task_propagate_pointer (G_TASK (result), error);
+       if (!value) {
+               _secret_util_strip_remote_error (error);
                return NULL;
+       }
 
-       closure = g_simple_async_result_get_op_res_gpointer (res);
-       value = closure->value;
-       closure->value = NULL;
        return value;
 }
 
@@ -1573,7 +1563,6 @@ secret_service_lookup_sync (SecretService *service,
 }
 
 typedef struct {
-       GCancellable *cancellable;
        SecretService *service;
        GVariant *attributes;
        gint deleted;
@@ -1587,7 +1576,6 @@ delete_closure_free (gpointer data)
        if (closure->service)
                g_object_unref (closure->service);
        g_variant_unref (closure->attributes);
-       g_clear_object (&closure->cancellable);
        g_slice_free (DeleteClosure, closure);
 }
 
@@ -1596,23 +1584,24 @@ on_delete_password_complete (GObject *source,
                              GAsyncResult *result,
                              gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
+       SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       DeleteClosure *closure = g_task_get_task_data (task);
        GError *error = NULL;
        gboolean deleted;
 
        closure->deleting--;
 
-       deleted = _secret_service_delete_path_finish (SECRET_SERVICE (source), result, &error);
+       deleted = _secret_service_delete_path_finish (service, result, &error);
        if (error != NULL)
-               g_simple_async_result_take_error (res, error);
+               g_task_return_error (task, g_steal_pointer (&error));
        if (deleted)
                closure->deleted++;
 
        if (closure->deleting <= 0)
-               g_simple_async_result_complete (res);
+               g_task_return_boolean (task, TRUE);
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -1620,31 +1609,32 @@ on_delete_searched (GObject *source,
                     GAsyncResult *result,
                     gpointer user_data)
 {
-       GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
-       DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (res);
+       SecretService *service = SECRET_SERVICE (source);
+       GTask *task = G_TASK (user_data);
+       DeleteClosure *closure = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
        gchar **unlocked = NULL;
        gint i;
 
-       secret_service_search_for_dbus_paths_finish (SECRET_SERVICE (source), result, &unlocked, NULL, 
&error);
+       secret_service_search_for_dbus_paths_finish (service, result, &unlocked, NULL, &error);
        if (error == NULL) {
                for (i = 0; unlocked[i] != NULL; i++) {
                        _secret_service_delete_path (closure->service, unlocked[i], TRUE,
-                                                    closure->cancellable,
+                                                    cancellable,
                                                     on_delete_password_complete,
-                                                    g_object_ref (res));
+                                                    g_object_ref (task));
                        closure->deleting++;
                }
 
                if (closure->deleting == 0)
-                       g_simple_async_result_complete (res);
+                       g_task_return_boolean (task, FALSE);
        } else {
-               g_simple_async_result_take_error (res, error);
-               g_simple_async_result_complete (res);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
        g_strfreev (unlocked);
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 static void
@@ -1652,22 +1642,22 @@ on_delete_service (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       DeleteClosure *closure = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       DeleteClosure *closure = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        GError *error = NULL;
 
        closure->service = secret_service_get_finish (result, &error);
        if (error == NULL) {
                _secret_service_search_for_paths_variant (closure->service, closure->attributes,
-                                                         closure->cancellable,
-                                                         on_delete_searched, g_object_ref (async));
+                                                         cancellable,
+                                                         on_delete_searched, g_steal_pointer (&task));
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1697,7 +1687,7 @@ secret_service_clear (SecretService *service,
                       gpointer user_data)
 {
        const gchar *schema_name = NULL;
-       GSimpleAsyncResult *res;
+       GTask *task;
        DeleteClosure *closure;
 
        g_return_if_fail (service == NULL || SECRET_SERVICE (service));
@@ -1711,28 +1701,27 @@ secret_service_clear (SecretService *service,
        if (schema != NULL && !(schema->flags & SECRET_SCHEMA_DONT_MATCH_NAME))
                schema_name = schema->name;
 
-       res = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
-                                        secret_service_clear);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, secret_service_clear);
        closure = g_slice_new0 (DeleteClosure);
-       closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
        closure->attributes = _secret_attributes_to_variant (attributes, schema_name);
        g_variant_ref_sink (closure->attributes);
-       g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free);
+       g_task_set_task_data (task, closure, delete_closure_free);
 
        /* A double check to make sure we don't delete everything, should have been checked earlier */
        g_assert (g_variant_n_children (closure->attributes) > 0);
 
        if (service == NULL) {
                secret_service_get (SECRET_SERVICE_NONE, cancellable,
-                                   on_delete_service, g_object_ref (res));
+                                   on_delete_service, g_steal_pointer (&task));
        } else {
                closure->service = g_object_ref (service);
                _secret_service_search_for_paths_variant (closure->service, closure->attributes,
-                                                         closure->cancellable,
-                                                         on_delete_searched, g_object_ref (res));
+                                                         cancellable,
+                                                         on_delete_searched, g_steal_pointer (&task));
        }
 
-       g_object_unref (res);
+       g_clear_object (&task);
 }
 
 /**
@@ -1751,20 +1740,16 @@ secret_service_clear_finish (SecretService *service,
                              GAsyncResult *result,
                              GError **error)
 {
-       GSimpleAsyncResult *res;
-       DeleteClosure *closure;
-
        g_return_val_if_fail (service == NULL || SECRET_IS_SERVICE (service), FALSE);
        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                             secret_service_clear), FALSE);
+       g_return_val_if_fail (g_task_is_valid (result, service), FALSE);
 
-       res = G_SIMPLE_ASYNC_RESULT (result);
-       if (_secret_util_propagate_error (res, error))
+       if (!g_task_propagate_boolean (G_TASK (result), error)) {
+               _secret_util_strip_remote_error (error);
                return FALSE;
+       }
 
-       closure = g_simple_async_result_get_op_res_gpointer (res);
-       return closure->deleted > 0;
+       return TRUE;
 }
 
 /**
@@ -1822,7 +1807,6 @@ secret_service_clear_sync (SecretService *service,
 }
 
 typedef struct {
-       GCancellable *cancellable;
        gchar *alias;
        gchar *collection_path;
 } SetClosure;
@@ -1831,8 +1815,6 @@ static void
 set_closure_free (gpointer data)
 {
        SetClosure *set = data;
-       if (set->cancellable)
-               g_object_unref (set->cancellable);
        g_free (set->alias);
        g_free (set->collection_path);
        g_slice_free (SetClosure, set);
@@ -1843,15 +1825,17 @@ on_set_alias_done (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
+       GTask *task = G_TASK (user_data);
+       SecretService *service = SECRET_SERVICE (source);
        GError *error = NULL;
 
-       secret_service_set_alias_to_dbus_path_finish (SECRET_SERVICE (source), result, &error);
-       if (error != NULL)
-               g_simple_async_result_take_error (async, error);
+       if (secret_service_set_alias_to_dbus_path_finish (service, result, &error)) {
+               g_task_return_boolean (task, TRUE);
+       } else {
+               g_task_return_error (task, g_steal_pointer (&error));
+       }
 
-       g_simple_async_result_complete (async);
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 static void
@@ -1859,8 +1843,9 @@ on_set_alias_service (GObject *source,
                       GAsyncResult *result,
                       gpointer user_data)
 {
-       GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
-       SetClosure *set = g_simple_async_result_get_op_res_gpointer (async);
+       GTask *task = G_TASK (user_data);
+       SetClosure *set = g_task_get_task_data (task);
+       GCancellable *cancellable = g_task_get_cancellable (task);
        SecretService *service;
        GError *error = NULL;
 
@@ -1868,17 +1853,16 @@ on_set_alias_service (GObject *source,
        if (error == NULL) {
                secret_service_set_alias_to_dbus_path (service, set->alias,
                                                       set->collection_path,
-                                                      set->cancellable,
+                                                      cancellable,
                                                       on_set_alias_done,
-                                                      g_object_ref (async));
+                                                      g_steal_pointer (&task));
                g_object_unref (service);
 
        } else {
-               g_simple_async_result_take_error (async, error);
-               g_simple_async_result_complete (async);
+               g_task_return_error (task, g_steal_pointer (&error));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1906,7 +1890,7 @@ secret_service_set_alias (SecretService *service,
                           GAsyncReadyCallback callback,
                           gpointer user_data)
 {
-       GSimpleAsyncResult *async;
+       GTask *task;
        SetClosure *set;
        const gchar *path;
 
@@ -1915,10 +1899,9 @@ secret_service_set_alias (SecretService *service,
        g_return_if_fail (collection == NULL || SECRET_IS_COLLECTION (collection));
        g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
 
-       async = g_simple_async_result_new (G_OBJECT (service), callback, user_data,
-                                          secret_service_set_alias);
+       task = g_task_new (service, cancellable, callback, user_data);
+       g_task_set_source_tag (task, secret_service_set_alias);
        set = g_slice_new0 (SetClosure);
-       set->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
        set->alias = g_strdup (alias);
 
        if (collection) {
@@ -1929,20 +1912,20 @@ secret_service_set_alias (SecretService *service,
        }
 
        set->collection_path = g_strdup (path);
-       g_simple_async_result_set_op_res_gpointer (async, set, set_closure_free);
+       g_task_set_task_data (task, set, set_closure_free);
 
        if (service == NULL) {
                secret_service_get (SECRET_SERVICE_NONE, cancellable,
-                                   on_set_alias_service, g_object_ref (async));
+                                   on_set_alias_service, g_steal_pointer (&task));
        } else {
                secret_service_set_alias_to_dbus_path (service, set->alias,
                                                       set->collection_path,
-                                                      set->cancellable,
+                                                      cancellable,
                                                       on_set_alias_done,
-                                                      g_object_ref (async));
+                                                      g_steal_pointer (&task));
        }
 
-       g_object_unref (async);
+       g_clear_object (&task);
 }
 
 /**
@@ -1961,12 +1944,13 @@ secret_service_set_alias_finish (SecretService *service,
                                  GError **error)
 {
        g_return_val_if_fail (service == NULL || SECRET_IS_SERVICE (service), FALSE);
-       g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (service),
-                                                             secret_service_set_alias), FALSE);
+       g_return_val_if_fail (g_task_is_valid (result, service), FALSE);
        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-       if (_secret_util_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+       if (!g_task_propagate_boolean (G_TASK (result), error)) {
+               _secret_util_strip_remote_error (error);
                return FALSE;
+       }
 
        return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]