[gnome-online-accounts/wip/rishi/kerberos: 3/11] kerberos: Add sign_in_identity_finish



commit 3c648216f6d3ca545c422339268a19fc143b9249
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Aug 2 02:55:12 2016 +0200

    kerberos: Add sign_in_identity_finish
    
    Having the GAsyncReadyCallback directly call g_task_propagate_pointer
    on the passed in GAsyncResult leads to less code. However, it becomes
    hard to follow when the asynchronous sign_in_identity call is wrapped
    by another asynchronous operation with its own GAsyncResult. Plus, it
    doesn't hurt to have some extra assertions and being consistent with
    the general pattern of asynchronous operations in GIO.

 src/goabackend/goakerberosprovider.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index 969afe3..b65eb00 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -237,6 +237,23 @@ sign_in_identity (GoaKerberosProvider  *self,
   g_object_unref (operation_result);
 }
 
+static gchar *
+sign_in_identity_finish (GoaKerberosProvider  *self,
+                         GAsyncResult         *result,
+                         GError              **error)
+{
+  GTask *task;
+
+  g_return_val_if_fail (GOA_IS_KERBEROS_PROVIDER (self), NULL);
+
+  g_return_val_if_fail (g_task_is_valid (result, self), NULL);
+  task = G_TASK (result);
+
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  return g_task_propagate_pointer (task, error);
+}
+
 static void
 on_account_signed_in (GoaProvider   *provider,
                       GAsyncResult  *result,
@@ -822,7 +839,7 @@ on_initial_sign_in_done (GoaKerberosProvider *self,
                                                           "remember-password"));
 
   error = NULL;
-  object_path = g_task_propagate_pointer (G_TASK (result), &error);
+  object_path = sign_in_identity_finish (self, result, &error);
   if (error != NULL)
     {
       g_task_return_error (operation_result, error);


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