[gdm/multi-stack: 15/46] Tell tasks they're ready only after user list loads



commit d8133da9e499eebb4d1e7a5165800eaae49b09e0
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 20 14:31:27 2009 -0500

    Tell tasks they're ready only after user list loads
    
    This way they won't try to access the list prematurely.

 gui/simple-greeter/gdm-greeter-login-window.c |   28 ++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 3de9918..c2463d9 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -676,6 +676,27 @@ do_cancel (GdmGreeterLoginWindow *login_window)
         restart_conversations (login_window);
 }
 
+static void
+on_can_set_task_ready (GtkWidget *user_chooser,
+                       GdmTask   *task)
+{
+        g_signal_handlers_disconnect_by_func (user_chooser,
+                                              on_can_set_task_ready,
+                                              task);
+        gdm_conversation_set_ready (GDM_CONVERSATION (task));
+        g_object_unref (task);
+}
+
+static void
+set_task_ready_when_loaded (GdmGreeterLoginWindow *login_window,
+                            GdmTask               *task)
+{
+        g_signal_connect (login_window->priv->user_chooser,
+                          "loaded",
+                          G_CALLBACK (on_can_set_task_ready),
+                          g_object_ref (task));
+}
+
 gboolean
 gdm_greeter_login_window_ready (GdmGreeterLoginWindow *login_window,
                                 const char            *service_name)
@@ -690,7 +711,12 @@ gdm_greeter_login_window_ready (GdmGreeterLoginWindow *login_window,
                                            (gpointer) service_name);
 
         if (task != NULL) {
-                gdm_conversation_set_ready (GDM_CONVERSATION (task));
+                if (gdm_chooser_widget_is_loaded (GDM_CHOOSER_WIDGET (login_window->priv->user_chooser))) {
+                        gdm_conversation_set_ready (GDM_CONVERSATION (task));
+                } else {
+
+                        set_task_ready_when_loaded (login_window, task);
+                }
                 g_object_unref (task);
         }
 



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