[gdm/wip/wayland-take-2: 9/9] session: Reset immediately on cancel



commit 3c0ca1aeefd4242a36f46bcced174344d643651f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Mar 7 15:41:17 2014 -0500

    session: Reset immediately on cancel
    
    For some reason, before now, we round-tripped through the
    GdmManager object when resetting the session instead of doing it
    directly. The only time we can cancel is when the client calls
    Cancel();, so just handle that directly.

 daemon/gdm-manager.c |   59 --------------------------------------------------
 daemon/gdm-session.c |   22 +-----------------
 daemon/gdm-session.h |    3 +-
 3 files changed, 2 insertions(+), 82 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 13b7077..58b8a8b 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1255,61 +1255,6 @@ on_session_client_disconnected (GdmSession   *session,
         }
 }
 
-typedef struct
-{
-        GdmManager *manager;
-        GdmSession *session;
-        guint idle_id;
-} ResetSessionOperation;
-
-static void
-destroy_reset_session_operation (ResetSessionOperation *operation)
-{
-        g_object_set_data (G_OBJECT (operation->session),
-                           "reset-session-operation",
-                           NULL);
-        g_object_unref (operation->session);
-        g_slice_free (ResetSessionOperation, operation);
-}
-
-static gboolean
-on_reset_session (ResetSessionOperation *operation)
-{
-        gdm_session_reset (operation->session);
-
-        destroy_reset_session_operation (operation);
-
-        return G_SOURCE_REMOVE;
-}
-
-static void
-queue_session_reset (GdmManager *manager,
-                     GdmSession *session)
-{
-        ResetSessionOperation *operation;
-
-        operation = g_object_get_data (G_OBJECT (session), "reset-session-operation");
-
-        if (operation != NULL) {
-                return;
-        }
-
-        operation = g_slice_new0 (ResetSessionOperation);
-        operation->manager = manager;
-        operation->session = g_object_ref (session);
-        operation->idle_id = g_idle_add ((GSourceFunc) on_reset_session, operation);
-
-        g_object_set_data (G_OBJECT (session), "reset-session-operation", operation);
-}
-
-static void
-on_session_cancelled (GdmSession  *session,
-                      GdmManager  *manager)
-{
-        g_debug ("GdmManager: Session was cancelled");
-        queue_session_reset (manager, session);
-}
-
 static void
 on_session_conversation_started (GdmSession *session,
                                  const char *service_name,
@@ -1480,10 +1425,6 @@ create_seed_session_for_display (GdmManager *manager,
                           G_CALLBACK (on_session_client_disconnected),
                           manager);
         g_signal_connect (session,
-                          "cancelled",
-                          G_CALLBACK (on_session_cancelled),
-                          manager);
-        g_signal_connect (session,
                           "conversation-started",
                           G_CALLBACK (on_session_conversation_started),
                           manager);
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 37db7b0..1e2c512 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -141,7 +141,6 @@ enum {
         CONVERSATION_STARTED = 0,
         CONVERSATION_STOPPED,
         SETUP_COMPLETE,
-        CANCELLED,
         HOSTNAME_SELECTED,
         CLIENT_CONNECTED,
         CLIENT_DISCONNECTED,
@@ -1234,7 +1233,7 @@ gdm_session_handle_client_cancel (GdmDBusUserVerifier    *user_verifier_interfac
 {
         gdm_dbus_user_verifier_complete_cancel (user_verifier_interface,
                                                 invocation);
-        gdm_session_cancel (self);
+        gdm_session_reset (self);
         return TRUE;
 }
 
@@ -2539,14 +2538,6 @@ gdm_session_answer_query (GdmSession *self,
 }
 
 void
-gdm_session_cancel  (GdmSession *self)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (G_OBJECT (self), signals [CANCELLED], 0);
-}
-
-void
 gdm_session_reset (GdmSession *self)
 {
         if (self->priv->user_verifier_interface != NULL) {
@@ -3197,17 +3188,6 @@ gdm_session_class_init (GdmSessionClass *session_class)
                               G_TYPE_NONE,
                               1,
                               G_TYPE_STRING);
-        signals [CANCELLED] =
-                g_signal_new ("cancelled",
-                              GDM_TYPE_SESSION,
-                              G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSessionClass, cancelled),
-                              NULL,
-                              NULL,
-                              g_cclosure_marshal_VOID__VOID,
-                              G_TYPE_NONE,
-                              0);
-
         signals [CLIENT_CONNECTED] =
                 g_signal_new ("client-connected",
                               GDM_TYPE_SESSION,
diff --git a/daemon/gdm-session.h b/daemon/gdm-session.h
index 69cf8f8..a337824 100644
--- a/daemon/gdm-session.h
+++ b/daemon/gdm-session.h
@@ -77,7 +77,6 @@ typedef struct
                                                     const char   *service_name,
                                                     gboolean      client_is_ready);
 
-        void (* cancelled)                   (GdmSession   *session);
         void (* client_connected)            (GdmSession   *session);
         void (* client_disconnected)         (GdmSession   *session);
         void (* disconnected)                (GdmSession   *session);
@@ -152,7 +151,6 @@ void              gdm_session_set_environment_variable    (GdmSession *session,
 void              gdm_session_send_environment            (GdmSession *self,
                                                            const char *service_name);
 void              gdm_session_reset                       (GdmSession *session);
-void              gdm_session_cancel                      (GdmSession *session);
 void              gdm_session_authenticate                (GdmSession *session,
                                                            const char *service_name);
 void              gdm_session_authorize                   (GdmSession *session,
@@ -176,6 +174,7 @@ void              gdm_session_select_session              (GdmSession *session,
                                                            const char *session_name);
 void              gdm_session_select_user                 (GdmSession *session,
                                                            const char *username);
+void              gdm_session_reset                       (GdmSession *session);
 void              gdm_session_request_timed_login         (GdmSession *session,
                                                            const char *username,
                                                            int         delay);


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