[gdm/rstrode/wip/list-extension: 4/5] libgdm: add api for getting at ChoiceList interface



commit bfa01c61c77cfa0e73f78d607c56d2101d5c3c2b
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jul 17 15:14:02 2017 -0400

    libgdm: add api for getting at ChoiceList interface
    
    This provides gnome-shell with a way to use the new interface.

 libgdm/gdm-client.c |   98 ++++++++++++++++++++++++++++++++++++++++++---------
 libgdm/gdm-client.h |    2 +
 2 files changed, 83 insertions(+), 17 deletions(-)
---
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 1f42891..a0f4347 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -41,7 +41,10 @@
 struct GdmClientPrivate
 {
         GdmManager         *manager;
-        GdmUserVerifier    *user_verifier;
+
+        GdmUserVerifier           *user_verifier;
+        GdmUserVerifierChoiceList *user_verifier_choice_list;
+
         GdmGreeter         *greeter;
         GdmRemoteGreeter   *remote_greeter;
         GdmChooser         *chooser;
@@ -169,6 +172,37 @@ on_user_verifier_proxy_created (GObject            *source,
 }
 
 static void
+on_user_verifier_choice_list_proxy_created (GObject            *source,
+                                            GAsyncResult       *result,
+                                            GSimpleAsyncResult *operation_result)
+{
+        GdmClient                 *client;
+        GdmUserVerifierChoiceList *choice_list;
+        GCancellable              *cancellable;
+        GError                    *error = NULL;
+
+        client = GDM_CLIENT (g_async_result_get_source_object (G_ASYNC_RESULT (operation_result)));
+
+        choice_list = gdm_user_verifier_choice_list_proxy_new_finish (result, &error);
+        if (choice_list == NULL) {
+                g_debug ("Couldn't create UserVerifier ChoiceList proxy: %s", error->message);
+                g_clear_error (&error);
+        } else {
+                client->priv->user_verifier_choice_list = choice_list;
+        }
+
+        cancellable = g_object_get_data (G_OBJECT (operation_result), "cancellable");
+        gdm_user_verifier_proxy_new (client->priv->connection,
+                                     G_DBUS_PROXY_FLAGS_NONE,
+                                     NULL,
+                                     SESSION_DBUS_PATH,
+                                     cancellable,
+                                     (GAsyncReadyCallback)
+                                     on_user_verifier_proxy_created,
+                                     operation_result);
+}
+
+static void
 on_reauthentication_channel_connected (GObject            *source_object,
                                        GAsyncResult       *result,
                                        GSimpleAsyncResult *operation_result)
@@ -187,14 +221,14 @@ on_reauthentication_channel_connected (GObject            *source_object,
         }
 
         cancellable = g_object_get_data (G_OBJECT (operation_result), "cancellable");
-        gdm_user_verifier_proxy_new (connection,
-                                     G_DBUS_PROXY_FLAGS_NONE,
-                                     NULL,
-                                     SESSION_DBUS_PATH,
-                                     cancellable,
-                                     (GAsyncReadyCallback)
-                                     on_user_verifier_proxy_created,
-                                     operation_result);
+        gdm_user_verifier_choice_list_proxy_new (connection,
+                                                 G_DBUS_PROXY_FLAGS_NONE,
+                                                 NULL,
+                                                 SESSION_DBUS_PATH,
+                                                 cancellable,
+                                                 (GAsyncReadyCallback)
+                                                 on_user_verifier_choice_list_proxy_created,
+                                                 operation_result);
         g_object_unref (connection);
 }
 
@@ -669,6 +703,13 @@ gdm_client_get_user_verifier_sync (GdmClient     *client,
                 return NULL;
         }
 
+        client->priv->user_verifier_choice_list = gdm_user_verifier_choice_list_proxy_new_sync 
(client->priv->connection,
+                                                                                                
G_DBUS_PROXY_FLAGS_NONE,
+                                                                                                NULL,
+                                                                                                
SESSION_DBUS_PATH,
+                                                                                                cancellable,
+                                                                                                error);
+
         client->priv->user_verifier = gdm_user_verifier_proxy_new_sync (client->priv->connection,
                                                                         G_DBUS_PROXY_FLAGS_NONE,
                                                                         NULL,
@@ -710,14 +751,15 @@ on_connection_opened_for_user_verifier (GdmClient          *client,
         }
 
         cancellable = g_object_get_data (G_OBJECT (operation_result), "cancellable");
-        gdm_user_verifier_proxy_new (client->priv->connection,
-                                     G_DBUS_PROXY_FLAGS_NONE,
-                                     NULL,
-                                     SESSION_DBUS_PATH,
-                                     cancellable,
-                                     (GAsyncReadyCallback)
-                                     on_user_verifier_proxy_created,
-                                     operation_result);
+        gdm_user_verifier_choice_list_proxy_new (client->priv->connection,
+                                                 G_DBUS_PROXY_FLAGS_NONE,
+                                                 NULL,
+                                                 SESSION_DBUS_PATH,
+                                                 cancellable,
+                                                 (GAsyncReadyCallback)
+                                                 on_user_verifier_choice_list_proxy_created,
+                                                 operation_result);
+
 }
 
 /**
@@ -815,6 +857,26 @@ gdm_client_get_user_verifier_finish (GdmClient       *client,
         return g_object_ref (user_verifier);
 }
 
+/**
+ * gdm_client_get_user_verifier_choice_list:
+ * @client: a #GdmClient
+ *
+ * Gets a #GdmUserVerifierChoiceList object that can be used to
+ * verify a user's local account.
+ *
+ * Returns: (transfer full): #GdmUserVerifierChoiceList or %NULL if user
+ * verifier isn't yet fetched, or daemon doesn't support choice lists
+ */
+GdmUserVerifierChoiceList *
+gdm_client_get_user_verifier_choice_list (GdmClient *client)
+{
+        if (client->priv->user_verifier_choice_list != NULL) {
+                return g_object_ref (client->priv->user_verifier_choice_list);
+        }
+
+        return NULL;
+}
+
 static void
 on_timed_login_details_got (GdmGreeter   *greeter,
                             GAsyncResult *result)
@@ -1456,6 +1518,8 @@ gdm_client_finalize (GObject *object)
 
         g_return_if_fail (client->priv != NULL);
 
+        g_clear_object (&client->priv->user_verifier_choice_list);
+
         if (client->priv->user_verifier != NULL) {
                 g_object_remove_weak_pointer (G_OBJECT (client->priv->user_verifier),
                                               (gpointer *)
diff --git a/libgdm/gdm-client.h b/libgdm/gdm-client.h
index cbe2b38..3c333c2 100644
--- a/libgdm/gdm-client.h
+++ b/libgdm/gdm-client.h
@@ -85,6 +85,8 @@ GdmUserVerifier   *gdm_client_get_user_verifier_sync    (GdmClient *client,
                                                          GCancellable     *cancellable,
                                                          GError          **error);
 
+GdmUserVerifierChoiceList *gdm_client_get_user_verifier_choice_list  (GdmClient *client);
+
 void               gdm_client_get_greeter               (GdmClient     *client,
                                                          GCancellable         *cancellable,
                                                          GAsyncReadyCallback   callback,


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