[gdm/wip/wayland-rebase: 10/13] manager: Change code that activates / unlocks sessions to take GdmSession



commit ff217f22a6f43b42ef4e42f558c5f5a3ee1c1d31
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Feb 11 13:14:21 2014 -0500

    manager: Change code that activates / unlocks sessions to take GdmSession
    
    Additionally, change up the naming style so we have activate_session
    and unlock_session.

 daemon/gdm-manager.c |   45 ++++++++++++++++++++++++++++++---------------
 1 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 2f03248..a00e1ef 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -355,10 +355,19 @@ activate_session_id (GdmManager *manager,
 #endif
 }
 
+static gboolean
+activate_session (GdmManager *manager,
+                  GdmSession *session)
+{
+        return activate_session_id (manager,
+                                    gdm_session_get_display_seat_id (session),
+                                    gdm_session_get_session_id (session));
+}
+
 #ifdef WITH_SYSTEMD
 static gboolean
-session_unlock_for_systemd (GdmManager *manager,
-                            const char *ssid)
+unlock_session_id_for_systemd (GdmManager *manager,
+                               const char *session_id)
 {
         GError *error = NULL;
         GVariant *reply;
@@ -368,7 +377,7 @@ session_unlock_for_systemd (GdmManager *manager,
                                              "/org/freedesktop/login1",
                                              "org.freedesktop.login1.Manager",
                                              "UnlockSession",
-                                             g_variant_new ("(s)", ssid),
+                                             g_variant_new ("(s)", session_id),
                                              NULL, /* expected reply */
                                              G_DBUS_CALL_FLAGS_NONE,
                                              -1,
@@ -389,15 +398,15 @@ session_unlock_for_systemd (GdmManager *manager,
 
 #ifdef WITH_CONSOLE_KIT
 static gboolean
-session_unlock_for_ck (GdmManager *manager,
-                       const char *ssid)
+unlock_session_id_for_ck (GdmManager *manager,
+                          const char *session_id)
 {
         GError *error = NULL;
         GVariant *reply;
 
         reply = g_dbus_connection_call_sync (manager->priv->connection,
                                              CK_NAME,
-                                             ssid,
+                                             session_id,
                                              CK_SESSION_INTERFACE,
                                              "Unlock",
                                              NULL, /* parameters */
@@ -420,25 +429,32 @@ session_unlock_for_ck (GdmManager *manager,
 #endif
 
 static gboolean
-session_unlock (GdmManager *manager,
-                const char *ssid)
+unlock_session_id (GdmManager *manager,
+                   const char *session_id)
 {
-
-        g_debug ("Unlocking session %s", ssid);
+        g_debug ("Unlocking session %s", session_id);
 
 #ifdef WITH_SYSTEMD
         if (LOGIND_RUNNING()) {
-                return session_unlock_for_systemd (manager, ssid);
+                return unlock_session_id_for_systemd (manager, session_id);
         }
 #endif
 
 #ifdef WITH_CONSOLE_KIT
-        return session_unlock_for_ck (manager, ssid);
+        return unlock_session_id_for_ck (manager, session_id);
 #else
         return TRUE;
 #endif
 }
 
+static gboolean
+unlock_session (GdmManager *manager,
+                GdmSession *session)
+{
+        return unlock_session_id (manager,
+                                  gdm_session_get_session_id (session));
+}
+
 static GdmSession *
 find_session_for_user_on_seat (GdmManager *manager,
                                const char *username,
@@ -578,14 +594,13 @@ switch_to_compatible_user_session (GdmManager *manager,
         existing_session = find_session_for_user_on_seat (manager, username, seat_id, session);
 
         if (existing_session != NULL) {
-                ssid_to_activate = gdm_session_get_session_id (existing_session);
-                res = activate_session_id (manager, seat_id, ssid_to_activate);
+                res = activate_session (manager, existing_session);
                 if (! res) {
                         g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
                         goto out;
                 }
 
-                res = session_unlock (manager, ssid_to_activate);
+                res = unlock_session (manager, existing_session);
                 if (!res) {
                         /* this isn't fatal */
                         g_debug ("GdmManager: unable to unlock session: %s", ssid_to_activate);


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