Blame SOURCES/0001-Add-asynchronous-api-for-user-uncaching.patch

578d4e
From 564dc2f4a923c6e2c45a9920776ae93a97bebede Mon Sep 17 00:00:00 2001
578d4e
From: Ondrej Holy <oholy@redhat.com>
578d4e
Date: Thu, 18 Sep 2014 18:55:36 +0200
578d4e
Subject: [PATCH] Add asynchronous api for user uncaching
578d4e
578d4e
It is needed for deleting enterprise accounts in gnome-control-center.
578d4e
See https://bugzilla.gnome.org/show_bug.cgi?id=727871 for details.
578d4e
---
578d4e
 src/libaccountsservice/act-user-manager.c | 83 +++++++++++++++++++++++++++++++
578d4e
 src/libaccountsservice/act-user-manager.h |  8 +++
578d4e
 2 files changed, 91 insertions(+)
578d4e
578d4e
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
578d4e
index c1c6f5a..e7c3305 100644
578d4e
--- a/src/libaccountsservice/act-user-manager.c
578d4e
+++ b/src/libaccountsservice/act-user-manager.c
578d4e
@@ -3353,6 +3353,89 @@ act_user_manager_uncache_user (ActUserManager     *manager,
578d4e
         return TRUE;
578d4e
 }
578d4e
 
578d4e
+/*
578d4e
+ * act_user_manager_uncache_user_async:
578d4e
+ * @manager: a #ActUserManager
578d4e
+ * @username: a unix user name
578d4e
+ * @cancellable: (allow-none): optional #GCancellable object,
578d4e
+ *     %NULL to ignore
578d4e
+ * @callback: (scope async): a #GAsyncReadyCallback to call
578d4e
+ *     when the request is satisfied
578d4e
+ * @user_data: (closure): the data to pass to @callback
578d4e
+ *
578d4e
+ * Asynchronously uncaches a user account.
578d4e
+ *
578d4e
+ * For more details, see act_user_manager_uncache_user(), which
578d4e
+ * is the synchronous version of this call.
578d4e
+ *
578d4e
+ * Since: 0.6.39
578d4e
+ */
578d4e
+void
578d4e
+act_user_manager_uncache_user_async (ActUserManager      *manager,
578d4e
+                                     const char          *username,
578d4e
+                                     GCancellable        *cancellable,
578d4e
+                                     GAsyncReadyCallback  callback,
578d4e
+                                     gpointer             user_data)
578d4e
+{
578d4e
+        GSimpleAsyncResult *res;
578d4e
+
578d4e
+        g_return_if_fail (ACT_IS_USER_MANAGER (manager));
578d4e
+        g_return_if_fail (manager->priv->accounts_proxy != NULL);
578d4e
+
578d4e
+        g_debug ("ActUserManager: Uncaching user (async) '%s'", username);
578d4e
+
578d4e
+        res = g_simple_async_result_new (G_OBJECT (manager),
578d4e
+                                         callback, user_data,
578d4e
+                                         act_user_manager_uncache_user_async);
578d4e
+        g_simple_async_result_set_check_cancellable (res, cancellable);
578d4e
+
578d4e
+        accounts_accounts_call_uncache_user (manager->priv->accounts_proxy,
578d4e
+                                             username,
578d4e
+                                             cancellable,
578d4e
+                                             act_user_manager_async_complete_handler, res);
578d4e
+}
578d4e
+
578d4e
+/**
578d4e
+ * act_user_manager_uncache_user_finish:
578d4e
+ * @manager: a #ActUserManager
578d4e
+ * @result: a #GAsyncResult
578d4e
+ * @error: a #GError
578d4e
+ *
578d4e
+ * Finishes an asynchronous user uncaching.
578d4e
+ *
578d4e
+ * See act_user_manager_uncache_user_async().
578d4e
+ *
578d4e
+ * Returns: %TRUE if the user account was successfully uncached
578d4e
+ *
578d4e
+ * Since: 0.6.39
578d4e
+ */
578d4e
+gboolean
578d4e
+act_user_manager_uncache_user_finish (ActUserManager  *manager,
578d4e
+                                      GAsyncResult    *result,
578d4e
+                                      GError         **error)
578d4e
+{
578d4e
+        GAsyncResult *inner_result;
578d4e
+        gboolean success;
578d4e
+        GSimpleAsyncResult *res;
578d4e
+        GError *remote_error = NULL;
578d4e
+
578d4e
+        g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (manager), act_user_manager_uncache_user_async), FALSE);
578d4e
+
578d4e
+        res = G_SIMPLE_ASYNC_RESULT (result);
578d4e
+        inner_result = g_simple_async_result_get_op_res_gpointer (res);
578d4e
+        g_assert (inner_result);
578d4e
+
578d4e
+        success = accounts_accounts_call_uncache_user_finish (manager->priv->accounts_proxy,
578d4e
+                                                              inner_result, &remote_error);
578d4e
+
578d4e
+        if (remote_error) {
578d4e
+                g_dbus_error_strip_remote_error (remote_error);
578d4e
+                g_propagate_error (error, remote_error);
578d4e
+        }
578d4e
+
578d4e
+        return success;
578d4e
+}
578d4e
+
578d4e
 /**
578d4e
  * act_user_manager_delete_user:
578d4e
  * @manager: a #ActUserManager
578d4e
diff --git a/src/libaccountsservice/act-user-manager.h b/src/libaccountsservice/act-user-manager.h
578d4e
index 3d91f83..ae5fd2e 100644
578d4e
--- a/src/libaccountsservice/act-user-manager.h
578d4e
+++ b/src/libaccountsservice/act-user-manager.h
578d4e
@@ -122,6 +122,14 @@ ActUser *           act_user_manager_cache_user_finish     (ActUserManager     *
578d4e
 gboolean            act_user_manager_uncache_user          (ActUserManager     *manager,
578d4e
                                                             const char         *username,
578d4e
                                                             GError            **error);
578d4e
+void                act_user_manager_uncache_user_async    (ActUserManager     *manager,
578d4e
+                                                            const gchar        *username,
578d4e
+                                                            GCancellable       *cancellable,
578d4e
+                                                            GAsyncReadyCallback callback,
578d4e
+                                                            gpointer            user_data);
578d4e
+gboolean            act_user_manager_uncache_user_finish   (ActUserManager     *manager,
578d4e
+                                                            GAsyncResult       *result,
578d4e
+                                                            GError            **error);
578d4e
 
578d4e
 gboolean            act_user_manager_delete_user           (ActUserManager     *manager,
578d4e
                                                             ActUser            *user,
578d4e
-- 
578d4e
1.9.3
578d4e