[gdm/wip/wayland-rebase: 8/8] emancipation proclamation



commit 61e70e5b34f8f80a77ebd617e5892679851df3cc
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 6 18:55:06 2014 -0500

    emancipation proclamation

 daemon/Makefile.am                 |  120 +--------
 daemon/gdm-display.c               |  497 ++++-------------------------------
 daemon/gdm-display.h               |   58 +----
 daemon/gdm-display.xml             |    6 -
 daemon/gdm-manager.c               |  141 ++--------
 daemon/gdm-simple-slave.c          |   15 -
 daemon/gdm-simple-slave.h          |    1 -
 daemon/gdm-slave-job.c             |  478 ----------------------------------
 daemon/gdm-slave-job.h             |   65 -----
 daemon/gdm-slave.c                 |  367 +++++----------------------
 daemon/gdm-slave.h                 |   10 +-
 daemon/gdm-slave.xml               |   26 --
 daemon/gdm-xdmcp-chooser-display.c |   91 +------
 daemon/gdm-xdmcp-chooser-display.h |    1 -
 daemon/gdm-xdmcp-chooser-slave.c   |   58 ++---
 daemon/gdm-xdmcp-chooser-slave.h   |    1 -
 daemon/gdm-xdmcp-chooser-slave.xml |    8 -
 daemon/gdm-xdmcp-display-factory.c |   18 +-
 daemon/simple-slave-main.c         |  197 --------------
 daemon/xdmcp-chooser-slave-main.c  |  188 --------------
 20 files changed, 219 insertions(+), 2127 deletions(-)
---
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 218e799..0eb62a3 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -33,8 +33,6 @@ AM_CPPFLAGS = \
        $(NULL)
 
 BUILT_SOURCES =                                        \
-       gdm-slave-glue.h                        \
-       gdm-xdmcp-chooser-slave-glue.h          \
        gdm-display-glue.h                      \
        gdm-manager-glue.h                      \
        gdm-static-display-glue.h               \
@@ -100,20 +98,6 @@ gdm-session-worker-glue.c gdm-session-worker-glue.h : gdm-session-worker.xml Mak
                --generate-c-code=gdm-session-worker-glue               \
                $(srcdir)/gdm-session-worker.xml
 
-gdm-slave-glue.c gdm-slave-glue.h: gdm-slave.xml Makefile.am
-       $(AM_V_GEN)gdbus-codegen                                        \
-               --c-namespace=GdmDBus                                   \
-               --interface-prefix=org.gnome.DisplayManager             \
-               --generate-c-code=gdm-slave-glue                        \
-               $(srcdir)/gdm-slave.xml
-
-gdm-xdmcp-chooser-slave-glue.c gdm-xdmcp-chooser-slave-glue.h: gdm-xdmcp-chooser-slave.xml Makefile.am
-       $(AM_V_GEN)gdbus-codegen                                        \
-               --c-namespace=GdmDBus                                   \
-               --interface-prefix=org.gnome.DisplayManager             \
-               --generate-c-code=gdm-xdmcp-chooser-slave-glue          \
-               $(srcdir)/gdm-xdmcp-chooser-slave.xml
-
 noinst_PROGRAMS =              \
        test-session-client     \
        $(NULL)
@@ -134,86 +118,10 @@ test_session_client_LDADD =       \
        $(NULL)
 
 libexec_PROGRAMS =                     \
-       gdm-simple-slave                \
        gdm-session-worker              \
        $(NULL)
 
-if XDMCP_SUPPORT
-libexec_PROGRAMS +=                    \
-       gdm-xdmcp-chooser-slave         \
-       $(NULL)
-endif
-
-gdm_simple_slave_SOURCES =             \
-       simple-slave-main.c             \
-       gdm-launch-environment.c        \
-       gdm-launch-environment.h        \
-       gdm-server.c                    \
-       gdm-server.h                    \
-       gdm-session.c                   \
-       gdm-session.h                   \
-       gdm-session-record.c            \
-       gdm-session-record.h            \
-       gdm-session-worker-common.c     \
-       gdm-session-worker-common.h     \
-       gdm-session-worker-job.c        \
-       gdm-session-worker-job.h        \
-       gdm-xerrors.h                   \
-       gdm-xerrors.c                   \
-       gdm-slave.c                     \
-       gdm-slave.h                     \
-       gdm-simple-slave.c              \
-       gdm-simple-slave.h              \
-       gdm-dbus-util.c                 \
-       gdm-dbus-util.h                 \
-       $(NULL)
-
-nodist_gdm_simple_slave_SOURCES =      \
-       gdm-display-glue.c              \
-       gdm-display-glue.h              \
-       gdm-session-enum-types.c        \
-       gdm-session-enum-types.h        \
-       gdm-session-glue.c              \
-       gdm-session-glue.h              \
-       gdm-session-worker-glue.c       \
-       gdm-session-worker-glue.h       \
-       gdm-slave-glue.c                \
-       gdm-slave-glue.h                \
-       $(NULL)
-
-gdm_simple_slave_LDFLAGS =             \
-       $(PAM_LIBS)                     \
-       $(NULL)
-
-gdm_simple_slave_LDADD =                       \
-       $(top_builddir)/common/libgdmcommon.la  \
-       $(XLIB_LIBS)                            \
-       $(DAEMON_LIBS)                          \
-       $(EXTRA_DAEMON_LIBS)                    \
-       $(SYSTEMD_LIBS)                         \
-       $(JOURNALD_LIBS)                        \
-       $(NULL)
-
 gdm_xdmcp_chooser_slave_SOURCES =              \
-       xdmcp-chooser-slave-main.c              \
-       gdm-session.c                           \
-       gdm-session.h                           \
-       gdm-session-record.c                    \
-       gdm-session-record.h                    \
-       gdm-session-worker-common.c             \
-       gdm-session-worker-common.h             \
-       gdm-session-worker-job.c                \
-       gdm-session-worker-job.h                \
-       gdm-launch-environment.c                \
-       gdm-launch-environment.h                \
-       gdm-xerrors.h                           \
-       gdm-xerrors.c                           \
-       gdm-slave.c                             \
-       gdm-slave.h                             \
-       gdm-xdmcp-chooser-slave.c               \
-       gdm-xdmcp-chooser-slave.h               \
-       gdm-dbus-util.c                         \
-       gdm-dbus-util.h                         \
        $(NULL)
 
 nodist_gdm_xdmcp_chooser_slave_SOURCES =       \
@@ -225,10 +133,6 @@ nodist_gdm_xdmcp_chooser_slave_SOURCES =   \
        gdm-session-enum-types.h                \
        gdm-display-glue.c                      \
        gdm-display-glue.h                      \
-       gdm-slave-glue.c                        \
-       gdm-slave-glue.h                        \
-       gdm-xdmcp-chooser-slave-glue.c          \
-       gdm-xdmcp-chooser-slave-glue.h          \
        $(NULL)
 
 gdm_xdmcp_chooser_slave_LDADD =                \
@@ -311,8 +215,12 @@ gdm_SOURCES =                      \
        gdm-static-display.h            \
        gdm-transient-display.c         \
        gdm-transient-display.h         \
+       gdm-launch-environment.c        \
+       gdm-launch-environment.h        \
        gdm-manager.c                   \
        gdm-manager.h                   \
+       gdm-server.c                    \
+       gdm-server.h                    \
        gdm-session.c                   \
        gdm-session.h                   \
        gdm-session-record.c            \
@@ -321,10 +229,14 @@ gdm_SOURCES =                     \
        gdm-session-worker-common.h     \
        gdm-session-worker-job.c        \
        gdm-session-worker-job.h        \
-       gdm-slave-job.c                 \
-       gdm-slave-job.h                 \
+       gdm-slave.c                     \
+       gdm-slave.h                     \
+       gdm-simple-slave.c              \
+       gdm-simple-slave.h              \
        gdm-dbus-util.c                 \
        gdm-dbus-util.h                 \
+       gdm-xerrors.c                   \
+       gdm-xerrors.h                   \
        $(NULL)
 
 nodist_gdm_SOURCES =                   \
@@ -338,8 +250,6 @@ nodist_gdm_SOURCES =                        \
        gdm-transient-display-glue.c            \
        gdm-static-display-glue.h               \
        gdm-static-display-glue.c               \
-       gdm-slave-glue.h                        \
-       gdm-slave-glue.c                        \
        gdm-session-glue.h                      \
        gdm-session-glue.c                      \
        gdm-session-worker-glue.c               \
@@ -357,16 +267,12 @@ XDMCP_SOURCES =                           \
        gdm-xdmcp-greeter-display.h     \
        gdm-xdmcp-chooser-display.c     \
        gdm-xdmcp-chooser-display.h     \
-       $(NULL)
-
-XDMCP_nodist_SOURCES =                         \
-       gdm-xdmcp-chooser-slave-glue.c  \
-       gdm-xdmcp-chooser-slave-glue.h  \
+       gdm-xdmcp-chooser-slave.c       \
+       gdm-xdmcp-chooser-slave.h       \
        $(NULL)
 
 if XDMCP_SUPPORT
 gdm_SOURCES += $(XDMCP_SOURCES)
-nodist_gdm_SOURCES += $(XDMCP_nodist_SOURCES)
 endif
 
 EXTRA_gdm_SOURCES =    \
@@ -405,10 +311,8 @@ CLEANFILES =                                       \
        gdm-session-glue.c                      \
        gdm-session-worker-glue.c               \
        gdm-session-enum-types.c                \
-       gdm-slave-glue.c                        \
        gdm-static-display-glue.c               \
        gdm-transient-display-glue.c            \
-       gdm-xdmcp-chooser-slave-glue.c          \
        $(BUILT_SOURCES)                        \
        $(NULL)
 
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 2b23492..9c87ff6 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -41,15 +41,10 @@
 #include "gdm-settings-direct.h"
 #include "gdm-settings-keys.h"
 
-#include "gdm-slave-job.h"
-#include "gdm-slave-glue.h"
 #include "gdm-dbus-util.h"
 
 #define GDM_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_DISPLAY, GdmDisplayPrivate))
 
-#define GDM_SLAVE_PATH "/org/gnome/DisplayManager/Slave"
-#define DEFAULT_SLAVE_COMMAND LIBEXECDIR "/gdm-simple-slave"
-
 struct GdmDisplayPrivate
 {
         char                 *id;
@@ -62,19 +57,15 @@ struct GdmDisplayPrivate
         int                   status;
         time_t                creation_time;
         GTimer               *slave_timer;
-        char                 *slave_command;
+        GType                 slave_type;
 
         char                 *x11_cookie;
         gsize                 x11_cookie_size;
         GdmDisplayAccessFile *access_file;
 
         gboolean              is_local;
-        guint                 finish_idle_id;
 
-        GdmSlaveJob          *slave_job;
-        char                 *slave_bus_name;
-        GdmDBusSlave         *slave_proxy;
-        int                   slave_name_id;
+        GdmSlave             *slave;
         GDBusConnection      *connection;
         GdmDisplayAccessFile *user_access_file;
 
@@ -96,14 +87,13 @@ enum {
         PROP_X11_COOKIE,
         PROP_X11_AUTHORITY_FILE,
         PROP_IS_LOCAL,
-        PROP_SLAVE_COMMAND,
+        PROP_SLAVE_TYPE,
         PROP_IS_INITIAL
 };
 
 static void     gdm_display_class_init  (GdmDisplayClass *klass);
 static void     gdm_display_init        (GdmDisplay      *display);
 static void     gdm_display_finalize    (GObject         *object);
-static void     queue_finish            (GdmDisplay      *display);
 static void     _gdm_display_set_status (GdmDisplay *display,
                                          int         status);
 
@@ -291,96 +281,6 @@ gdm_display_add_user_authorization (GdmDisplay *display,
 }
 
 static void
-on_name_vanished (GDBusConnection *connection,
-                  const char      *name,
-                  gpointer         user_data)
-{
-        queue_finish (GDM_DISPLAY (user_data));
-}
-
-static void
-on_slave_started (GdmDBusSlave *slave_proxy,
-                  GdmDisplay   *display)
-{
-        _gdm_display_set_status (display, GDM_DISPLAY_MANAGED);
-}
-
-static void
-gdm_display_real_set_slave_bus_name_finish (GObject      *source_object,
-                                            GAsyncResult *res,
-                                            gpointer      user_data)
-{
-        GdmDisplay *display = user_data;
-
-        display->priv->slave_proxy = GDM_DBUS_SLAVE (gdm_dbus_slave_proxy_new_finish (res, NULL));
-        g_object_bind_property (G_OBJECT (display->priv->slave_proxy),
-                                "session-id",
-                                G_OBJECT (display),
-                                "session-id",
-                                G_BINDING_DEFAULT);
-        g_signal_connect (G_OBJECT (display->priv->slave_proxy),
-                          "started",
-                          G_CALLBACK (on_slave_started),
-                          display);
-}
-
-static gboolean
-gdm_display_real_set_slave_bus_name (GdmDisplay *display,
-                                     const char *name,
-                                     GError    **error)
-{
-        g_free (display->priv->slave_bus_name);
-        display->priv->slave_bus_name = g_strdup (name);
-
-        if (display->priv->slave_name_id > 0) {
-                g_bus_unwatch_name (display->priv->slave_name_id);
-        }
-
-        display->priv->slave_name_id = g_bus_watch_name_on_connection (display->priv->connection,
-                                                                       name,
-                                                                       G_BUS_NAME_WATCHER_FLAGS_NONE,
-                                                                       NULL, /* name appeared */
-                                                                       on_name_vanished,
-                                                                       g_object_ref (display),
-                                                                       NULL);
-
-        g_clear_object (&display->priv->slave_proxy);
-        gdm_dbus_slave_proxy_new (display->priv->connection,
-                                  G_DBUS_PROXY_FLAGS_NONE,
-                                  name,
-                                  GDM_SLAVE_PATH,
-                                  NULL,
-                                  gdm_display_real_set_slave_bus_name_finish,
-                                  display);
-
-        display->priv->slave_proxy = GDM_DBUS_SLAVE (gdm_dbus_slave_proxy_new_sync 
(display->priv->connection,
-                                                                                    G_DBUS_PROXY_FLAGS_NONE,
-                                                                                    name,
-                                                                                    GDM_SLAVE_PATH,
-                                                                                    NULL, NULL));
-
-        return TRUE;
-}
-
-gboolean
-gdm_display_set_slave_bus_name (GdmDisplay *display,
-                                const char *name,
-                                GError    **error)
-{
-        gboolean ret;
-
-        g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
-
-        g_debug ("GdmDisplay: Setting slave bus name:%s on display %s", name, 
display->priv->x11_display_name);
-
-        g_object_ref (display);
-        ret = GDM_DISPLAY_GET_CLASS (display)->set_slave_bus_name (display, name, error);
-        g_object_unref (display);
-
-        return ret;
-}
-
-static void
 gdm_display_real_get_timed_login_details (GdmDisplay *display,
                                           gboolean   *enabledp,
                                           char      **usernamep,
@@ -522,17 +422,19 @@ gdm_display_remove_user_authorization (GdmDisplay *display,
 }
 
 gboolean
-gdm_display_get_x11_cookie (GdmDisplay *display,
-                            GArray    **x11_cookie,
-                            GError    **error)
+gdm_display_get_x11_cookie (GdmDisplay  *display,
+                            const char **x11_cookie,
+                            gsize       *x11_cookie_size,
+                            GError     **error)
 {
         g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
 
         if (x11_cookie != NULL) {
-                *x11_cookie = g_array_new (TRUE, FALSE, sizeof (char));
-                g_array_append_vals (*x11_cookie,
-                                     display->priv->x11_cookie,
-                                     display->priv->x11_cookie_size);
+                *x11_cookie = display->priv->x11_cookie;
+        }
+
+        if (x11_cookie_size != NULL) {
+                *x11_cookie_size = display->priv->x11_cookie_size;
         }
 
         return TRUE;
@@ -611,44 +513,6 @@ gdm_display_is_initial (GdmDisplay  *display,
         return TRUE;
 }
 
-static gboolean
-finish_idle (GdmDisplay *display)
-{
-        display->priv->finish_idle_id = 0;
-        /* finish may end up finalizing object */
-        gdm_display_finish (display);
-        return FALSE;
-}
-
-static void
-queue_finish (GdmDisplay *display)
-{
-        if (display->priv->finish_idle_id == 0) {
-                display->priv->finish_idle_id = g_idle_add ((GSourceFunc)finish_idle, display);
-        }
-}
-
-static void
-slave_exited (GdmSlaveJob       *job,
-              int                code,
-              GdmDisplay        *display)
-{
-        g_debug ("GdmDisplay: Slave exited: %d", code);
-
-        queue_finish (display);
-}
-
-static void
-slave_died (GdmSlaveJob       *job,
-            int                signum,
-            GdmDisplay        *display)
-{
-        g_debug ("GdmDisplay: Slave died: %d", signum);
-
-        queue_finish (display);
-}
-
-
 static void
 _gdm_display_set_status (GdmDisplay *display,
                          int         status)
@@ -662,16 +526,10 @@ _gdm_display_set_status (GdmDisplay *display,
 static gboolean
 gdm_display_real_prepare (GdmDisplay *display)
 {
-        char *command;
-        char *log_file;
-        char *log_path;
-
         g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
 
         g_debug ("GdmDisplay: prepare display");
 
-        g_assert (display->priv->slave_job == NULL);
-
         if (!gdm_display_create_authority (display)) {
                 g_warning ("Unable to set up access control for display %d",
                            display->priv->x11_display_number);
@@ -680,27 +538,10 @@ gdm_display_real_prepare (GdmDisplay *display)
 
         _gdm_display_set_status (display, GDM_DISPLAY_PREPARED);
 
-        display->priv->slave_job = gdm_slave_job_new ();
-        g_signal_connect (display->priv->slave_job,
-                          "exited",
-                          G_CALLBACK (slave_exited),
-                          display);
-        g_signal_connect (display->priv->slave_job,
-                          "died",
-                          G_CALLBACK (slave_died),
-                          display);
-
-        log_file = g_strdup_printf ("%s-slave.log", display->priv->x11_display_name);
-        log_path = g_build_filename (LOGDIR, log_file, NULL);
-        g_free (log_file);
-        gdm_slave_job_set_log_path (display->priv->slave_job, log_path);
-        g_free (log_path);
-
-        command = g_strdup_printf ("%s --display-id %s",
-                                   display->priv->slave_command,
-                                   display->priv->id);
-        gdm_slave_job_set_command (display->priv->slave_job, command);
-        g_free (command);
+        display->priv->slave = GDM_SLAVE (g_object_new (display->priv->slave_type,
+                                                        "display", display,
+                                                        NULL));
+        _gdm_display_set_status (display, GDM_DISPLAY_MANAGED);
 
         return TRUE;
 }
@@ -738,12 +579,8 @@ gdm_display_real_manage (GdmDisplay *display)
                 }
         }
 
-        g_assert (display->priv->slave_job != NULL);
-
         g_timer_start (display->priv->slave_timer);
 
-        gdm_slave_job_start (display->priv->slave_job);
-
         return TRUE;
 }
 
@@ -802,11 +639,10 @@ gdm_display_real_unmanage (GdmDisplay *display)
 
         g_timer_stop (display->priv->slave_timer);
 
-        if (display->priv->slave_job != NULL) {
-                gdm_slave_job_stop (display->priv->slave_job);
-
-                g_object_unref (display->priv->slave_job);
-                display->priv->slave_job = NULL;
+        if (display->priv->slave != NULL) {
+                gdm_slave_stop (display->priv->slave);
+                g_object_unref (display->priv->slave);
+                display->priv->slave = NULL;
         }
 
         if (display->priv->user_access_file != NULL) {
@@ -829,11 +665,6 @@ gdm_display_real_unmanage (GdmDisplay *display)
                 _gdm_display_set_status (display, GDM_DISPLAY_UNMANAGED);
         }
 
-        if (display->priv->slave_name_id > 0) {
-                g_bus_unwatch_name (display->priv->slave_name_id);
-                display->priv->slave_name_id = 0;
-        }
-
         return TRUE;
 }
 
@@ -958,11 +789,10 @@ _gdm_display_set_is_local (GdmDisplay     *display,
 }
 
 static void
-_gdm_display_set_slave_command (GdmDisplay     *display,
-                                const char     *command)
+_gdm_display_set_slave_type (GdmDisplay     *display,
+                             GType           type)
 {
-        g_free (display->priv->slave_command);
-        display->priv->slave_command = g_strdup (command);
+        display->priv->slave_type = type;
 }
 
 static void
@@ -1010,8 +840,8 @@ gdm_display_set_property (GObject        *object,
         case PROP_IS_LOCAL:
                 _gdm_display_set_is_local (self, g_value_get_boolean (value));
                 break;
-        case PROP_SLAVE_COMMAND:
-                _gdm_display_set_slave_command (self, g_value_get_string (value));
+        case PROP_SLAVE_TYPE:
+                _gdm_display_set_slave_type (self, g_value_get_gtype (value));
                 break;
         case PROP_IS_INITIAL:
                 _gdm_display_set_is_initial (self, g_value_get_boolean (value));
@@ -1064,8 +894,8 @@ gdm_display_get_property (GObject        *object,
         case PROP_IS_LOCAL:
                 g_value_set_boolean (value, self->priv->is_local);
                 break;
-        case PROP_SLAVE_COMMAND:
-                g_value_set_string (value, self->priv->slave_command);
+        case PROP_SLAVE_TYPE:
+                g_value_set_gtype (value, self->priv->slave_type);
                 break;
         case PROP_IS_INITIAL:
                 g_value_set_boolean (value, self->priv->is_initial);
@@ -1168,18 +998,18 @@ handle_get_x11_cookie (GdmDBusDisplay        *skeleton,
                        GDBusMethodInvocation *invocation,
                        GdmDisplay            *display)
 {
-        GArray *cookie = NULL;
+        const char *x11_cookie;
+        gsize x11_cookie_size;
         GVariant *variant;
 
-        gdm_display_get_x11_cookie (display, &cookie, NULL);
+        gdm_display_get_x11_cookie (display, &x11_cookie, &x11_cookie_size, NULL);
 
         variant = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
-                                             cookie->data,
-                                             cookie->len,
+                                             x11_cookie,
+                                             x11_cookie_size,
                                              sizeof (char));
         gdm_dbus_display_complete_get_x11_cookie (skeleton, invocation, variant);
 
-        g_array_unref (cookie);
         return TRUE;
 }
 
@@ -1241,41 +1071,6 @@ handle_is_initial (GdmDBusDisplay        *skeleton,
 }
 
 static gboolean
-handle_get_slave_bus_name (GdmDBusDisplay        *skeleton,
-                           GDBusMethodInvocation *invocation,
-                           GdmDisplay            *display)
-{
-        if (display->priv->slave_bus_name != NULL) {
-                gdm_dbus_display_complete_get_slave_bus_name (skeleton, invocation,
-                                                              display->priv->slave_bus_name);
-        } else {
-                g_dbus_method_invocation_return_dbus_error (invocation,
-                                                            "org.gnome.DisplayManager.NotReady",
-                                                            "Slave is not yet registered");
-        }
-
-        return TRUE;
-}
-
-static gboolean
-handle_set_slave_bus_name (GdmDBusDisplay        *skeleton,
-                           GDBusMethodInvocation *invocation,
-                           const char            *bus_name,
-                           GdmDisplay            *display)
-{
-        GError *error = NULL;
-
-        if (gdm_display_set_slave_bus_name (display, bus_name, &error)) {
-                gdm_dbus_display_complete_set_slave_bus_name (skeleton, invocation);
-        } else {
-                g_dbus_method_invocation_return_gerror (invocation, error);
-                g_error_free (error);
-        }
-
-        return TRUE;
-}
-
-static gboolean
 handle_add_user_authorization (GdmDBusDisplay        *skeleton,
                                GDBusMethodInvocation *invocation,
                                const char            *username,
@@ -1351,10 +1146,6 @@ register_display (GdmDisplay *display)
                           G_CALLBACK (handle_is_local), display);
         g_signal_connect (display->priv->display_skeleton, "handle-is-initial",
                           G_CALLBACK (handle_is_initial), display);
-        g_signal_connect (display->priv->display_skeleton, "handle-get-slave-bus-name",
-                          G_CALLBACK (handle_get_slave_bus_name), display);
-        g_signal_connect (display->priv->display_skeleton, "handle-set-slave-bus-name",
-                          G_CALLBACK (handle_set_slave_bus_name), display);
         g_signal_connect (display->priv->display_skeleton, "handle-add-user-authorization",
                           G_CALLBACK (handle_add_user_authorization), display);
         g_signal_connect (display->priv->display_skeleton, "handle-remove-user-authorization",
@@ -1409,16 +1200,10 @@ gdm_display_dispose (GObject *object)
 
         g_debug ("GdmDisplay: Disposing display");
 
-        if (display->priv->finish_idle_id > 0) {
-                g_source_remove (display->priv->finish_idle_id);
-                display->priv->finish_idle_id = 0;
-        }
-
-        if (display->priv->slave_job != NULL) {
-                gdm_slave_job_stop (display->priv->slave_job);
-
-                g_object_unref (display->priv->slave_job);
-                display->priv->slave_job = NULL;
+        if (display->priv->slave != NULL) {
+                gdm_slave_stop (display->priv->slave);
+                g_object_unref (display->priv->slave);
+                display->priv->slave = NULL;
         }
 
         if (display->priv->user_access_file != NULL) {
@@ -1433,11 +1218,6 @@ gdm_display_dispose (GObject *object)
                 display->priv->access_file = NULL;
         }
 
-        if (display->priv->slave_name_id > 0) {
-                g_bus_unwatch_name (display->priv->slave_name_id);
-                display->priv->slave_name_id = 0;
-        }
-
         G_OBJECT_CLASS (gdm_display_parent_class)->dispose (object);
 }
 
@@ -1455,7 +1235,6 @@ gdm_display_class_init (GdmDisplayClass *klass)
         klass->create_authority = gdm_display_real_create_authority;
         klass->add_user_authorization = gdm_display_real_add_user_authorization;
         klass->remove_user_authorization = gdm_display_real_remove_user_authorization;
-        klass->set_slave_bus_name = gdm_display_real_set_slave_bus_name;
         klass->get_timed_login_details = gdm_display_real_get_timed_login_details;
         klass->prepare = gdm_display_real_prepare;
         klass->manage = gdm_display_real_manage;
@@ -1537,12 +1316,12 @@ gdm_display_class_init (GdmDisplayClass *klass)
                                                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
         g_object_class_install_property (object_class,
-                                         PROP_SLAVE_COMMAND,
-                                         g_param_spec_string ("slave-command",
-                                                              "slave command",
-                                                              "slave command",
-                                                              DEFAULT_SLAVE_COMMAND,
-                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+                                         PROP_SLAVE_TYPE,
+                                         g_param_spec_gtype ("slave-type",
+                                                             "slave type",
+                                                             "slave type",
+                                                             GDM_TYPE_SLAVE,
+                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
         g_object_class_install_property (object_class,
                                          PROP_STATUS,
                                          g_param_spec_int ("status",
@@ -1584,8 +1363,6 @@ gdm_display_finalize (GObject *object)
         g_free (display->priv->remote_hostname);
         g_free (display->priv->x11_display_name);
         g_free (display->priv->x11_cookie);
-        g_free (display->priv->slave_command);
-        g_free (display->priv->slave_bus_name);
 
         g_clear_object (&display->priv->display_skeleton);
         g_clear_object (&display->priv->object_skeleton);
@@ -1612,200 +1389,40 @@ gdm_display_get_object_skeleton (GdmDisplay *display)
         return display->priv->object_skeleton;
 }
 
-static void
-on_slave_set_up (GdmDBusSlave *slave,
-                 GAsyncResult *result,
-                 GTask        *task)
-{
-        GError *error = NULL;
-        char *username = NULL;
-
-        if (!gdm_dbus_slave_call_set_up_initial_session_finish (slave, &username, result, &error)) {
-                g_task_return_error (task, error);
-                return;
-        }
-
-        g_debug ("GdmDisplay: slave set up for %s user to connect",
-                 username);
-
-        g_task_return_pointer (task, username, NULL);
-}
-
 void
-gdm_display_set_up_initial_session (GdmDisplay           *display,
-                                    GCancellable         *cancellable,
-                                    GAsyncReadyCallback   callback,
-                                    gpointer              user_data)
+gdm_display_set_up_initial_session (GdmDisplay  *display,
+                                    char       **username)
 {
-        GTask *task;
-
-        task = g_task_new (display, cancellable, callback, user_data);
-
-        gdm_dbus_slave_call_set_up_initial_session (display->priv->slave_proxy,
-                                                    cancellable,
-                                                    (GAsyncReadyCallback)
-                                                    on_slave_set_up,
-                                                    task);
-}
-
-char *
-gdm_display_set_up_initial_session_finish (GdmDisplay    *display,
-                                           GAsyncResult  *result,
-                                           GError       **error)
-{
-        char *username;
-
-        username = g_task_propagate_pointer (G_TASK (result), error);
-        g_object_unref (G_OBJECT (result));
-
-        return username;
-}
-
-static void
-on_slave_started_initial_session (GdmDBusSlave *slave,
-                                  GAsyncResult *result,
-                                  GTask        *task)
-{
-        GError *error = NULL;
-
-        if (!gdm_dbus_slave_call_start_initial_session_finish (slave, result, &error)) {
-                g_task_return_error (task, error);
-                return;
-        }
-
-        g_debug ("GdmDisplay: slave started initial session");
-
-        g_task_return_boolean (task, TRUE);
+        gdm_slave_set_up_initial_session (display->priv->slave, username);
 }
 
 void
-gdm_display_start_initial_session (GdmDisplay          *display,
-                                   GCancellable        *cancellable,
-                                   GAsyncReadyCallback  callback,
-                                   gpointer             user_data)
-{
-        GTask *task;
-
-        task = g_task_new (display, cancellable, callback, user_data);
-
-        gdm_dbus_slave_call_start_initial_session (display->priv->slave_proxy,
-                                                   cancellable,
-                                                   (GAsyncReadyCallback)
-                                                   on_slave_started_initial_session,
-                                                   task);
-}
-
-gboolean
-gdm_display_start_initial_session_finish (GdmDisplay    *display,
-                                          GAsyncResult  *result,
-                                          GError       **error)
+gdm_display_start_initial_session (GdmDisplay *display)
 {
-        gboolean outcome;
-
-        outcome = g_task_propagate_boolean (G_TASK (result), error);
-        g_object_unref (G_OBJECT (result));
-
-        return outcome;
-}
-
-static void
-on_slave_initial_session_reset (GdmDBusSlave *slave,
-                                GAsyncResult *result,
-                                GTask        *task)
-{
-        GError *error = NULL;
-
-        if (!gdm_dbus_slave_call_reset_initial_session_finish (slave, result, &error)) {
-                g_task_return_error (task, error);
-                return;
-        }
-
-        g_debug ("GdmDisplay: slave reset initial session");
-
-        g_task_return_boolean (task, TRUE);
+        gdm_slave_start_initial_session (display->priv->slave);
 }
 
 void
-gdm_display_reset_initial_session (GdmDisplay *display,
-                                   GCancellable *cancellable,
-                                   GAsyncReadyCallback callback,
-                                   gpointer user_data)
+gdm_display_reset_initial_session (GdmDisplay *display)
 {
-        GTask *task;
-
-        task = g_task_new (display, cancellable, callback, user_data);
-
-        gdm_dbus_slave_call_reset_initial_session (display->priv->slave_proxy,
-                                                   cancellable,
-                                                   (GAsyncReadyCallback)
-                                                   on_slave_initial_session_reset,
-                                                   task);
-}
-
-gboolean
-gdm_display_reset_initial_session_finish (GdmDisplay *display,
-                                          GAsyncResult *result,
-                                          GError **error)
-{
-        gboolean outcome;
-
-        outcome = g_task_propagate_boolean (G_TASK (result), error);
-        g_object_unref (G_OBJECT (result));
-
-        return outcome;
-}
-
-static void
-on_slave_initial_session_stopped (GdmDBusSlave *slave,
-                                  GAsyncResult *result,
-                                  GTask        *task)
-{
-        GError *error = NULL;
-
-        if (!gdm_dbus_slave_call_stop_initial_session_finish (slave, result, &error)) {
-                g_task_return_error (task, error);
-                return;
-        }
-
-        g_debug ("GdmDisplay: slave set up for user session to start");
-
-        g_task_return_boolean (task, TRUE);
+        gdm_slave_reset_initial_session (display->priv->slave);
 }
 
 void
-gdm_display_stop_initial_session (GdmDisplay          *display,
-                                  const char          *username,
-                                  GCancellable        *cancellable,
-                                  GAsyncReadyCallback  callback,
-                                  gpointer             user_data)
+gdm_display_stop_initial_session (GdmDisplay *display,
+                                  const char *username)
 {
-        GTask *task;
-
-        task = g_task_new (display, cancellable, callback, user_data);
-
-        gdm_dbus_slave_call_stop_initial_session (display->priv->slave_proxy,
-                                                  username,
-                                                  cancellable,
-                                                  (GAsyncReadyCallback)
-                                                  on_slave_initial_session_stopped,
-                                                  task);
+        gdm_slave_stop_initial_session (display->priv->slave, username);
 }
 
 gboolean
-gdm_display_stop_initial_session_finish (GdmDisplay    *display,
-                                         GAsyncResult  *result,
-                                         GError       **error)
+gdm_display_run_pre_session_script (GdmDisplay *display)
 {
-        gboolean outcome;
-
-        outcome = g_task_propagate_boolean (G_TASK (result), error);
-        g_object_unref (G_OBJECT (result));
-
-        return outcome;
+        return FALSE;
 }
 
-gboolean
-gdm_display_run_pre_session_script (GdmDisplay *display)
+GdmSlave *
+gdm_display_get_slave (GdmDisplay *display)
 {
-        return FALSE;
+        return display->priv->slave;
 }
diff --git a/daemon/gdm-display.h b/daemon/gdm-display.h
index ee62020..2db40b5 100644
--- a/daemon/gdm-display.h
+++ b/daemon/gdm-display.h
@@ -24,6 +24,7 @@
 
 #include <glib-object.h>
 #include <gio/gio.h>
+#include "gdm-slave.h"
 
 G_BEGIN_DECLS
 
@@ -63,9 +64,6 @@ typedef struct
         gboolean (*remove_user_authorization) (GdmDisplay *display,
                                                const char *username,
                                                GError    **error);
-        gboolean (*set_slave_bus_name)        (GdmDisplay *display,
-                                               const char *name,
-                                               GError    **error);
         gboolean (*prepare)                   (GdmDisplay *display);
         gboolean (*manage)                    (GdmDisplay *display);
         gboolean (*finish)                    (GdmDisplay *display);
@@ -127,10 +125,10 @@ gboolean            gdm_display_is_initial                     (GdmDisplay  *dis
                                                                 gboolean    *initial,
                                                                 GError     **error);
 
-/* exported but protected */
-gboolean            gdm_display_get_x11_cookie                 (GdmDisplay *display,
-                                                                GArray     **x11_cookie,
-                                                                GError    **error);
+gboolean            gdm_display_get_x11_cookie                 (GdmDisplay  *display,
+                                                                const char **x11_cookie,
+                                                                gsize       *x11_cookie_size,
+                                                                GError     **error);
 gboolean            gdm_display_get_x11_authority_file         (GdmDisplay *display,
                                                                 char      **filename,
                                                                 GError    **error);
@@ -141,44 +139,16 @@ gboolean            gdm_display_add_user_authorization         (GdmDisplay *disp
 gboolean            gdm_display_remove_user_authorization      (GdmDisplay *display,
                                                                 const char *username,
                                                                 GError    **error);
-gboolean            gdm_display_set_slave_bus_name             (GdmDisplay *display,
-                                                                const char *name,
-                                                                GError    **error);
 
-void                gdm_display_set_up_initial_session           (GdmDisplay *display,
-                                                                  GCancellable *cancellable,
-                                                                  GAsyncReadyCallback callback,
-                                                                  gpointer user_data);
-
-char *              gdm_display_set_up_initial_session_finish    (GdmDisplay *display,
-                                                                  GAsyncResult *result,
-                                                                  GError **error);
-void                gdm_display_start_initial_session           (GdmDisplay *display,
-                                                                 GCancellable *cancellable,
-                                                                 GAsyncReadyCallback callback,
-                                                                 gpointer user_data);
-
-gboolean            gdm_display_start_initial_session_finish    (GdmDisplay *display,
-                                                                 GAsyncResult *result,
-                                                                 GError **error);
-void                gdm_display_reset_initial_session           (GdmDisplay *display,
-                                                                 GCancellable *cancellable,
-                                                                 GAsyncReadyCallback callback,
-                                                                 gpointer user_data);
-
-gboolean            gdm_display_reset_initial_session_finish    (GdmDisplay *display,
-                                                                 GAsyncResult *result,
-                                                                 GError **error);
-void                gdm_display_stop_initial_session           (GdmDisplay   *display,
-                                                                const char   *username,
-                                                                GCancellable *cancellable,
-                                                                GAsyncReadyCallback callback,
-                                                                gpointer user_data);
-
-gboolean           gdm_display_stop_initial_session_finish     (GdmDisplay *display,
-                                                                GAsyncResult *result,
-                                                                GError **error);
-gboolean           gdm_display_run_pre_session_script          (GdmDisplay *display);
+void                gdm_display_set_up_initial_session         (GdmDisplay  *display,
+                                                                char       **username);
+void                gdm_display_start_initial_session          (GdmDisplay  *display);
+void                gdm_display_reset_initial_session          (GdmDisplay  *display);
+void                gdm_display_stop_initial_session           (GdmDisplay  *display,
+                                                                const char  *username);
+gboolean            gdm_display_run_pre_session_script         (GdmDisplay  *display);
+
+GdmSlave *          gdm_display_get_slave                      (GdmDisplay  *display);
 
 G_END_DECLS
 
diff --git a/daemon/gdm-display.xml b/daemon/gdm-display.xml
index 48d03db..bc27995 100644
--- a/daemon/gdm-display.xml
+++ b/daemon/gdm-display.xml
@@ -37,12 +37,6 @@
     <method name="RemoveUserAuthorization">
       <arg name="username" direction="in" type="s"/>
     </method>
-    <method name="GetSlaveBusName">
-      <arg name="name" direction="out" type="s"/>
-    </method>
-    <method name="SetSlaveBusName">
-      <arg name="name" direction="in" type="s"/>
-    </method>
     <method name="GetTimedLoginDetails">
       <arg name="enabled" direction="out" type="b"/>
       <arg name="username" direction="out" type="s"/>
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 1144f7c..bc56164 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -102,12 +102,6 @@ static guint signals [LAST_SIGNAL] = { 0, };
 static void     gdm_manager_class_init  (GdmManagerClass *klass);
 static void     gdm_manager_init        (GdmManager      *manager);
 static void     gdm_manager_finalize    (GObject         *object);
-static void     on_initial_session_set_up (GdmDisplay   *display,
-                                           GAsyncResult *result,
-                                           GdmManager   *manager);
-static void on_initial_session_started (GdmDisplay   *display,
-                                        GAsyncResult *result,
-                                        GdmManager   *manager);
 static void create_session_for_display (GdmManager *manager,
                                         GdmDisplay *display,
                                         uid_t       allowed_user);
@@ -722,6 +716,28 @@ manager_interface_init (GdmDBusManagerIface *interface)
 }
 
 static void
+set_up_initial_session (GdmManager *manager,
+                        GdmDisplay *display)
+{
+        char *allowed_user;
+        struct passwd *passwd_entry;
+
+        gdm_display_set_up_initial_session (display, &allowed_user);
+
+        if (!gdm_get_pwent_for_name (allowed_user, &passwd_entry)) {
+                g_warning ("GdmManager: couldn't look up username %s",
+                           allowed_user);
+                gdm_display_finish (display);
+                return;
+        }
+
+        create_session_for_display (manager, display, passwd_entry->pw_uid);
+        g_free (allowed_user);
+
+        gdm_display_start_initial_session (display);
+}
+
+static void
 on_display_status_changed (GdmDisplay *display,
                            GParamSpec *arg1,
                            GdmManager *manager)
@@ -732,11 +748,7 @@ on_display_status_changed (GdmDisplay *display,
 
         switch (status) {
                 case GDM_DISPLAY_MANAGED:
-                        gdm_display_set_up_initial_session (display,
-                                                            NULL,
-                                                            (GAsyncReadyCallback)
-                                                            on_initial_session_set_up,
-                                                            manager);
+                        set_up_initial_session (manager, display);
                         break;
                 case GDM_DISPLAY_FAILED:
                 case GDM_DISPLAY_UNMANAGED:
@@ -838,47 +850,6 @@ reset_session (GdmManager *manager,
         create_session_for_display (manager, display, allowed_uid);
 }
 
-static void
-on_initial_session_stopped (GdmDisplay   *display,
-                            GAsyncResult *result,
-                            StartUserSessionOperation *operation)
-{
-        GError *error = NULL;
-        gboolean stopped;
-
-        stopped = gdm_display_stop_initial_session_finish (display, result, &error);
-
-        if (!stopped) {
-                g_warning ("Couldn't stop initial session on display: %s",
-                           error->message);
-                g_error_free (error);
-                gdm_display_unmanage (display);
-                gdm_display_finish (display);
-                return;
-        }
-
-        start_user_session (operation->manager, display, operation);
-}
-
-static void
-on_initial_session_reset (GdmDisplay   *display,
-                          GAsyncResult *result)
-{
-        GError *error = NULL;
-        gboolean reset;
-
-        reset = gdm_display_reset_initial_session_finish (display, result, &error);
-
-        if (!reset) {
-                g_warning ("Couldn't reset initial session on display: %s",
-                           error->message);
-                g_error_free (error);
-                gdm_display_unmanage (display);
-                gdm_display_finish (display);
-                return;
-        }
-}
-
 static gboolean
 on_start_user_session (StartUserSessionOperation *operation)
 {
@@ -908,11 +879,7 @@ on_start_user_session (StartUserSessionOperation *operation)
                 g_debug ("GdmManager: session has its display server, reusing our server for another login 
screen");
                 reset_session (operation->manager, operation->session);
                 display = get_display_for_session (operation->manager, operation->session);
-                gdm_display_reset_initial_session (display,
-                                                   NULL,
-                                                   (GAsyncReadyCallback)
-                                                   on_initial_session_reset,
-                                                   NULL);
+                gdm_display_reset_initial_session (display);
                 start_user_session (operation->manager, NULL, operation);
         } else {
                 GdmDisplay *display;
@@ -921,13 +888,10 @@ on_start_user_session (StartUserSessionOperation *operation)
                 display = get_display_for_session (operation->manager, operation->session);
                 username = gdm_session_get_username (operation->session);
 
-                gdm_display_stop_initial_session (display,
-                                                  username,
-                                                  NULL,
-                                                  (GAsyncReadyCallback)
-                                                  on_initial_session_stopped,
-                                                  operation);
+                gdm_display_stop_initial_session (display, username);
                 g_free (username);
+
+                start_user_session (operation->manager, display, operation);
         }
 
         return G_SOURCE_REMOVE;
@@ -1453,20 +1417,6 @@ touch_marker_file (GdmManager *manager)
 }
 
 static void
-on_initial_session_started (GdmDisplay   *display,
-                            GAsyncResult *result,
-                            GdmManager   *manager)
-{
-        GError *error = NULL;
-        if (!gdm_display_start_initial_session_finish (display, result, &error)) {
-                g_warning ("GdmManager: couldn't start initial session: %s", error->message);
-                gdm_display_unmanage (display);
-                gdm_display_finish (display);
-                return;
-        }
-}
-
-static void
 create_session_for_display (GdmManager *manager,
                             GdmDisplay *display,
                             uid_t       allowed_user)
@@ -1560,43 +1510,6 @@ create_session_for_display (GdmManager *manager,
 }
 
 static void
-on_initial_session_set_up (GdmDisplay   *display,
-                           GAsyncResult *result,
-                           GdmManager   *manager)
-{
-        GError *error = NULL;
-        char *allowed_user;
-        struct passwd *passwd_entry;
-
-        allowed_user = gdm_display_set_up_initial_session_finish (display, result, &error);
-
-        if (allowed_user == NULL) {
-                g_warning ("Couldn't start initial session on display: %s",
-                           error->message);
-                g_error_free (error);
-                gdm_display_unmanage (display);
-                gdm_display_finish (display);
-                return;
-        }
-
-        if (!gdm_get_pwent_for_name (allowed_user, &passwd_entry)) {
-                g_warning ("GdmManager: couldn't look up username %s",
-                           allowed_user);
-                gdm_display_finish (display);
-                return;
-        }
-
-        create_session_for_display (manager, display, passwd_entry->pw_uid);
-        g_free (allowed_user);
-
-        gdm_display_start_initial_session (display,
-                                           NULL,
-                                           (GAsyncReadyCallback)
-                                           on_initial_session_started,
-                                           manager);
-}
-
-static void
 on_display_added (GdmDisplayStore *display_store,
                   const char      *id,
                   GdmManager      *manager)
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 8761c27..15390ba 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -58,9 +58,6 @@
 
 #define GDM_SIMPLE_SLAVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SIMPLE_SLAVE, 
GdmSimpleSlavePrivate))
 
-#define GDM_DBUS_NAME              "org.gnome.DisplayManager"
-#define GDM_DBUS_DISPLAY_INTERFACE "org.gnome.DisplayManager.Display"
-
 #define MAX_CONNECT_ATTEMPTS  10
 #define DEFAULT_PING_INTERVAL 15
 
@@ -1087,15 +1084,3 @@ gdm_simple_slave_finalize (GObject *object)
 
         G_OBJECT_CLASS (gdm_simple_slave_parent_class)->finalize (object);
 }
-
-GdmSlave *
-gdm_simple_slave_new (const char *id)
-{
-        GObject *object;
-
-        object = g_object_new (GDM_TYPE_SIMPLE_SLAVE,
-                               "display-id", id,
-                               NULL);
-
-        return GDM_SLAVE (object);
-}
diff --git a/daemon/gdm-simple-slave.h b/daemon/gdm-simple-slave.h
index f958a15..376aeda 100644
--- a/daemon/gdm-simple-slave.h
+++ b/daemon/gdm-simple-slave.h
@@ -48,7 +48,6 @@ typedef struct
 } GdmSimpleSlaveClass;
 
 GType               gdm_simple_slave_get_type   (void);
-GdmSlave *          gdm_simple_slave_new        (const char       *id);
 
 G_END_DECLS
 
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index de512eb..f174f1a 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -52,7 +52,7 @@
 #include "gdm-xerrors.h"
 
 #include "gdm-slave.h"
-#include "gdm-slave-glue.h"
+#include "gdm-display.h"
 #include "gdm-display-glue.h"
 
 #include "gdm-server.h"
@@ -68,11 +68,6 @@
 #define CK_SEAT_INTERFACE    "org.freedesktop.ConsoleKit.Seat"
 #define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
 
-#define GDM_DBUS_NAME              "org.gnome.DisplayManager"
-#define GDM_DBUS_DISPLAY_INTERFACE "org.gnome.DisplayManager.Display"
-
-#define GDM_SLAVE_PATH "/org/gnome/DisplayManager/Slave"
-
 #define MAX_CONNECT_ATTEMPTS 10
 
 struct GdmSlavePrivate
@@ -85,8 +80,9 @@ struct GdmSlavePrivate
 
         char            *session_id;
 
+        GdmDisplay      *display;
+
         /* cached display values */
-        char            *display_id;
         char            *display_name;
         int              display_number;
         char            *display_hostname;
@@ -99,16 +95,12 @@ struct GdmSlavePrivate
         char            *windowpath;
         GBytes          *display_x11_cookie;
         gboolean         display_is_initial;
-
-        GdmDBusDisplay  *display_proxy;
-        GDBusConnection *connection;
-        GdmDBusSlave    *skeleton;
 };
 
 enum {
         PROP_0,
         PROP_SESSION_ID,
-        PROP_DISPLAY_ID,
+        PROP_DISPLAY,
         PROP_DISPLAY_NAME,
         PROP_DISPLAY_NUMBER,
         PROP_DISPLAY_HOSTNAME,
@@ -119,6 +111,7 @@ enum {
 };
 
 enum {
+        STARTED,
         STOPPED,
         LAST_SIGNAL
 };
@@ -637,94 +630,25 @@ gdm_slave_connect_to_x11_display (GdmSlave *slave)
         }
 
         if (ret) {
-                gdm_dbus_slave_emit_started (slave->priv->skeleton);
+                g_signal_emit (slave, signals [STARTED], 0);
         }
 
         return ret;
 }
 
 static gboolean
-gdm_slave_set_slave_bus_name (GdmSlave *slave)
-{
-        gboolean    res;
-        GError     *error;
-        const char *name;
-
-        name = g_dbus_connection_get_unique_name (slave->priv->connection);
-
-        error = NULL;
-        res = gdm_dbus_display_call_set_slave_bus_name_sync (slave->priv->display_proxy,
-                                                             name,
-                                                             NULL,
-                                                             &error);
-        if (! res) {
-                g_warning ("Failed to set slave bus name on parent: %s", error->message);
-                g_error_free (error);
-        }
-
-        return res;
-}
-
-static gboolean
 gdm_slave_real_start (GdmSlave *slave)
 {
         gboolean    res;
-        char       *id = NULL;
         GError     *error;
-        GVariant   *x11_cookie;
-        const char *x11_cookie_bytes;
+        const char *x11_cookie;
         gsize       x11_cookie_size;
 
         g_debug ("GdmSlave: Starting slave");
 
-        g_assert (slave->priv->display_proxy == NULL);
-
-        if (! g_variant_is_object_path (slave->priv->display_id)) {
-                g_warning ("Display ID isn't valid");
-                return FALSE;
-        }
-
-        g_debug ("GdmSlave: Creating proxy for %s", slave->priv->display_id);
-        error = NULL;
-        slave->priv->display_proxy = GDM_DBUS_DISPLAY (gdm_dbus_display_proxy_new_sync 
(slave->priv->connection,
-                                                                                        
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
-                                                                                        GDM_DBUS_NAME,
-                                                                                        
slave->priv->display_id,
-                                                                                        NULL,
-                                                                                        &error));
-
-        if (slave->priv->display_proxy == NULL) {
-                g_warning ("Failed to create display proxy %s: %s", slave->priv->display_id, error->message);
-                g_error_free (error);
-                return FALSE;
-        }
-
-        error = NULL;
-        res = gdm_dbus_display_call_get_id_sync (slave->priv->display_proxy,
-                                                 &id,
-                                                 NULL,
-                                                 &error);
-        if (! res || !id) {
-                g_warning ("Failed to get display ID %s: %s", slave->priv->display_id, error->message);
-                g_error_free (error);
-                return FALSE;
-        }
-
-        g_debug ("GdmSlave: Got display ID: %s", id);
-
-        if (strcmp (id, slave->priv->display_id) != 0) {
-                g_warning ("Display ID doesn't match");
-                return FALSE;
-        }
-
-        gdm_slave_set_slave_bus_name (slave);
-
         /* cache some values up front */
         error = NULL;
-        res = gdm_dbus_display_call_is_local_sync (slave->priv->display_proxy,
-                                                   &slave->priv->display_is_local,
-                                                   NULL,
-                                                   &error);
+        res = gdm_display_is_local (slave->priv->display, &slave->priv->display_is_local, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -732,10 +656,7 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_get_x11_display_name_sync (slave->priv->display_proxy,
-                                                               &slave->priv->display_name,
-                                                               NULL,
-                                                               &error);
+        res = gdm_display_get_x11_display_name (slave->priv->display, &slave->priv->display_name, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -743,10 +664,7 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_get_x11_display_number_sync (slave->priv->display_proxy,
-                                                                 &slave->priv->display_number,
-                                                                 NULL,
-                                                                 &error);
+        res = gdm_display_get_x11_display_number (slave->priv->display, &slave->priv->display_number, 
&error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -754,10 +672,7 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_get_remote_hostname_sync (slave->priv->display_proxy,
-                                                              &slave->priv->display_hostname,
-                                                              NULL,
-                                                              &error);
+        res = gdm_display_get_remote_hostname (slave->priv->display, &slave->priv->display_hostname, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -765,33 +680,20 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_get_x11_cookie_sync (slave->priv->display_proxy,
-                                                         &x11_cookie,
-                                                         NULL,
-                                                         &error);
+        res = gdm_display_get_x11_cookie (slave->priv->display, &x11_cookie, &x11_cookie_size, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
                 return FALSE;
         }
 
-        x11_cookie_bytes = g_variant_get_fixed_array (x11_cookie,
-                                                      &x11_cookie_size,
-                                                      sizeof (char));
-
-        if (x11_cookie_bytes != NULL && x11_cookie_size > 0) {
+        if (x11_cookie != NULL && x11_cookie_size > 0) {
                 g_bytes_unref (slave->priv->display_x11_cookie);
-                slave->priv->display_x11_cookie = g_bytes_new (x11_cookie_bytes,
-                                                               x11_cookie_size);
+                slave->priv->display_x11_cookie = g_bytes_new (x11_cookie, x11_cookie_size);
         }
 
-        g_variant_unref (x11_cookie);
-
         error = NULL;
-        res = gdm_dbus_display_call_get_x11_authority_file_sync (slave->priv->display_proxy,
-                                                                 &slave->priv->display_x11_authority_file,
-                                                                 NULL,
-                                                                 &error);
+        res = gdm_display_get_x11_authority_file (slave->priv->display, 
&slave->priv->display_x11_authority_file, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -799,10 +701,7 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_get_seat_id_sync (slave->priv->display_proxy,
-                                                      &slave->priv->display_seat_id,
-                                                      NULL,
-                                                      &error);
+        res = gdm_display_get_seat_id (slave->priv->display, &slave->priv->display_seat_id, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -810,10 +709,7 @@ gdm_slave_real_start (GdmSlave *slave)
         }
 
         error = NULL;
-        res = gdm_dbus_display_call_is_initial_sync (slave->priv->display_proxy,
-                                                     &slave->priv->display_is_initial,
-                                                     NULL,
-                                                     &error);
+        res = gdm_display_is_initial (slave->priv->display, &slave->priv->display_is_initial, &error);
         if (! res) {
                 g_warning ("Failed to get value: %s", error->message);
                 g_error_free (error);
@@ -828,7 +724,7 @@ gdm_slave_real_stop (GdmSlave *slave)
 {
         g_debug ("GdmSlave: Stopping slave");
 
-        g_clear_object (&slave->priv->display_proxy);
+        g_clear_object (&slave->priv->display);
 
         return TRUE;
 }
@@ -888,11 +784,10 @@ gdm_slave_add_user_authorization (GdmSlave   *slave,
         g_debug ("GdmSlave: Requesting user authorization");
 
         error = NULL;
-        res = gdm_dbus_display_call_add_user_authorization_sync (slave->priv->display_proxy,
-                                                                 username,
-                                                                 &filename,
-                                                                 NULL,
-                                                                 &error);
+        res = gdm_display_add_user_authorization (slave->priv->display,
+                                                  username,
+                                                  &filename,
+                                                  &error);
 
         if (! res) {
                 g_warning ("Failed to add user authorization: %s", error->message);
@@ -1028,12 +923,11 @@ gdm_slave_get_timed_login_details (GdmSlave   *slave,
         g_debug ("GdmSlave: Requesting timed login details");
 
         error = NULL;
-        res = gdm_dbus_display_call_get_timed_login_details_sync (slave->priv->display_proxy,
-                                                                  &enabled,
-                                                                  &username,
-                                                                  &delay,
-                                                                  NULL,
-                                                                  &error);
+        res = gdm_display_get_timed_login_details (slave->priv->display,
+                                                   &enabled,
+                                                   &username,
+                                                   &delay,
+                                                   &error);
         if (! res) {
                 g_warning ("Failed to get timed login details: %s", error->message);
                 g_error_free (error);
@@ -1084,14 +978,6 @@ gdm_slave_get_timed_login_details (GdmSlave   *slave,
 }
 
 static void
-_gdm_slave_set_display_id (GdmSlave   *slave,
-                           const char *id)
-{
-        g_free (slave->priv->display_id);
-        slave->priv->display_id = g_strdup (id);
-}
-
-static void
 gdm_slave_set_property (GObject      *object,
                         guint         prop_id,
                         const GValue *value,
@@ -1102,8 +988,8 @@ gdm_slave_set_property (GObject      *object,
         self = GDM_SLAVE (object);
 
         switch (prop_id) {
-        case PROP_DISPLAY_ID:
-                _gdm_slave_set_display_id (self, g_value_get_string (value));
+        case PROP_DISPLAY:
+                self->priv->display = g_value_dup_object (value);
                 break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1125,8 +1011,8 @@ gdm_slave_get_property (GObject    *object,
         case PROP_SESSION_ID:
                 g_value_set_string (value, self->priv->session_id);
                 break;
-        case PROP_DISPLAY_ID:
-                g_value_set_string (value, self->priv->display_id);
+        case PROP_DISPLAY:
+                g_value_set_object (value, self->priv->display);
                 break;
         case PROP_DISPLAY_NAME:
                 g_value_set_string (value, self->priv->display_name);
@@ -1155,163 +1041,30 @@ gdm_slave_get_property (GObject    *object,
         }
 }
 
-static gboolean
-handle_set_up_initial_session (GdmDBusSlave          *skeleton,
-                               GDBusMethodInvocation *invocation,
-                               GdmSlave              *slave)
-{
-        GdmSlaveClass *slave_class;
-        char          *username;
-
-        slave_class = GDM_SLAVE_GET_CLASS (slave);
-        if (slave_class->set_up_initial_session == NULL) {
-                g_dbus_method_invocation_return_dbus_error (invocation,
-                                                            "org.gnome.DisplayManager.Slave.Unsupported",
-                                                            "Connections to the slave are not supported by 
this slave");
-                return TRUE;
-        }
-
-        username = NULL;
-        slave_class->set_up_initial_session (slave, &username);
-
-        gdm_dbus_slave_complete_set_up_initial_session (skeleton, invocation, username);
-
-        g_free (username);
-        return TRUE;
-}
-
-static gboolean
-handle_start_initial_session (GdmDBusSlave          *skeleton,
-                              GDBusMethodInvocation *invocation,
-                              GdmSlave              *slave)
+void
+gdm_slave_set_up_initial_session (GdmSlave  *slave,
+                                  char     **username)
 {
-        GdmSlaveClass *slave_class;
-
-        slave_class = GDM_SLAVE_GET_CLASS (slave);
-        if (slave_class->start_initial_session == NULL) {
-                g_dbus_method_invocation_return_dbus_error (invocation,
-                                                            "org.gnome.DisplayManager.Slave.Unsupported",
-                                                            "Connections to the slave are not supported by 
this slave");
-                return TRUE;
-        }
-
-        slave_class->start_initial_session (slave);
-
-        gdm_dbus_slave_complete_start_initial_session (skeleton, invocation);
-
-        return TRUE;
+        GDM_SLAVE_GET_CLASS (slave)->set_up_initial_session (slave, username);
 }
 
-static gboolean
-handle_reset_initial_session (GdmDBusSlave          *skeleton,
-                              GDBusMethodInvocation *invocation,
-                              GdmSlave              *slave)
-{
-        GdmSlaveClass *slave_class;
-
-        slave_class = GDM_SLAVE_GET_CLASS (slave);
-        if (slave_class->reset_initial_session == NULL) {
-                g_dbus_method_invocation_return_dbus_error (invocation,
-                                                            "org.gnome.DisplayManager.Slave.Unsupported",
-                                                            "Connections to the slave are not supported by 
this slave");
-                return TRUE;
-        }
-
-        slave_class->reset_initial_session (slave);
-
-        gdm_dbus_slave_complete_reset_initial_session (skeleton, invocation);
-
-        return TRUE;
-}
-
-
-static gboolean
-handle_stop_initial_session (GdmDBusSlave          *skeleton,
-                             GDBusMethodInvocation *invocation,
-                             const char            *username,
-                             GdmSlave              *slave)
+void
+gdm_slave_start_initial_session (GdmSlave *slave)
 {
-        GdmSlaveClass *slave_class;
-
-        slave_class = GDM_SLAVE_GET_CLASS (slave);
-        if (slave_class->stop_initial_session == NULL) {
-                g_dbus_method_invocation_return_dbus_error (invocation,
-                                                            "org.gnome.DisplayManager.Slave.Unsupported",
-                                                            "Connections to the slave are not supported by 
this slave");
-                return TRUE;
-        }
-
-        slave_class->stop_initial_session (slave, username);
-
-        gdm_dbus_slave_complete_stop_initial_session (skeleton, invocation);
-
-        return TRUE;
+        GDM_SLAVE_GET_CLASS (slave)->start_initial_session (slave);
 }
 
-static gboolean
-register_slave (GdmSlave *slave)
+void
+gdm_slave_reset_initial_session (GdmSlave *slave)
 {
-        GError *error;
-
-        error = NULL;
-        slave->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM,
-                                                  NULL,
-                                                  &error);
-        if (slave->priv->connection == NULL) {
-                g_critical ("error getting system bus: %s", error->message);
-                g_error_free (error);
-                exit (1);
-        }
-
-        slave->priv->skeleton = GDM_DBUS_SLAVE (gdm_dbus_slave_skeleton_new ());
-
-        g_signal_connect (slave->priv->skeleton,
-                          "handle-set-up-initial-session",
-                          G_CALLBACK (handle_set_up_initial_session),
-                          slave);
-        g_signal_connect (slave->priv->skeleton,
-                          "handle-start-initial-session",
-                          G_CALLBACK (handle_start_initial_session),
-                          slave);
-        g_signal_connect (slave->priv->skeleton,
-                          "handle-reset-initial-session",
-                          G_CALLBACK (handle_reset_initial_session),
-                          slave);
-        g_signal_connect (slave->priv->skeleton,
-                          "handle-stop-initial-session",
-                          G_CALLBACK (handle_stop_initial_session),
-                          slave);
-        g_object_bind_property (G_OBJECT (slave),
-                                "session-id",
-                                G_OBJECT (slave->priv->skeleton),
-                                "session-id",
-                                G_BINDING_DEFAULT);
-
-        gdm_slave_export_interface (slave,
-                                    G_DBUS_INTERFACE_SKELETON (slave->priv->skeleton));
-
-        return TRUE;
+        GDM_SLAVE_GET_CLASS (slave)->reset_initial_session (slave);
 }
 
-static GObject *
-gdm_slave_constructor (GType                  type,
-                       guint                  n_construct_properties,
-                       GObjectConstructParam *construct_properties)
+void
+gdm_slave_stop_initial_session (GdmSlave   *slave,
+                                const char *username)
 {
-        GdmSlave      *slave;
-        gboolean       res;
-
-        slave = GDM_SLAVE (G_OBJECT_CLASS (gdm_slave_parent_class)->constructor (type,
-                                                                                 n_construct_properties,
-                                                                                 construct_properties));
-        g_debug ("GdmSlave: Registering");
-
-        res = register_slave (slave);
-        if (! res) {
-                g_warning ("Unable to register slave with system bus");
-        }
-
-        return G_OBJECT (slave);
+        GDM_SLAVE_GET_CLASS (slave)->stop_initial_session (slave, username);
 }
 
 static void
@@ -1321,7 +1074,6 @@ gdm_slave_class_init (GdmSlaveClass *klass)
 
         object_class->get_property = gdm_slave_get_property;
         object_class->set_property = gdm_slave_set_property;
-        object_class->constructor = gdm_slave_constructor;
         object_class->finalize = gdm_slave_finalize;
 
         klass->start = gdm_slave_real_start;
@@ -1337,11 +1089,11 @@ gdm_slave_class_init (GdmSlaveClass *klass)
                                                               NULL,
                                                               G_PARAM_READABLE));
         g_object_class_install_property (object_class,
-                                         PROP_DISPLAY_ID,
-                                         g_param_spec_string ("display-id",
+                                         PROP_DISPLAY,
+                                         g_param_spec_object ("display",
                                                               "id",
                                                               "id",
-                                                              NULL,
+                                                              GDM_TYPE_DISPLAY,
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
         g_object_class_install_property (object_class,
                                          PROP_DISPLAY_NAME,
@@ -1395,6 +1147,17 @@ gdm_slave_class_init (GdmSlaveClass *klass)
                                                                FALSE,
                                                                G_PARAM_READABLE));
 
+        signals [STARTED] =
+                g_signal_new ("started",
+                              G_TYPE_FROM_CLASS (object_class),
+                              G_SIGNAL_RUN_LAST,
+                              0,
+                              NULL,
+                              NULL,
+                              g_cclosure_marshal_VOID__VOID,
+                              G_TYPE_NONE,
+                              0);
+
         signals [STOPPED] =
                 g_signal_new ("stopped",
                               G_TYPE_FROM_CLASS (object_class),
@@ -1410,7 +1173,6 @@ gdm_slave_class_init (GdmSlaveClass *klass)
 static void
 gdm_slave_init (GdmSlave *slave)
 {
-
         slave->priv = GDM_SLAVE_GET_PRIVATE (slave);
 
         slave->priv->pid = -1;
@@ -1430,7 +1192,6 @@ gdm_slave_finalize (GObject *object)
 
         gdm_slave_real_stop (slave);
 
-        g_free (slave->priv->display_id);
         g_free (slave->priv->display_name);
         g_free (slave->priv->display_hostname);
         g_free (slave->priv->display_seat_id);
@@ -1442,13 +1203,3 @@ gdm_slave_finalize (GObject *object)
 
         G_OBJECT_CLASS (gdm_slave_parent_class)->finalize (object);
 }
-
-void
-gdm_slave_export_interface (GdmSlave               *slave,
-                            GDBusInterfaceSkeleton *interface)
-{
-        g_dbus_interface_skeleton_export (interface,
-                                          slave->priv->connection,
-                                          GDM_SLAVE_PATH,
-                                          NULL);
-}
diff --git a/daemon/gdm-slave.h b/daemon/gdm-slave.h
index 14c9ff7..5456c44 100644
--- a/daemon/gdm-slave.h
+++ b/daemon/gdm-slave.h
@@ -90,8 +90,14 @@ void                gdm_slave_set_initial_cursor_position (GdmSlave *slave);
 gboolean            gdm_slave_run_script             (GdmSlave   *slave,
                                                       const char *dir,
                                                       const char *username);
-void                gdm_slave_export_interface       (GdmSlave               *slave,
-                                                      GDBusInterfaceSkeleton *interface);
+
+void                gdm_slave_set_up_initial_session (GdmSlave   *slave,
+                                                      char      **username);
+void                gdm_slave_start_initial_session  (GdmSlave   *slave);
+void                gdm_slave_reset_initial_session  (GdmSlave   *slave);
+void                gdm_slave_stop_initial_session   (GdmSlave   *slave,
+                                                      const char *username);
+
 G_END_DECLS
 
 #endif /* __GDM_SLAVE_H */
diff --git a/daemon/gdm-xdmcp-chooser-display.c b/daemon/gdm-xdmcp-chooser-display.c
index 706d2e8..72e3d07 100644
--- a/daemon/gdm-xdmcp-chooser-display.c
+++ b/daemon/gdm-xdmcp-chooser-display.c
@@ -37,23 +37,11 @@
 
 #include "gdm-display.h"
 #include "gdm-xdmcp-chooser-display.h"
-#include "gdm-xdmcp-chooser-slave-glue.h"
+#include "gdm-xdmcp-chooser-slave.h"
 
 #include "gdm-common.h"
 #include "gdm-address.h"
 
-#define DEFAULT_SLAVE_COMMAND LIBEXECDIR"/gdm-xdmcp-chooser-slave"
-
-
-#define GDM_SLAVE_PATH "/org/gnome/DisplayManager/Slave"
-
-#define GDM_XDMCP_CHOOSER_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
GDM_TYPE_XDMCP_CHOOSER_DISPLAY, GdmXdmcpChooserDisplayPrivate))
-
-struct GdmXdmcpChooserDisplayPrivate
-{
-        GdmDBusXdmcpChooserSlave *slave_proxy;
-};
-
 enum {
         HOSTNAME_SELECTED,
         LAST_SIGNAL
@@ -63,13 +51,13 @@ static guint signals [LAST_SIGNAL] = { 0, };
 
 static void     gdm_xdmcp_chooser_display_class_init    (GdmXdmcpChooserDisplayClass *klass);
 static void     gdm_xdmcp_chooser_display_init          (GdmXdmcpChooserDisplay      *xdmcp_chooser_display);
-static void     gdm_xdmcp_chooser_display_finalize      (GObject                     *object);
-static gboolean gdm_xdmcp_chooser_display_finish (GdmDisplay *display);
+static gboolean gdm_xdmcp_chooser_display_prepare       (GdmDisplay *display);
+static gboolean gdm_xdmcp_chooser_display_finish        (GdmDisplay *display);
 
 G_DEFINE_TYPE (GdmXdmcpChooserDisplay, gdm_xdmcp_chooser_display, GDM_TYPE_XDMCP_DISPLAY)
 
 static void
-on_hostname_selected (GdmDBusXdmcpChooserSlave *proxy,
+on_hostname_selected (GdmXdmcpChooserSlave     *slave,
                       const char               *hostname,
                       GdmXdmcpChooserDisplay   *display)
 {
@@ -77,57 +65,13 @@ on_hostname_selected (GdmDBusXdmcpChooserSlave *proxy,
         g_signal_emit (display, signals [HOSTNAME_SELECTED], 0, hostname);
 }
 
-static gboolean
-gdm_xdmcp_chooser_display_set_slave_bus_name (GdmDisplay *display,
-                                              const char *name,
-                                              GError    **error)
-{
-        GDBusConnection *connection;
-        GError          *local_error;
-        GdmXdmcpChooserDisplay *chooser_display;
-
-        chooser_display = GDM_XDMCP_CHOOSER_DISPLAY (display);
-        g_clear_object (&chooser_display->priv->slave_proxy);
-
-        local_error = NULL;
-        connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
-        if (connection == NULL) {
-                g_critical ("error getting system bus: %s", local_error->message);
-                g_error_free (local_error);
-        }
-
-        g_debug ("GdmXdmcpChooserDisplay: creating proxy for slave on %s" , name);
-
-        chooser_display->priv->slave_proxy = GDM_DBUS_XDMCP_CHOOSER_SLAVE (
-                gdm_dbus_xdmcp_chooser_slave_proxy_new_sync (connection,
-                                                             G_DBUS_PROXY_FLAGS_NONE,
-                                                             name,
-                                                             GDM_SLAVE_PATH,
-                                                             NULL,
-                                                             &local_error));
-        if (chooser_display->priv->slave_proxy == NULL) {
-                g_warning ("Failed to connect to the slave object: %s", local_error->message);
-                g_error_free (local_error);
-                goto out;
-        }
-
-        g_signal_connect (chooser_display->priv->slave_proxy,
-                          "hostname-selected",
-                          G_CALLBACK (on_hostname_selected),
-                          display);
- out:
-        return GDM_DISPLAY_CLASS (gdm_xdmcp_chooser_display_parent_class)->set_slave_bus_name (display, 
name, error);
-}
-
 static void
 gdm_xdmcp_chooser_display_class_init (GdmXdmcpChooserDisplayClass *klass)
 {
         GObjectClass    *object_class = G_OBJECT_CLASS (klass);
         GdmDisplayClass *display_class = GDM_DISPLAY_CLASS (klass);
 
-        object_class->finalize = gdm_xdmcp_chooser_display_finalize;
-
-        display_class->set_slave_bus_name = gdm_xdmcp_chooser_display_set_slave_bus_name;
+        display_class->prepare = gdm_xdmcp_chooser_display_prepare;
         display_class->finish = gdm_xdmcp_chooser_display_finish;
 
         signals [HOSTNAME_SELECTED] =
@@ -141,32 +85,27 @@ gdm_xdmcp_chooser_display_class_init (GdmXdmcpChooserDisplayClass *klass)
                               G_TYPE_NONE,
                               1,
                               G_TYPE_STRING);
-
-        g_type_class_add_private (klass, sizeof (GdmXdmcpChooserDisplayPrivate));
 }
 
 static void
 gdm_xdmcp_chooser_display_init (GdmXdmcpChooserDisplay *xdmcp_chooser_display)
 {
-
-        xdmcp_chooser_display->priv = GDM_XDMCP_CHOOSER_DISPLAY_GET_PRIVATE (xdmcp_chooser_display);
 }
 
-static void
-gdm_xdmcp_chooser_display_finalize (GObject *object)
+static gboolean
+gdm_xdmcp_chooser_display_prepare (GdmDisplay *display)
 {
-        GdmXdmcpChooserDisplay *chooser_display;
+        GdmXdmcpChooserSlave *slave;
 
-        g_return_if_fail (object != NULL);
-        g_return_if_fail (GDM_IS_XDMCP_CHOOSER_DISPLAY (object));
+        if (!GDM_DISPLAY_CLASS (gdm_xdmcp_chooser_display_parent_class)->prepare (display))
+                return FALSE;
 
-        chooser_display = GDM_XDMCP_CHOOSER_DISPLAY (object);
+        slave = GDM_XDMCP_CHOOSER_SLAVE (gdm_display_get_slave (display));
 
-        g_return_if_fail (chooser_display->priv != NULL);
+        g_signal_connect (slave, "hostname-selected",
+                          G_CALLBACK (on_hostname_selected), display);
 
-        g_clear_object (&chooser_display->priv->slave_proxy);
-
-        G_OBJECT_CLASS (gdm_xdmcp_chooser_display_parent_class)->finalize (object);
+        return TRUE;
 }
 
 static gboolean
@@ -192,7 +131,7 @@ gdm_xdmcp_chooser_display_new (const char              *hostname,
 
         x11_display = g_strdup_printf ("%s:%d", hostname, number);
         object = g_object_new (GDM_TYPE_XDMCP_CHOOSER_DISPLAY,
-                               "slave-command", DEFAULT_SLAVE_COMMAND,
+                               "slave-type", GDM_TYPE_XDMCP_CHOOSER_SLAVE,
                                "remote-hostname", hostname,
                                "x11-display-number", number,
                                "x11-display-name", x11_display,
diff --git a/daemon/gdm-xdmcp-chooser-display.h b/daemon/gdm-xdmcp-chooser-display.h
index 86cef65..7890afa 100644
--- a/daemon/gdm-xdmcp-chooser-display.h
+++ b/daemon/gdm-xdmcp-chooser-display.h
@@ -43,7 +43,6 @@ typedef struct GdmXdmcpChooserDisplayPrivate GdmXdmcpChooserDisplayPrivate;
 typedef struct
 {
         GdmXdmcpDisplay                parent;
-        GdmXdmcpChooserDisplayPrivate *priv;
 } GdmXdmcpChooserDisplay;
 
 typedef struct
diff --git a/daemon/gdm-xdmcp-chooser-slave.c b/daemon/gdm-xdmcp-chooser-slave.c
index 7745c74..890584a 100644
--- a/daemon/gdm-xdmcp-chooser-slave.c
+++ b/daemon/gdm-xdmcp-chooser-slave.c
@@ -39,7 +39,6 @@
 #include "gdm-common.h"
 
 #include "gdm-xdmcp-chooser-slave.h"
-#include "gdm-xdmcp-chooser-slave-glue.h"
 
 #include "gdm-server.h"
 #include "gdm-launch-environment.h"
@@ -65,17 +64,21 @@ struct GdmXdmcpChooserSlavePrivate
         guint              connection_attempts;
 
         GdmLaunchEnvironment *chooser_environment;
+};
 
-        GdmDBusXdmcpChooserSlave *skeleton;
+enum {
+        HOSTNAME_SELECTED,
+        LAST_SIGNAL
 };
 
+static guint signals [LAST_SIGNAL] = { 0, };
+
 static void     gdm_xdmcp_chooser_slave_class_init     (GdmXdmcpChooserSlaveClass *klass);
 static void     gdm_xdmcp_chooser_slave_init           (GdmXdmcpChooserSlave      *xdmcp_chooser_slave);
 static void     gdm_xdmcp_chooser_slave_finalize       (GObject                   *object);
 
 G_DEFINE_TYPE (GdmXdmcpChooserSlave, gdm_xdmcp_chooser_slave, GDM_TYPE_SLAVE)
 
-
 static void
 on_chooser_session_opened (GdmLaunchEnvironment    *chooser,
                            GdmXdmcpChooserSlave *slave)
@@ -137,8 +140,7 @@ on_chooser_hostname_selected (GdmSession           *session,
                               GdmXdmcpChooserSlave *slave)
 {
         g_debug ("GdmXdmcpChooserSlave: connecting to host %s", name);
-        gdm_dbus_xdmcp_chooser_slave_emit_hostname_selected (slave->priv->skeleton,
-                                                             name);
+        g_signal_emit (slave, signals [HOSTNAME_SELECTED], 0, name);
 }
 
 static void
@@ -345,37 +347,29 @@ gdm_xdmcp_chooser_slave_stop (GdmSlave *slave)
         return TRUE;
 }
 
-static GObject *
-gdm_xdmcp_chooser_slave_constructor (GType                  type,
-                                     guint                  n_construct_properties,
-                                     GObjectConstructParam *construct_properties)
-{
-        GdmXdmcpChooserSlave *slave;
-
-        slave = GDM_XDMCP_CHOOSER_SLAVE (G_OBJECT_CLASS (gdm_xdmcp_chooser_slave_parent_class)->constructor 
(type,
-                                                                                 n_construct_properties,
-                                                                                 construct_properties));
-
-        slave->priv->skeleton = GDM_DBUS_XDMCP_CHOOSER_SLAVE (gdm_dbus_xdmcp_chooser_slave_skeleton_new ());
-        gdm_slave_export_interface (GDM_SLAVE (slave),
-                                    G_DBUS_INTERFACE_SKELETON (slave->priv->skeleton));
-
-        return G_OBJECT (slave);
-}
-
 static void
 gdm_xdmcp_chooser_slave_class_init (GdmXdmcpChooserSlaveClass *klass)
 {
         GObjectClass  *object_class = G_OBJECT_CLASS (klass);
         GdmSlaveClass *slave_class = GDM_SLAVE_CLASS (klass);
 
-        object_class->constructor = gdm_xdmcp_chooser_slave_constructor;
         object_class->finalize = gdm_xdmcp_chooser_slave_finalize;
 
         slave_class->start = gdm_xdmcp_chooser_slave_start;
         slave_class->stop = gdm_xdmcp_chooser_slave_stop;
 
         g_type_class_add_private (klass, sizeof (GdmXdmcpChooserSlavePrivate));
+
+        signals [HOSTNAME_SELECTED] =
+                g_signal_new ("hostname-selected",
+                              G_TYPE_FROM_CLASS (object_class),
+                              G_SIGNAL_RUN_LAST,
+                              0,
+                              NULL,
+                              NULL,
+                              NULL,
+                              G_TYPE_NONE,
+                              1, G_TYPE_STRING);
 }
 
 static void
@@ -394,25 +388,9 @@ gdm_xdmcp_chooser_slave_finalize (GObject *object)
 
         xdmcp_chooser_slave = GDM_XDMCP_CHOOSER_SLAVE (object);
 
-        g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (xdmcp_chooser_slave->priv->skeleton));
-
-        g_clear_object (&xdmcp_chooser_slave->priv->skeleton);
-
         g_return_if_fail (xdmcp_chooser_slave->priv != NULL);
 
         gdm_slave_stop (GDM_SLAVE (xdmcp_chooser_slave));
 
         G_OBJECT_CLASS (gdm_xdmcp_chooser_slave_parent_class)->finalize (object);
 }
-
-GdmSlave *
-gdm_xdmcp_chooser_slave_new (const char *id)
-{
-        GObject *object;
-
-        object = g_object_new (GDM_TYPE_XDMCP_CHOOSER_SLAVE,
-                               "display-id", id,
-                               NULL);
-
-        return GDM_SLAVE (object);
-}
diff --git a/daemon/gdm-xdmcp-chooser-slave.h b/daemon/gdm-xdmcp-chooser-slave.h
index e5b5e47..b948ef8 100644
--- a/daemon/gdm-xdmcp-chooser-slave.h
+++ b/daemon/gdm-xdmcp-chooser-slave.h
@@ -49,7 +49,6 @@ typedef struct
 } GdmXdmcpChooserSlaveClass;
 
 GType               gdm_xdmcp_chooser_slave_get_type   (void);
-GdmSlave *          gdm_xdmcp_chooser_slave_new        (const char       *id);
 
 G_END_DECLS
 
diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
index b392879..6fbf079 100644
--- a/daemon/gdm-xdmcp-display-factory.c
+++ b/daemon/gdm-xdmcp-display-factory.c
@@ -2354,11 +2354,13 @@ gdm_xdmcp_handle_request (GdmXdmcpDisplayFactory *factory,
                                 ARRAY8  authorization_name;
                                 ARRAY8  authorization_data;
                                 gint32  session_number;
-                                GArray *cookie;
+                                const char *x11_cookie;
+                                gsize x11_cookie_size;
                                 char   *name;
 
-                                cookie = NULL;
-                                gdm_display_get_x11_cookie (display, &cookie, NULL);
+                                x11_cookie = NULL;
+                                x11_cookie_size = 0;
+                                gdm_display_get_x11_cookie (display, &x11_cookie, &x11_cookie_size, NULL);
 
                                 name = NULL;
                                 gdm_display_get_x11_display_name (display, &name, NULL);
@@ -2366,12 +2368,12 @@ gdm_xdmcp_handle_request (GdmXdmcpDisplayFactory *factory,
                                 g_debug ("GdmXdmcpDisplayFactory: Sending authorization key for display %s", 
name ? name : "(null)");
                                 g_free (name);
 
-                                g_debug ("GdmXdmcpDisplayFactory: cookie len %d", (int) cookie->len);
+                                g_debug ("GdmXdmcpDisplayFactory: cookie len %d", (int) x11_cookie_size);
 
                                 session_number = gdm_xdmcp_display_get_session_number (GDM_XDMCP_DISPLAY 
(display));
 
                                 /* the send accept will fail if cookie is null */
-                                g_assert (cookie != NULL);
+                                g_assert (x11_cookie != NULL);
 
                                 authentication_name.data   = NULL;
                                 authentication_name.length = 0;
@@ -2381,8 +2383,8 @@ gdm_xdmcp_handle_request (GdmXdmcpDisplayFactory *factory,
                                 authorization_name.data     = (CARD8 *) "MIT-MAGIC-COOKIE-1";
                                 authorization_name.length   = strlen ((char *) authorization_name.data);
 
-                                authorization_data.data     = (CARD8 *) cookie->data;
-                                authorization_data.length   = cookie->len;
+                                authorization_data.data     = (CARD8 *) x11_cookie;
+                                authorization_data.length   = x11_cookie_size;
 
                                 /* the addrs are NOT copied */
                                 gdm_xdmcp_send_accept (factory,
@@ -2392,8 +2394,6 @@ gdm_xdmcp_handle_request (GdmXdmcpDisplayFactory *factory,
                                                        &authentication_data,
                                                        &authorization_name,
                                                        &authorization_data);
-
-                                g_array_free (cookie, TRUE);
                         }
                 }
         } else {



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