[gdm] drop consolekit support



commit 1ac67f522f5690c27023d98096ca817f12f7eb88
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jun 12 13:28:01 2015 -0400

    drop consolekit support
    
    It was deprecated in 3.16 to be removed in 3.18
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743940

 common/gdm-common.c                 |  304 ---------------------------------
 configure.ac                        |   38 ----
 daemon/Makefile.am                  |   10 -
 daemon/gdm-launch-environment.c     |    3 -
 daemon/gdm-local-display-factory.c  |   11 +-
 daemon/gdm-manager.c                |  317 -----------------------------------
 daemon/gdm-server.c                 |   38 ----
 daemon/gdm-session-worker.c         |  233 -------------------------
 data/pam-redhat/gdm-autologin.pam   |    1 -
 data/pam-redhat/gdm-fingerprint.pam |    1 -
 data/pam-redhat/gdm-password.pam    |    1 -
 data/pam-redhat/gdm-pin.pam         |    1 -
 data/pam-redhat/gdm-smartcard.pam   |    1 -
 libgdm/gdm-user-switching.c         |  308 ----------------------------------
 14 files changed, 1 insertions(+), 1266 deletions(-)
---
diff --git a/common/gdm-common.c b/common/gdm-common.c
index effd4bc..b4f98f1 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -47,17 +47,6 @@
 #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH      "/org/gnome/DisplayManager/LocalDisplayFactory"
 #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_INTERFACE "org.gnome.DisplayManager.LocalDisplayFactory"
 
-#ifdef WITH_CONSOLE_KIT
-#define CK_NAME      "org.freedesktop.ConsoleKit"
-#define CK_PATH      "/org/freedesktop/ConsoleKit"
-#define CK_INTERFACE "org.freedesktop.ConsoleKit"
-
-#define CK_MANAGER_PATH      "/org/freedesktop/ConsoleKit/Manager"
-#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager"
-#define CK_SEAT_INTERFACE    "org.freedesktop.ConsoleKit.Seat"
-#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
-#endif
-
 G_DEFINE_QUARK (gdm-common-error, gdm_common_error);
 
 const char *
@@ -356,295 +345,6 @@ create_transient_display (GDBusConnection *connection,
         return TRUE;
 }
 
-#ifdef WITH_CONSOLE_KIT
-
-static gboolean
-get_current_session_id (GDBusConnection  *connection,
-                        char            **session_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             CK_MANAGER_PATH,
-                                             CK_MANAGER_INTERFACE,
-                                             "GetCurrentSession",
-                                             NULL, /* parameters */
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine session: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(o)", session_id);
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static gboolean
-get_seat_id_for_session (GDBusConnection  *connection,
-                         const char       *session_id,
-                         char            **seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             session_id,
-                                             CK_SESSION_INTERFACE,
-                                             "GetSeatId",
-                                             NULL, /* parameters */
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine seat: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(o)", seat_id);
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static char *
-get_current_seat_id (GDBusConnection *connection)
-{
-        gboolean res;
-        char    *session_id;
-        char    *seat_id;
-
-        session_id = NULL;
-        seat_id = NULL;
-
-        res = get_current_session_id (connection, &session_id);
-        if (res) {
-                res = get_seat_id_for_session (connection, session_id, &seat_id);
-        }
-        g_free (session_id);
-
-        return seat_id;
-}
-
-static gboolean
-activate_session_id_for_ck (GDBusConnection *connection,
-                            const char      *seat_id,
-                            const char      *session_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "ActivateSession",
-                                             g_variant_new ("(o)", session_id),
-                                             NULL,
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to activate session: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static gboolean
-session_is_login_window (GDBusConnection *connection,
-                         const char      *session_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        const char *value;
-        gboolean ret;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             session_id,
-                                             CK_SESSION_INTERFACE,
-                                             "GetSessionType",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(s)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine session type: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(&s)", &value);
-
-        if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) {
-                ret = FALSE;
-        } else {
-                ret = TRUE;
-        }
-
-        g_variant_unref (reply);
-
-        return ret;
-}
-
-static gboolean
-seat_can_activate_sessions (GDBusConnection *connection,
-                            const char      *seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        gboolean ret;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "CanActivateSessions",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(b)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine if can activate sessions: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(b)", &ret);
-        g_variant_unref (reply);
-
-        return ret;
-}
-
-static const char **
-seat_get_sessions (GDBusConnection *connection,
-                   const char      *seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        const char **value;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "GetSessions",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(ao)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to list sessions: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(^ao)", &value);
-        g_variant_unref (reply);
-
-        return value;
-}
-
-static gboolean
-get_login_window_session_id_for_ck (GDBusConnection  *connection,
-                                    const char       *seat_id,
-                                    char            **session_id)
-{
-        gboolean     can_activate_sessions;
-        const char **sessions;
-        int          i;
-
-        *session_id = NULL;
-        sessions = NULL;
-
-        g_debug ("checking if seat can activate sessions");
-
-        can_activate_sessions = seat_can_activate_sessions (connection, seat_id);
-        if (! can_activate_sessions) {
-                g_debug ("seat is unable to activate sessions");
-                return FALSE;
-        }
-
-        sessions = seat_get_sessions (connection, seat_id);
-        for (i = 0; sessions [i] != NULL; i++) {
-                const char *ssid;
-
-                ssid = sessions [i];
-
-                if (session_is_login_window (connection, ssid)) {
-                        *session_id = g_strdup (ssid);
-                        break;
-                }
-        }
-        g_free (sessions);
-
-        return TRUE;
-}
-
-static gboolean
-goto_login_session_for_ck (GDBusConnection  *connection,
-                           GError          **error)
-{
-        gboolean        ret;
-        gboolean        res;
-        char           *session_id;
-        char           *seat_id;
-
-        ret = FALSE;
-
-        /* First look for any existing LoginWindow sessions on the seat.
-           If none are found, create a new one. */
-
-        seat_id = get_current_seat_id (connection);
-        if (seat_id == NULL || seat_id[0] == '\0') {
-                g_debug ("seat id is not set; can't switch sessions");
-                g_set_error (error, GDM_COMMON_ERROR, 0, _("Could not identify the current session."));
-
-                return FALSE;
-        }
-
-        res = get_login_window_session_id_for_ck (connection, seat_id, &session_id);
-        if (! res) {
-                g_set_error (error, GDM_COMMON_ERROR, 1, _("User unable to switch sessions."));
-                return FALSE;
-        }
-
-        if (session_id != NULL) {
-                res = activate_session_id_for_ck (connection, seat_id, session_id);
-                if (res) {
-                        ret = TRUE;
-                }
-        }
-
-        if (! ret && g_strcmp0 (seat_id, "/org/freedesktop/ConsoleKit/Seat1") == 0) {
-                res = create_transient_display (connection, error);
-                if (res) {
-                        ret = TRUE;
-                }
-        }
-
-        return ret;
-}
-#endif
-
 #ifdef WITH_SYSTEMD
 
 static gboolean
@@ -844,11 +544,7 @@ gdm_goto_login_session (GError **error)
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return goto_login_session_for_ck (connection, error);
-#else
         return FALSE;
-#endif
 }
 
 static void
diff --git a/configure.ac b/configure.ac
index 01807a8..80d92aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -244,10 +244,6 @@ AC_ARG_WITH(tcp-wrappers,
                            [Use TCP Wrappers @<:@default=auto@:>@]),,
             with_tcp_wrappers=auto)
 
-AC_ARG_WITH(console-kit,
-            AS_HELP_STRING([--with-console-kit],
-                           [Add ConsoleKit support @<:@default=auto@:>@]),,
-            with_console_kit=no)
 
 AC_ARG_WITH(systemd,
             AS_HELP_STRING([--with-systemd],
@@ -878,18 +874,6 @@ AC_SUBST(XINERAMA_LIBS)
 CPPFLAGS="$xinerama_save_cppflags"
 
 dnl ---------------------------------------------------------------------------
-dnl - Check for ConsoleKit support
-dnl ---------------------------------------------------------------------------
-
-use_console_kit=no
-if test "x$with_console_kit" != "xno" ; then
-       use_console_kit=yes
-       AC_DEFINE(WITH_CONSOLE_KIT, 1, [Define to enable ConsoleKit support])
-fi
-AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes)
-AC_SUBST(WITH_CONSOLE_KIT)
-
-dnl ---------------------------------------------------------------------------
 dnl - Check for systemd support
 dnl ---------------------------------------------------------------------------
 
@@ -1121,14 +1105,6 @@ fi
 AC_SUBST(GDM_CUSTOM_CONF)
 AC_SUBST(GDM_OLD_CONF, '${gdmconfdir}/gdm.conf')
 
-AC_ARG_WITH(consolekit-directory,
-              [AC_HELP_STRING([--with-consolekit-directory],
-                              [Specify the directory of ck-get-x11-display-device 
@<:@default=libexecdir@:>@])],,
-                              [with_consolekit_directory="\${libexecdir}"])
-
-CONSOLEKIT_DIR=$with_consolekit_directory
-AC_SUBST(CONSOLEKIT_DIR)
-
 AC_ARG_WITH(gnome-settings-daemon-directory,
               [AC_HELP_STRING([--with-gnome-settings-daemon-directory],
                               [Specify the directory of gnome-settings-daemon used by the chooser 
@<:@default=libexecdir@:>@])],,
@@ -1610,7 +1586,6 @@ echo "
         dmconfdir:                ${dmconfdir}
         localstatedir:            ${localstatedir}
         datadir:                  ${datadir}
-       consolekit location:      ${with_consolekit_directory}
        gnome-settings-daemon location: ${with_gnome_settings_daemon_directory}
        gnome-session-check-accel location: ${with_check_accelerated_directory}
        source code location:     ${srcdir}
@@ -1640,7 +1615,6 @@ echo \
 "        Xinerama support:         ${XINERAMA_SUPPORT}
         XDMCP support:            ${XDMCP_SUPPORT}
         SELinux support:          ${use_selinux}
-        ConsoleKit support:       ${use_console_kit}
         systemd support:          ${use_systemd}
         systemd unit dir:         ${with_systemdsystemunitdir}
         plymouth support:         ${use_plymouth}
@@ -1650,15 +1624,3 @@ echo \
         Enable documentation:     ${enable_documentation}
         Install GDM's Xsession:   ${enable_gdm_xsession}
 "
-
-if test x"${use_console_kit}" = x"yes"; then
-        echo \
-"       WARNING:
-        ConsoleKit support is deprecated and is going to be removed before
-        the next major release.  More details, and patches to add back in
-        ConsoleKit support can be found here:
-
-                https://wiki.gnome.org/Projects/ConsoleKit
-"
-fi
-
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index e3cf73a..ab5dda0 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -20,7 +20,6 @@ AM_CPPFLAGS = \
        -DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\"          \
        -DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\"        \
        -DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \
-       -DCONSOLEKIT_DIR=\"$(CONSOLEKIT_DIR)\" \
        $(DISABLE_DEPRECATED_CFLAGS)                    \
        $(DAEMON_CFLAGS)                                \
        $(XLIB_CFLAGS)                                  \
@@ -265,11 +264,6 @@ EXTRA_gdm_SOURCES =        \
        $(XDMCP_SOURCES)        \
        $(NULL)
 
-CONSOLE_KIT_SOURCES =          \
-       $(NULL)
-
-EXTRA_gdm_SOURCES += $(CONSOLE_KIT_SOURCES)
-
 gdm_LDADD = \
        $(top_builddir)/common/libgdmcommon.la  \
        $(XLIB_LIBS)                            \
@@ -281,10 +275,6 @@ gdm_LDADD = \
        $(EXTRA_DAEMON_LIBS)                    \
        $(NULL)
 
-if WITH_CONSOLE_KIT
-gdm_SOURCES += $(CONSOLE_KIT_SOURCES)
-endif
-
 CLEANFILES =                                   \
        gdm-display-glue.c                      \
        gdm-local-display-factory-glue.c        \
diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c
index aaf7834..6930135 100644
--- a/daemon/gdm-launch-environment.c
+++ b/daemon/gdm-launch-environment.c
@@ -282,9 +282,6 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment,
                 char *seat_id;
 
                 seat_id = launch_environment->priv->x11_display_seat_id;
-                if (g_str_has_prefix (seat_id, "/org/freedesktop/ConsoleKit/")) {
-                        seat_id += strlen ("/org/freedesktop/ConsoleKit/");
-                }
 
                 g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id));
         }
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index af15617..a048b08 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -42,7 +42,6 @@
 
 #define GDM_LOCAL_DISPLAY_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
GDM_TYPE_LOCAL_DISPLAY_FACTORY, GdmLocalDisplayFactoryPrivate))
 
-#define CK_SEAT1_PATH                       "/org/freedesktop/ConsoleKit/Seat1"
 #define SYSTEMD_SEAT0_PATH                  "seat0"
 
 #define GDM_DBUS_PATH                       "/org/gnome/DisplayManager"
@@ -206,10 +205,6 @@ get_seat_of_transient_display (GdmLocalDisplayFactory *factory)
         }
 #endif
 
-        if (seat_id == NULL) {
-                seat_id = CK_SEAT1_PATH;
-        }
-
         return seat_id;
 }
 
@@ -575,7 +570,6 @@ static gboolean
 gdm_local_display_factory_start (GdmDisplayFactory *base_factory)
 {
         GdmLocalDisplayFactory *factory = GDM_LOCAL_DISPLAY_FACTORY (base_factory);
-        GdmDisplay             *display;
 
         g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
 
@@ -586,10 +580,7 @@ gdm_local_display_factory_start (GdmDisplayFactory *base_factory)
         }
 #endif
 
-        /* On ConsoleKit just create Seat1, and that's it. */
-        display = create_display (factory, CK_SEAT1_PATH, NULL, TRUE);
-
-        return display != NULL;
+        return FALSE;
 }
 
 static gboolean
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 5e496f7..6a62d18 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -59,15 +59,6 @@
 #define GDM_MANAGER_PATH          GDM_DBUS_PATH "/Manager"
 #define GDM_MANAGER_DISPLAYS_PATH GDM_DBUS_PATH "/Displays"
 
-#define CK_NAME      "org.freedesktop.ConsoleKit"
-#define CK_PATH      "/org/freedesktop/ConsoleKit"
-#define CK_INTERFACE "org.freedesktop.ConsoleKit"
-
-#define CK_MANAGER_PATH      "/org/freedesktop/ConsoleKit/Manager"
-#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager"
-#define CK_SEAT_INTERFACE    "org.freedesktop.ConsoleKit.Seat"
-#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
-
 #define INITIAL_SETUP_USERNAME "gnome-initial-setup"
 
 typedef struct
@@ -243,36 +234,6 @@ get_session_id_for_pid_systemd (pid_t    pid,
 }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-static char *
-get_session_id_for_pid_consolekit (GDBusConnection  *connection,
-                                   pid_t             pid,
-                                   GError          **error)
-{
-        GVariant *reply;
-        char *retval;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             "org.freedesktop.ConsoleKit",
-                                             "/org/freedesktop/ConsoleKit/Manager",
-                                             "org.freedesktop.ConsoleKit.Manager",
-                                             "GetSessionForUnixProcess",
-                                             g_variant_new ("(u)", pid),
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, error);
-        if (reply == NULL) {
-                return NULL;
-        }
-
-        g_variant_get (reply, "(o)", &retval);
-        g_variant_unref (reply);
-
-        return retval;
-}
-#endif
-
 static char *
 get_session_id_for_pid (GDBusConnection  *connection,
                         pid_t             pid,
@@ -284,10 +245,6 @@ get_session_id_for_pid (GDBusConnection  *connection,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return get_session_id_for_pid_consolekit (connection, pid, error);
-#endif
-
         return NULL;
 }
 
@@ -314,40 +271,6 @@ get_uid_for_systemd_session_id (const char  *session_id,
 }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-get_uid_for_consolekit_session_id (GDBusConnection  *connection,
-                                   const char       *session_id,
-                                   uid_t            *out_uid,
-                                   GError          **error)
-{
-        GVariant *reply;
-        guint32 uid;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             "org.freedesktop.ConsoleKit",
-                                             session_id,
-                                             "org.freedesktop.ConsoleKit.Session",
-                                             "GetUnixUser",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(u)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             error);
-        if (reply == NULL) {
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(u)", &uid);
-        g_variant_unref (reply);
-
-        *out_uid = (uid_t) uid;
-
-        return TRUE;
-}
-#endif
-
 static gboolean
 get_uid_for_session_id (GDBusConnection  *connection,
                         const char       *session_id,
@@ -360,10 +283,6 @@ get_uid_for_session_id (GDBusConnection  *connection,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return get_uid_for_consolekit_session_id (connection, session_id, uid, error);
-#endif
-
         return FALSE;
 }
 
@@ -379,45 +298,6 @@ lookup_by_session_id (const char *id,
         return g_strcmp0 (current, looking_for) == 0;
 }
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-is_consolekit_login_session (GdmManager       *self,
-                             GDBusConnection  *connection,
-                             const char       *session_id,
-                             GError          **error)
-{
-        GVariant *reply;
-        char *session_type = NULL;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             "org.freedesktop.ConsoleKit",
-                                             session_id,
-                                             "org.freedesktop.ConsoleKit.Session",
-                                             "GetSessionType",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(s)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             error);
-        if (reply == NULL) {
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(s)", &session_type);
-        g_variant_unref (reply);
-
-        if (g_strcmp0 (session_type, "LoginWindow") != 0) {
-                g_free (session_type);
-
-                return FALSE;
-        }
-
-        g_free (session_type);
-        return TRUE;
-}
-#endif
-
 #ifdef WITH_SYSTEMD
 static gboolean
 is_systemd_login_session (GdmManager  *self,
@@ -461,10 +341,6 @@ is_login_session (GdmManager       *self,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return is_consolekit_login_session (self, connection, session_id, error);
-#endif
-
         return FALSE;
 }
 
@@ -501,46 +377,6 @@ activate_session_id_for_systemd (GdmManager   *manager,
 }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-activate_session_id_for_ck (GdmManager *manager,
-                            const char *seat_id,
-                            const char *session_id)
-{
-        GError *error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (manager->priv->connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             "org.freedesktop.ConsoleKit.Seat",
-                                             "ActivateSession",
-                                             g_variant_new ("(o)", session_id),
-                                             NULL, /* expected reply */
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             &error);
-        if (reply == NULL) {
-                g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n",
-                         g_dbus_error_get_remote_error (error), error->message);
-                g_error_free (error);
-
-                /* It is very likely that the "error" just reported is
-                 * that the session is already active.  Unfortunately,
-                 * ConsoleKit doesn't use proper error codes and it
-                 * translates the error message, so we have no real way
-                 * to detect this case...
-                 */
-                return TRUE;
-        }
-
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-#endif
-
 static gboolean
 activate_session_id (GdmManager *manager,
                      const char *seat_id,
@@ -553,11 +389,7 @@ activate_session_id (GdmManager *manager,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return activate_session_id_for_ck (manager, seat_id, session_id);
-#else
         return FALSE;
-#endif
 }
 
 #ifdef WITH_SYSTEMD
@@ -592,38 +424,6 @@ session_unlock_for_systemd (GdmManager *manager,
 }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-session_unlock_for_ck (GdmManager *manager,
-                       const char *ssid)
-{
-        GError *error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (manager->priv->connection,
-                                             CK_NAME,
-                                             ssid,
-                                             CK_SESSION_INTERFACE,
-                                             "Unlock",
-                                             NULL, /* parameters */
-                                             NULL, /* expected reply */
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             &error);
-        if (reply == NULL) {
-                g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n",
-                         g_dbus_error_get_remote_error (error), error->message);
-                g_error_free (error);
-                return FALSE;
-        }
-
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-#endif
-
 static gboolean
 session_unlock (GdmManager *manager,
                 const char *ssid)
@@ -637,11 +437,7 @@ session_unlock (GdmManager *manager,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return session_unlock_for_ck (manager, ssid);
-#else
         return TRUE;
-#endif
 }
 
 static GdmSession *
@@ -674,38 +470,6 @@ find_session_for_user_on_seat (GdmManager *manager,
         return NULL;
 }
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-is_consolekit_remote_session (GdmManager       *self,
-                             GDBusConnection  *connection,
-                             const char       *session_id,
-                             GError          **error)
-{
-        GVariant *reply;
-        gboolean is_remote;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             "org.freedesktop.ConsoleKit",
-                                             session_id,
-                                             "org.freedesktop.ConsoleKit.Session",
-                                             "IsLocal",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(b)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             error);
-        if (reply == NULL) {
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(b)", &is_remote);
-        g_variant_unref (reply);
-
-        return is_remote;
-}
-#endif
-
 #ifdef WITH_SYSTEMD
 static gboolean
 is_systemd_remote_session (GdmManager  *self,
@@ -750,10 +514,6 @@ is_remote_session (GdmManager       *self,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return is_consolekit_remote_session (self, connection, session_id, error);
-#endif
-
         return FALSE;
 }
 
@@ -787,37 +547,6 @@ get_seat_id_for_systemd_session_id (const char  *session_id,
 }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-static char *
-get_seat_id_for_consolekit_session_id (GDBusConnection  *connection,
-                                       const char       *session_id,
-                                       GError          **error)
-{
-        GVariant *reply;
-        char *retval;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             "org.freedesktop.ConsoleKit",
-                                             session_id,
-                                             "org.freedesktop.ConsoleKit.Session",
-                                             "GetSeatId",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             error);
-        if (reply == NULL) {
-                return NULL;
-        }
-
-        g_variant_get (reply, "(o)", &retval);
-        g_variant_unref (reply);
-
-        return retval;
-}
-#endif
-
 static char *
 get_seat_id_for_session_id (GDBusConnection  *connection,
                             const char       *session_id,
@@ -829,10 +558,6 @@ get_seat_id_for_session_id (GDBusConnection  *connection,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        return get_seat_id_for_consolekit_session_id (connection, session_id, error);
-#endif
-
         return NULL;
 }
 
@@ -2156,46 +1881,6 @@ on_user_session_died (GdmSession *session,
 }
 
 static char *
-query_ck_for_display_device (GdmManager *manager,
-                             GdmDisplay *display)
-{
-        char    *out;
-        char    *command;
-        char    *display_name = NULL;
-        int      status;
-        gboolean res;
-        GError  *error;
-
-        g_object_get (G_OBJECT (display),
-                      "x11-display-name", &display_name,
-                      NULL);
-
-        error = NULL;
-        command = g_strdup_printf (CONSOLEKIT_DIR "/ck-get-x11-display-device --display %s",
-                                   display_name);
-        g_free (display_name);
-
-        g_debug ("GdmManager: Running helper %s", command);
-        out = NULL;
-        res = g_spawn_command_line_sync (command,
-                                         &out,
-                                         NULL,
-                                         &status,
-                                         &error);
-        if (! res) {
-                g_warning ("GdmManager: Could not run helper %s: %s", command, error->message);
-                g_error_free (error);
-        } else {
-                out = g_strstrip (out);
-                g_debug ("GdmManager: Got tty: '%s'", out);
-        }
-
-        g_free (command);
-
-        return out;
-}
-
-static char *
 get_display_device (GdmManager *manager,
                     GdmDisplay *display)
 {
@@ -2205,8 +1890,6 @@ get_display_device (GdmManager *manager,
                 return NULL;
         }
 #endif
-
-        return query_ck_for_display_device (manager, display);
 }
 
 static void
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index bacc080..b0376d9 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -124,41 +124,6 @@ static void     gdm_server_finalize     (GObject        *object);
 
 G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT)
 
-static char *
-_gdm_server_query_ck_for_display_device (GdmServer *server)
-{
-        char    *out;
-        char    *command;
-        int      status;
-        gboolean res;
-        GError  *error;
-
-        g_return_val_if_fail (GDM_IS_SERVER (server), NULL);
-
-        error = NULL;
-        command = g_strdup_printf (CONSOLEKIT_DIR "/ck-get-x11-display-device --display %s",
-                                   server->priv->display_name);
-
-        g_debug ("GdmServer: Running helper %s", command);
-        out = NULL;
-        res = g_spawn_command_line_sync (command,
-                                         &out,
-                                         NULL,
-                                         &status,
-                                         &error);
-        if (! res) {
-                g_warning ("Could not run helper: %s", error->message);
-                g_error_free (error);
-        } else {
-                out = g_strstrip (out);
-                g_debug ("GdmServer: Got tty: '%s'", out);
-        }
-
-        g_free (command);
-
-        return out;
-}
-
 char *
 gdm_server_get_display_device (GdmServer *server)
 {
@@ -170,9 +135,6 @@ gdm_server_get_display_device (GdmServer *server)
 #endif
 
         if (server->priv->display_device == NULL) {
-                server->priv->display_device =
-                    _gdm_server_query_ck_for_display_device (server);
-
                 g_object_notify (G_OBJECT (server), "display-device");
         }
 
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 1bcca14..5f49e88 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -135,10 +135,6 @@ struct GdmSessionWorkerPrivate
 
         int               exit_code;
 
-#ifdef WITH_CONSOLE_KIT
-        char             *session_cookie;
-#endif
-
         pam_handle_t     *pam_handle;
 
         GPid              child_pid;
@@ -216,204 +212,6 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker,
                          G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_WORKER,
                                                 worker_interface_init))
 
-#ifdef WITH_CONSOLE_KIT
-static gboolean
-open_ck_session (GdmSessionWorker  *worker)
-{
-        GDBusConnection  *system_bus;
-        GVariantBuilder   builder;
-        GVariant         *parameters;
-        GVariant         *in_args;
-        struct passwd    *pwent;
-        GVariant         *reply;
-        GError           *error = NULL;
-        const char       *display_name;
-        const char       *display_device;
-        const char       *display_hostname;
-        const char       *session_type;
-        gint32            uid;
-
-        g_assert (worker->priv->session_cookie == NULL);
-
-        if (worker->priv->x11_display_name != NULL) {
-                display_name = worker->priv->x11_display_name;
-        } else {
-                display_name = "";
-        }
-        if (worker->priv->hostname != NULL) {
-                display_hostname = worker->priv->hostname;
-        } else {
-                display_hostname = "";
-        }
-        if (worker->priv->display_device != NULL) {
-                display_device = worker->priv->display_device;
-        } else {
-                display_device = "";
-        }
-
-        if (worker->priv->session_type != NULL) {
-                session_type = worker->priv->session_type;
-        } else {
-                session_type = "";
-        }
-
-        g_assert (worker->priv->username != NULL);
-
-        gdm_get_pwent_for_name (worker->priv->username, &pwent);
-        if (pwent == NULL) {
-                goto out;
-        }
-
-        uid = (gint32) pwent->pw_uid;
-
-        error = NULL;
-        system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
-
-        if (system_bus == NULL) {
-                g_warning ("Couldn't create connection to system bus: %s",
-                           error->message);
-
-                g_error_free (error);
-                goto out;
-        }
-
-        g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sv)"));
-        g_variant_builder_add_parsed (&builder, "('unix-user', <%i>)", uid);
-        g_variant_builder_add_parsed (&builder, "('x11-display-device', <%s>)", display_device);
-        g_variant_builder_add_parsed (&builder, "('x11-display', <%s>)", display_name);
-        g_variant_builder_add_parsed (&builder, "('remote-host-name', <%s>)", display_hostname);
-        g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", worker->priv->display_is_local);
-        g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", session_type);
-
-        parameters = g_variant_builder_end (&builder);
-        in_args = g_variant_new_tuple (&parameters, 1);
-
-        reply = g_dbus_connection_call_sync (system_bus,
-                                             "org.freedesktop.ConsoleKit",
-                                             "/org/freedesktop/ConsoleKit/Manager",
-                                             "org.freedesktop.ConsoleKit.Manager",
-                                             "OpenSessionWithParameters",
-                                             in_args,
-                                             G_VARIANT_TYPE ("(s)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             &error);
-
-        if (! reply) {
-                g_warning ("%s\n", error->message);
-                g_clear_error (&error);
-                goto out;
-        }
-
-        g_variant_get (reply, "(s)", &worker->priv->session_cookie);
-
-        g_variant_unref (reply);
-
-out:
-        return worker->priv->session_cookie != NULL;
-}
-
-static void
-close_ck_session (GdmSessionWorker *worker)
-{
-        GDBusConnection  *system_bus;
-        GVariant         *reply;
-        GError           *error = NULL;
-        gboolean          was_closed;
-
-        if (worker->priv->session_cookie == NULL) {
-                return;
-        }
-
-        error = NULL;
-        system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
-
-        if (system_bus == NULL) {
-                g_warning ("Couldn't create connection to system bus: %s",
-                           error->message);
-
-                g_error_free (error);
-                goto out;
-        }
-
-        reply = g_dbus_connection_call_sync (system_bus,
-                                             "org.freedesktop.ConsoleKit",
-                                             "/org/freedesktop/ConsoleKit/Manager",
-                                             "org.freedesktop.ConsoleKit.Manager",
-                                             "CloseSession",
-                                             g_variant_new ("(s)", worker->priv->session_cookie),
-                                             G_VARIANT_TYPE ("(b)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             &error);
-
-        if (! reply) {
-                g_warning ("%s", error->message);
-                g_clear_error (&error);
-                goto out;
-        }
-
-        g_variant_get (reply, "(b)", &was_closed);
-
-        if (!was_closed) {
-                g_warning ("Unable to close ConsoleKit session");
-        }
-
-        g_variant_unref (reply);
-
-out:
-        g_clear_pointer (&worker->priv->session_cookie,
-                         (GDestroyNotify) g_free);
-}
-
-static char *
-get_ck_session_id (GdmSessionWorker *worker)
-{
-        GDBusConnection  *system_bus;
-        GVariant         *reply;
-        GError           *error = NULL;
-        char             *session_id = NULL;
-
-        error = NULL;
-        system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
-
-        if (system_bus == NULL) {
-                g_warning ("Couldn't create connection to system bus: %s",
-                           error->message);
-
-                g_error_free (error);
-                goto out;
-        }
-
-        reply = g_dbus_connection_call_sync (system_bus,
-                                             "org.freedesktop.ConsoleKit",
-                                             "/org/freedesktop/ConsoleKit/Manager",
-                                             "org.freedesktop.ConsoleKit.Manager",
-                                             "GetSessionForCookie",
-                                             g_variant_new ("(s)", worker->priv->session_cookie),
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL,
-                                             &error);
-
-        if (reply == NULL) {
-                g_warning ("%s", error->message);
-                g_clear_error (&error);
-                goto out;
-        }
-
-        g_variant_get (reply, "(o)", &session_id);
-
-        g_variant_unref (reply);
-
-out:
-        return session_id;
-}
-#endif
-
 /* adapted from glib script_execute */
 static void
 script_execute (const gchar *file,
@@ -1684,26 +1482,6 @@ gdm_session_worker_get_environment (GdmSessionWorker *worker)
         return (const char * const *) pam_getenvlist (worker->priv->pam_handle);
 }
 
-#ifdef WITH_CONSOLE_KIT
-static void
-register_ck_session (GdmSessionWorker *worker)
-{
-#ifdef WITH_SYSTEMD
-        if (LOGIND_RUNNING()) {
-                return;
-        }
-#endif
-
-        open_ck_session (worker);
-
-        if (worker->priv->session_cookie != NULL) {
-                gdm_session_worker_set_environment_variable (worker,
-                                                             "XDG_SESSION_COOKIE",
-                                                             worker->priv->session_cookie);
-        }
-}
-#endif
-
 static gboolean
 run_script (GdmSessionWorker *worker,
             const char       *dir)
@@ -1734,9 +1512,6 @@ session_worker_child_watch (GPid              pid,
                  : WIFSIGNALED (status) ? WTERMSIG (status)
                  : -1);
 
-#ifdef WITH_CONSOLE_KIT
-        close_ck_session (worker);
-#endif
 
         gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS);
 
@@ -2328,14 +2103,6 @@ gdm_session_worker_open_session (GdmSessionWorker  *worker,
          */
         run_script (worker, GDMCONFDIR "/PreSession");
 
-#ifdef WITH_CONSOLE_KIT
-        register_ck_session (worker);
-
-        if (session_id == NULL) {
-                session_id = get_ck_session_id (worker);
-        }
-#endif
-
         if (session_id != NULL) {
                 g_free (worker->priv->session_id);
                 worker->priv->session_id = session_id;
diff --git a/data/pam-redhat/gdm-autologin.pam b/data/pam-redhat/gdm-autologin.pam
index 0616e66..96fcfe3 100644
--- a/data/pam-redhat/gdm-autologin.pam
+++ b/data/pam-redhat/gdm-autologin.pam
@@ -8,7 +8,6 @@ password   include     system-auth
 session    required    pam_selinux.so close
 session    required    pam_loginuid.so
 session    optional    pam_console.so
--session    optional    pam_ck_connector.so
 session    required    pam_selinux.so open
 session    optional    pam_keyinit.so force revoke
 session    required    pam_namespace.so
diff --git a/data/pam-redhat/gdm-fingerprint.pam b/data/pam-redhat/gdm-fingerprint.pam
index c5a3598..1483cdf 100644
--- a/data/pam-redhat/gdm-fingerprint.pam
+++ b/data/pam-redhat/gdm-fingerprint.pam
@@ -9,7 +9,6 @@ password    include       fingerprint-auth
 session     required      pam_selinux.so close
 session     required      pam_loginuid.so
 session     optional      pam_console.so
--session    optional    pam_ck_connector.so
 session     required      pam_selinux.so open
 session     optional      pam_keyinit.so force revoke
 session     required      pam_namespace.so
diff --git a/data/pam-redhat/gdm-password.pam b/data/pam-redhat/gdm-password.pam
index 3006d0c..21c04ec 100644
--- a/data/pam-redhat/gdm-password.pam
+++ b/data/pam-redhat/gdm-password.pam
@@ -12,7 +12,6 @@ password    substack       password-auth
 session     required      pam_selinux.so close
 session     required      pam_loginuid.so
 session     optional      pam_console.so
--session    optional    pam_ck_connector.so
 session     required      pam_selinux.so open
 session     optional      pam_keyinit.so force revoke
 session     required      pam_namespace.so
diff --git a/data/pam-redhat/gdm-pin.pam b/data/pam-redhat/gdm-pin.pam
index 7594653..6ec7707 100644
--- a/data/pam-redhat/gdm-pin.pam
+++ b/data/pam-redhat/gdm-pin.pam
@@ -13,7 +13,6 @@ password    optional      pam_pin.so
 session     required      pam_selinux.so close
 session     required      pam_loginuid.so
 session     optional      pam_console.so
--session    optional    pam_ck_connector.so
 session     required      pam_selinux.so open
 session     optional      pam_keyinit.so force revoke
 session     required      pam_namespace.so
diff --git a/data/pam-redhat/gdm-smartcard.pam b/data/pam-redhat/gdm-smartcard.pam
index c91cf0d..5024e52 100644
--- a/data/pam-redhat/gdm-smartcard.pam
+++ b/data/pam-redhat/gdm-smartcard.pam
@@ -9,7 +9,6 @@ password    include       smartcard-auth
 session     required      pam_selinux.so close
 session     required      pam_loginuid.so
 session     optional      pam_console.so
--session    optional    pam_ck_connector.so
 session     required      pam_selinux.so open
 session     optional      pam_keyinit.so force revoke
 session     required      pam_namespace.so
diff --git a/libgdm/gdm-user-switching.c b/libgdm/gdm-user-switching.c
index a195d05..760347f 100644
--- a/libgdm/gdm-user-switching.c
+++ b/libgdm/gdm-user-switching.c
@@ -39,17 +39,6 @@
 #include "gdm-user-switching.h"
 #include "gdm-client.h"
 
-#ifdef WITH_CONSOLE_KIT
-#define CK_NAME      "org.freedesktop.ConsoleKit"
-#define CK_PATH      "/org/freedesktop/ConsoleKit"
-#define CK_INTERFACE "org.freedesktop.ConsoleKit"
-
-#define CK_MANAGER_PATH      "/org/freedesktop/ConsoleKit/Manager"
-#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager"
-#define CK_SEAT_INTERFACE    "org.freedesktop.ConsoleKit.Seat"
-#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
-#endif
-
 static gboolean
 create_transient_display (GDBusConnection *connection,
                           GCancellable    *cancellable,
@@ -80,296 +69,6 @@ create_transient_display (GDBusConnection *connection,
         return TRUE;
 }
 
-#ifdef WITH_CONSOLE_KIT
-
-static gboolean
-get_current_session_id (GDBusConnection  *connection,
-                        char            **session_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             CK_MANAGER_PATH,
-                                             CK_MANAGER_INTERFACE,
-                                             "GetCurrentSession",
-                                             NULL, /* parameters */
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine session: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(o)", session_id);
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static gboolean
-get_seat_id_for_session (GDBusConnection  *connection,
-                         const char       *session_id,
-                         char            **seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             session_id,
-                                             CK_SESSION_INTERFACE,
-                                             "GetSeatId",
-                                             NULL, /* parameters */
-                                             G_VARIANT_TYPE ("(o)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine seat: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(o)", seat_id);
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static char *
-get_current_seat_id (GDBusConnection *connection)
-{
-        gboolean res;
-        char    *session_id;
-        char    *seat_id;
-
-        session_id = NULL;
-        seat_id = NULL;
-
-        res = get_current_session_id (connection, &session_id);
-        if (res) {
-                res = get_seat_id_for_session (connection, session_id, &seat_id);
-        }
-        g_free (session_id);
-
-        return seat_id;
-}
-
-static gboolean
-activate_session_id_for_ck (GDBusConnection *connection,
-                            GCancellable    *cancellable,
-                            const char      *seat_id,
-                            const char      *session_id,
-                            GError         **error)
-{
-        GVariant *reply;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "ActivateSession",
-                                             g_variant_new ("(o)", session_id),
-                                             NULL,
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, error);
-        if (reply == NULL) {
-                g_prefix_error (error, _("Unable to activate session: "));
-                return FALSE;
-        }
-
-        g_variant_unref (reply);
-
-        return TRUE;
-}
-
-static gboolean
-session_is_login_window (GDBusConnection *connection,
-                         const char      *session_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        const char *value;
-        gboolean ret;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             session_id,
-                                             CK_SESSION_INTERFACE,
-                                             "GetSessionType",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(s)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine session type: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(&s)", &value);
-
-        if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) {
-                ret = FALSE;
-        } else {
-                ret = TRUE;
-        }
-
-        g_variant_unref (reply);
-
-        return ret;
-}
-
-static gboolean
-seat_can_activate_sessions (GDBusConnection *connection,
-                            const char      *seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        gboolean ret;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "CanActivateSessions",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(b)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to determine if can activate sessions: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(b)", &ret);
-        g_variant_unref (reply);
-
-        return ret;
-}
-
-static const char **
-seat_get_sessions (GDBusConnection *connection,
-                   const char      *seat_id)
-{
-        GError *local_error = NULL;
-        GVariant *reply;
-        const char **value;
-
-        reply = g_dbus_connection_call_sync (connection,
-                                             CK_NAME,
-                                             seat_id,
-                                             CK_SEAT_INTERFACE,
-                                             "GetSessions",
-                                             NULL,
-                                             G_VARIANT_TYPE ("(ao)"),
-                                             G_DBUS_CALL_FLAGS_NONE,
-                                             -1,
-                                             NULL, &local_error);
-        if (reply == NULL) {
-                g_warning ("Unable to list sessions: %s", local_error->message);
-                g_error_free (local_error);
-                return FALSE;
-        }
-
-        g_variant_get (reply, "(^ao)", &value);
-        g_variant_unref (reply);
-
-        return value;
-}
-
-static gboolean
-get_login_window_session_id_for_ck (GDBusConnection  *connection,
-                                    const char       *seat_id,
-                                    char            **session_id)
-{
-        gboolean     can_activate_sessions;
-        const char **sessions;
-        int          i;
-
-        *session_id = NULL;
-        sessions = NULL;
-
-        g_debug ("checking if seat can activate sessions");
-
-        can_activate_sessions = seat_can_activate_sessions (connection, seat_id);
-        if (! can_activate_sessions) {
-                g_debug ("seat is unable to activate sessions");
-                return FALSE;
-        }
-
-        sessions = seat_get_sessions (connection, seat_id);
-        for (i = 0; sessions [i] != NULL; i++) {
-                const char *ssid;
-
-                ssid = sessions [i];
-
-                if (session_is_login_window (connection, ssid)) {
-                        *session_id = g_strdup (ssid);
-                        break;
-                }
-        }
-        g_free (sessions);
-
-        return TRUE;
-}
-
-static gboolean
-goto_login_session_for_ck (GDBusConnection  *connection,
-                           GCancellable     *cancellable,
-                           GError          **error)
-{
-        gboolean        ret;
-        gboolean        res;
-        char           *session_id;
-        char           *seat_id;
-
-        ret = FALSE;
-
-        /* First look for any existing LoginWindow sessions on the seat.
-           If none are found, create a new one. */
-
-        seat_id = get_current_seat_id (connection);
-        if (seat_id == NULL || seat_id[0] == '\0') {
-                g_debug ("seat id is not set; can't switch sessions");
-                g_set_error (error, GDM_CLIENT_ERROR, 0, _("Could not identify the current session."));
-
-                return FALSE;
-        }
-
-        res = get_login_window_session_id_for_ck (connection, seat_id, &session_id);
-        if (! res) {
-                g_set_error (error, GDM_CLIENT_ERROR, 0, _("User unable to switch sessions."));
-                return FALSE;
-        }
-
-        if (session_id != NULL) {
-                res = activate_session_id_for_ck (connection, cancellable, seat_id, session_id, error);
-                if (res) {
-                        ret = TRUE;
-                }
-        }
-
-        if (! ret && g_strcmp0 (seat_id, "/org/freedesktop/ConsoleKit/Seat1") == 0) {
-                res = create_transient_display (connection, cancellable, error);
-                if (res) {
-                        ret = TRUE;
-                }
-        }
-
-        return ret;
-}
-#endif
-
 #ifdef WITH_SYSTEMD
 
 static gboolean
@@ -588,12 +287,5 @@ gdm_goto_login_session_sync (GCancellable  *cancellable,
         }
 #endif
 
-#ifdef WITH_CONSOLE_KIT
-        retval = goto_login_session_for_ck (connection, cancellable, error);
-
-        g_object_unref (connection);
-        return retval;
-#else
         return FALSE;
-#endif
 }


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