[gdm/multi-stack: 13/34] Bubble service-unavailable up to greeter



commit 0c423df1aa38bd16a71f4d0b3224de16bfc78a54
Author: Ray Strode <rstrode redhat com>
Date:   Wed Oct 28 21:38:52 2009 -0400

    Bubble service-unavailable up to greeter

 daemon/gdm-greeter-server.c |   13 +++++++++++--
 daemon/gdm-greeter-server.h |    5 ++++-
 daemon/gdm-simple-slave.c   |   36 ++++++++++++++----------------------
 3 files changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/daemon/gdm-greeter-server.c b/daemon/gdm-greeter-server.c
index 50e4193..4a011da 100644
--- a/daemon/gdm-greeter-server.c
+++ b/daemon/gdm-greeter-server.c
@@ -286,9 +286,18 @@ gdm_greeter_server_problem (GdmGreeterServer *greeter_server,
 }
 
 gboolean
-gdm_greeter_server_authentication_failed (GdmGreeterServer *greeter_server)
+gdm_greeter_server_authentication_failed (GdmGreeterServer *greeter_server,
+                                          const char       *service_name)
 {
-        send_dbus_void_signal (greeter_server, "AuthenticationFailed");
+        send_dbus_string_signal (greeter_server, "AuthenticationFailed", service_name);
+        return TRUE;
+}
+
+gboolean
+gdm_greeter_server_service_unavailable (GdmGreeterServer *greeter_server,
+                                        const char       *service_name)
+{
+        send_dbus_string_signal (greeter_server, "ServiceUnavailable", service_name);
         return TRUE;
 }
 
diff --git a/daemon/gdm-greeter-server.h b/daemon/gdm-greeter-server.h
index 5af32fd..ff1ff5d 100644
--- a/daemon/gdm-greeter-server.h
+++ b/daemon/gdm-greeter-server.h
@@ -93,7 +93,10 @@ gboolean            gdm_greeter_server_info                  (GdmGreeterServer *
 gboolean            gdm_greeter_server_problem               (GdmGreeterServer *greeter_server,
                                                               const char       *service_name,
                                                               const char       *text);
-gboolean            gdm_greeter_server_authentication_failed (GdmGreeterServer *greeter_server);
+gboolean            gdm_greeter_server_authentication_failed (GdmGreeterServer *greeter_server,
+                                                              const char       *service_name);
+gboolean            gdm_greeter_server_service_unavailable   (GdmGreeterServer *greeter_server,
+                                                              const char       *service_name);
 gboolean            gdm_greeter_server_reset                 (GdmGreeterServer *greeter_server);
 gboolean            gdm_greeter_server_ready                 (GdmGreeterServer *greeter_server,
                                                               const char       *service_name);
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 4f4f331..6faeeb3 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -197,22 +197,6 @@ greeter_reset_timeout (GdmSimpleSlave *slave)
         return FALSE;
 }
 
-static gboolean
-auth_failed_reset_timeout (GdmSimpleSlave *slave)
-{
-        g_debug ("GdmSimpleSlave: auth failed resetting slave");
-
-        if (slave->priv->greeter_server != NULL) {
-                gdm_greeter_server_authentication_failed (slave->priv->greeter_server);
-                reset_session (slave);
-        } else {
-                start_greeter (slave);
-                create_new_session (slave);
-        }
-        slave->priv->greeter_reset_id = 0;
-        return FALSE;
-}
-
 static void
 queue_greeter_reset (GdmSimpleSlave *slave)
 {
@@ -224,14 +208,16 @@ queue_greeter_reset (GdmSimpleSlave *slave)
 }
 
 static void
-queue_auth_failed_reset (GdmSimpleSlave *slave)
+on_session_service_unavailable (GdmSession     *session,
+                                const char     *service_name,
+                                GdmSimpleSlave *slave)
 {
-        /* use the greeter reset idle id so we don't do both at once */
-        if (slave->priv->greeter_reset_id > 0) {
-                return;
+        if (slave->priv->greeter_server != NULL) {
+                gdm_greeter_server_service_unavailable (slave->priv->greeter_server,
+                                                        service_name);
         }
 
-        slave->priv->greeter_reset_id = g_idle_add ((GSourceFunc)auth_failed_reset_timeout, slave);
+        gdm_session_stop_conversation (session, service_name);
 }
 
 static void
@@ -294,7 +280,6 @@ on_session_authentication_failed (GdmSession     *session,
 
         g_debug ("GdmSimpleSlave: Authentication failed - may retry");
         gdm_session_stop_conversation (session, service_name);
-        queue_auth_failed_reset (slave);
 }
 
 static void
@@ -730,6 +715,10 @@ create_new_session (GdmSimpleSlave *slave)
                           G_CALLBACK (on_session_conversation_stopped),
                           slave);
         g_signal_connect (slave->priv->session,
+                          "service-unavailable",
+                          G_CALLBACK (on_session_service_unavailable),
+                          slave);
+        g_signal_connect (slave->priv->session,
                           "setup-complete",
                           G_CALLBACK (on_session_setup_complete),
                           slave);
@@ -848,6 +837,9 @@ destroy_session (GdmSimpleSlave *slave)
                                               G_CALLBACK (on_session_conversation_stopped),
                                               slave);
         g_signal_handlers_disconnect_by_func (slave->priv->session,
+                                              G_CALLBACK (on_session_service_unavailable),
+                                              slave);
+        g_signal_handlers_disconnect_by_func (slave->priv->session,
                                               G_CALLBACK (on_session_setup_complete),
                                               slave);
         g_signal_handlers_disconnect_by_func (slave->priv->session,



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