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



commit 018fbf07591770c787ab9e920d440b4bbedbe9cf
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 912a1e6..4c14d40 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -678,6 +678,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)
@@ -692,7 +713,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]