[gdm/wip/slave-connection: 16/33] daemon: Port GdmSession to use GDBus



commit bf5989d5d398d10c82bf0522f232575a9a6f0ec1
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon May 7 18:58:11 2012 +0200

    daemon: Port GdmSession to use GDBus
    
    GdmSession is an object in the slave that manages
    the various session worker processes.  Each session
    worker process talks to PAM to perform authentication
    for the user. For instance, if the user has a fingerprint
    reader, then there will normally be two worker processes,
    one for handling fingerprint auth, and one for handling
    password auth.  GdmSession is the interface layer in the
    slave to talking to those running worker processes.
    
    This commit ports GdmSession over to GDBus from dbus-glib.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622888

 .gitignore                   |    3 +-
 daemon/Makefile.am           |   24 +-
 daemon/gdm-session.c         | 1946 ++++++++++++------------------------------
 daemon/gdm-session.h         |   13 -
 daemon/gdm-session.xml       |  159 ++++
 daemon/gdm-simple-slave.c    |  260 +++----
 daemon/gdm-welcome-session.c |   59 +-
 daemon/test-session.c        |   31 +-
 8 files changed, 862 insertions(+), 1633 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a85ccae..d681463 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,7 +35,8 @@ gdm.pot
 gdm-restart
 gdm-safe-restart
 gdm.schemas
-gdm-session-direct-glue.h
+gdm-session-glue.h
+gdm-session-glue.c
 gdm-settings-glue.h
 gdm-settings-glue.c
 gdm-simple-greeter.desktop.in
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index f827b1b..43c0c9a 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -40,6 +40,7 @@ BUILT_SOURCES =					\
 	gdm-transient-display-glue.h		\
 	gdm-local-display-factory-glue.h	\
 	gdm-greeter-glue.h			\
+	gdm-session-glue.h			\
 	$(NULL)
 
 gdm-manager-glue.h: gdm-manager.xml Makefile.am
@@ -68,6 +69,13 @@ gdm-local-display-factory-glue.c gdm-local-display-factory-glue.h : gdm-local-di
 		--generate-c-code=gdm-local-display-factory-glue	\
 		$(srcdir)/gdm-local-display-factory.xml
 
+gdm-session-glue.c gdm-session-glue.h : gdm-session.xml Makefile.am
+	$(AM_V_GEN)gdbus-codegen 					\
+		--c-namespace=GdmDBus					\
+		--interface-prefix=org.gnome.DisplayManager		\
+		--generate-c-code=gdm-session-glue			\
+		$(srcdir)/gdm-session.xml
+
 gdm-greeter-glue.c gdm-greeter-glue.h : gdm-greeter-server.xml Makefile.am
 	$(AM_V_GEN)gdbus-codegen 					\
 		--c-namespace=GdmDBus					\
@@ -86,6 +94,13 @@ test_session_SOURCES = 		\
 	gdm-session-record.c	\
 	gdm-session-record.h	\
 	gdm-session-worker-job.c\
+	gdm-dbus-util.c		\
+	gdm-dbus-util.h		\
+	$(NULL)
+
+nodist_test_session_SOURCES = 	\
+	gdm-session-glue.c	\
+	gdm-session-glue.h	\
 	$(NULL)
 
 test_session_LDADD =		\
@@ -137,6 +152,8 @@ gdm_simple_slave_SOURCES = 		\
 nodist_gdm_simple_slave_SOURCES = 	\
 	gdm-greeter-glue.c		\
 	gdm-greeter-glue.h		\
+	gdm-session-glue.c		\
+	gdm-session-glue.h		\
 	$(NULL)
 
 gdm_simple_slave_LDFLAGS =		\
@@ -176,6 +193,11 @@ gdm_xdmcp_chooser_slave_SOURCES = 		\
 	gdm-dbus-util.h				\
 	$(NULL)
 
+nodist_gdm_xdmcp_chooser_slave_SOURCES = 	\
+	gdm-session-glue.c			\
+	gdm-session-glue.h			\
+	$(NULL)
+
 gdm_xdmcp_chooser_slave_LDADD = 		\
 	$(XLIB_LIBS)				\
 	$(DAEMON_LIBS)				\
@@ -296,6 +318,7 @@ CLEANFILES =					\
 	gdm					\
 	gdm-greeter-glue.c			\
 	gdm-local-display-factory-glue.c	\
+	gdm-session-glue.c			\
 	$(BUILT_SOURCES)			\
 	$(NULL)
 
@@ -305,7 +328,6 @@ EXTRA_DIST = 				\
 	gdm-slave.xml			\
 	gdm-simple-slave.xml		\
 	gdm-xdmcp-chooser-slave.xml	\
-	gdm-session.xml			\
 	gdm-manager.xml			\
 	gdm-display.xml			\
 	gdm-xdmcp-greeter-display.xml	\
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b333843..c1a7394 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -41,19 +41,17 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <glib-object.h>
+#include <gio/gio.h>
 
 #ifdef HAVE_LIBXKLAVIER
 #include <libxklavier/xklavier.h>
 #include <X11/Xlib.h> /* for Display */
 #endif
 
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#include "gdm-session.h"
-#include "gdm-session-private.h"
 #include "gdm-session-glue.h"
+#include "gdm-dbus-util.h"
 
+#include "gdm-session.h"
 #include "gdm-session-record.h"
 #include "gdm-session-worker-job.h"
 #include "gdm-common.h"
@@ -72,8 +70,10 @@ typedef struct
         GdmSessionWorkerJob   *job;
         GPid                   worker_pid;
         char                  *service_name;
-        DBusConnection        *worker_connection;
-        DBusMessage           *message_pending_reply;
+        GDBusConnection       *worker_connection;
+        GDBusMethodInvocation *pending_invocation;
+        GdmDBusSession        *worker_skeleton;
+        char                  *session_id;
         guint32                is_stopping : 1;
 } GdmSessionConversation;
 
@@ -107,10 +107,8 @@ struct _GdmSessionPrivate
 
         char                *fallback_session_name;
 
-        DBusServer          *server;
-        char                *server_address;
+        GDBusServer         *server;
         GHashTable          *environment;
-        DBusGConnection     *connection;
 };
 
 enum {
@@ -130,8 +128,6 @@ enum {
         SERVICE_UNAVAILABLE,
         SETUP_COMPLETE,
         SETUP_FAILED,
-        RESET_COMPLETE,
-        RESET_FAILED,
         AUTHENTICATED,
         AUTHENTICATION_FAILED,
         AUTHORIZED,
@@ -160,319 +156,6 @@ G_DEFINE_TYPE (GdmSession,
                gdm_session,
                G_TYPE_OBJECT);
 
-static gboolean
-send_dbus_message (GdmSessionConversation *conversation,
-                   DBusMessage            *message)
-{
-        gboolean is_connected;
-        gboolean sent;
-
-        g_return_val_if_fail (message != NULL, FALSE);
-
-        if (conversation->worker_connection == NULL) {
-                g_warning ("There is no valid connection");
-                return FALSE;
-        }
-
-        is_connected = dbus_connection_get_is_connected (conversation->worker_connection);
-        if (! is_connected) {
-                g_warning ("Not connected!");
-                return FALSE;
-        }
-
-        sent = dbus_connection_send (conversation->worker_connection, message, NULL);
-
-        return sent;
-}
-
-static void
-send_dbus_string_signal (GdmSessionConversation *conversation,
-                         const char             *name,
-                         const char             *text)
-{
-        DBusMessage    *message;
-        DBusMessageIter iter;
-
-        g_return_if_fail (conversation != NULL);
-
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           name);
-
-        dbus_message_iter_init_append (message, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &text);
-
-        if (! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal",
-                         name ? name : "(null)");
-        }
-
-        dbus_message_unref (message);
-}
-
-static void
-send_dbus_void_signal (GdmSessionConversation *conversation,
-                       const char             *name)
-{
-        DBusMessage *message;
-
-        g_return_if_fail (conversation != NULL);
-
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           name);
-
-        if (! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal", name);
-        }
-
-        dbus_message_unref (message);
-}
-
-static void
-emit_service_unavailable (GdmSession   *self,
-                          const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SERVICE_UNAVAILABLE], 0, service_name);
-}
-
-static void
-emit_setup_complete (GdmSession   *self,
-                     const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SETUP_COMPLETE], 0, service_name);
-}
-
-static void
-emit_setup_failed (GdmSession   *self,
-                   const char   *service_name,
-                   const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SETUP_FAILED], 0, service_name, text);
-}
-
-static void
-emit_reset_complete (GdmSession   *self)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [RESET_COMPLETE], 0);
-}
-
-static void
-emit_reset_failed (GdmSession   *self,
-                   const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [RESET_FAILED], 0, text);
-}
-
-static void
-emit_authenticated (GdmSession   *self,
-                    const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [AUTHENTICATED], 0, service_name);
-}
-
-static void
-emit_authentication_failed (GdmSession   *self,
-                            const char   *service_name,
-                            const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [AUTHENTICATION_FAILED], 0, service_name, text);
-}
-
-static void
-emit_authorized (GdmSession   *self,
-                 const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [AUTHORIZED], 0, service_name);
-}
-
-static void
-emit_authorization_failed (GdmSession   *self,
-                           const char   *service_name,
-                           const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [AUTHORIZATION_FAILED], 0, service_name, text);
-}
-
-static void
-emit_accredited (GdmSession   *self,
-                 const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [ACCREDITED], 0, service_name);
-}
-
-static void
-emit_accreditation_failed (GdmSession   *self,
-                           const char   *service_name,
-                           const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [ACCREDITATION_FAILED], 0, service_name, text);
-}
-
-static void
-emit_info_query (GdmSession   *self,
-                 const char   *service_name,
-                 const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [INFO_QUERY], 0, service_name, text);
-}
-
-static void
-emit_secret_info_query (GdmSession   *self,
-                        const char   *service_name,
-                        const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SECRET_INFO_QUERY], 0, service_name, text);
-}
-
-static void
-emit_info (GdmSession   *self,
-           const char   *service_name,
-           const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [INFO], 0, service_name, text);
-}
-
-static void
-emit_problem (GdmSession   *self,
-              const char   *service_name,
-              const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [PROBLEM], 0, service_name, text);
-}
-
-static void
-emit_session_opened (GdmSession   *self,
-                     const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_OPENED], 0, service_name);
-}
-
-static void
-emit_session_open_failed (GdmSession   *self,
-                          const char   *service_name,
-                          const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_OPEN_FAILED], 0, service_name, text);
-}
-
-static void
-emit_session_started (GdmSession   *self,
-                      const char   *service_name,
-                      int           pid)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_STARTED], 0, service_name, pid);
-}
-
-static void
-emit_session_start_failed (GdmSession   *self,
-                           const char   *service_name,
-                           const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_START_FAILED], 0, service_name, text);
-}
-
-static void
-emit_session_exited (GdmSession   *self,
-                     int           exit_code)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_EXITED], 0, exit_code);
-}
-
-static void
-emit_session_died (GdmSession   *self,
-                   int           signal_number)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SESSION_DIED], 0, signal_number);
-}
-
-static void
-emit_conversation_started (GdmSession   *self,
-                           const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [CONVERSATION_STARTED], 0, service_name);
-}
-
-static void
-emit_conversation_stopped (GdmSession   *self,
-                           const char   *service_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [CONVERSATION_STOPPED], 0, service_name);
-}
-
-static void
-emit_default_language_name_changed (GdmSession   *self,
-                                    const char   *language_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [DEFAULT_LANGUAGE_NAME_CHANGED], 0, language_name);
-}
-
-static void
-emit_default_session_name_changed (GdmSession   *self,
-                                   const char   *session_name)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [DEFAULT_SESSION_NAME_CHANGED], 0, session_name);
-}
-
-static void
-emit_selected_user_changed (GdmSession   *self,
-                            const char   *text)
-{
-        g_return_if_fail (GDM_IS_SESSION (self));
-
-        g_signal_emit (self, signals [SELECTED_USER_CHANGED], 0, text);
-}
-
 static GdmSessionConversation *
 find_conversation_by_name (GdmSession *self,
                            const char *service_name)
@@ -550,249 +233,134 @@ on_session_exited (GdmSession *self,
                                    self->priv->display_device);
 }
 
-
-static DBusHandlerResult
-gdm_session_handle_service_unavailable (GdmSession             *self,
-                                        GdmSessionConversation *conversation,
-                                        DBusMessage            *message)
+static gboolean
+gdm_session_handle_service_unavailable (GdmDBusSession        *skeleton,
+                                        GDBusMethodInvocation *invocation,
+                                        const char            *service_name,
+                                        const char            *message,
+                                        GdmSession            *self)
 {
-        DBusMessage *reply;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'service-unavailable' signal");
+        g_signal_emit (self, signals[SERVICE_UNAVAILABLE], 0, service_name);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_service_unavailable (self, conversation->service_name);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_setup_complete (GdmSession             *self,
-                                   GdmSessionConversation *conversation,
-                                   DBusMessage            *message)
+static gboolean
+gdm_session_handle_setup_complete (GdmDBusSession        *skeleton,
+                                   GDBusMethodInvocation *invocation,
+                                   const char            *service_name,
+                                   GdmSession            *self)
 {
-        DBusMessage *reply;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'setup-complete' signal");
+        g_signal_emit (self, signals[SETUP_COMPLETE], 0, service_name);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_setup_complete (self, conversation->service_name);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_setup_failed (GdmSession             *self,
-                                 GdmSessionConversation *conversation,
-                                 DBusMessage            *message)
+static gboolean
+gdm_session_handle_setup_failed (GdmDBusSession        *skeleton,
+                                 GDBusMethodInvocation *invocation,
+                                 const char            *service_name,
+                                 const char            *message,
+                                 GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'setup-failed' signal");
+        g_signal_emit (self, signals[SETUP_FAILED], 0, service_name, message);
 
-        emit_setup_failed (self, conversation->service_name, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-static DBusHandlerResult
-gdm_session_handle_reset_complete (GdmSession             *self,
-                                   GdmSessionConversation *conversation,
-                                   DBusMessage            *message)
-{
-        DBusMessage *reply;
-
-        g_debug ("GdmSession: Emitting 'reset-complete' signal");
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_reset_complete (self);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_reset_failed (GdmSession             *self,
-                                 GdmSessionConversation *conversation,
-                                 DBusMessage            *message)
-{
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
 
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        g_debug ("GdmSession: Emitting 'reset-failed' signal");
-
-        emit_reset_failed (self, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-gdm_session_handle_authenticated (GdmSession             *self,
-                                  GdmSessionConversation *conversation,
-                                  DBusMessage            *message)
+static gboolean
+gdm_session_handle_authenticated (GdmDBusSession        *skeleton,
+                                  GDBusMethodInvocation *invocation,
+                                  const char            *service_name,
+                                  GdmSession            *self)
 {
-        DBusMessage *reply;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'authenticated' signal");
+        g_signal_emit (self, signals[AUTHENTICATED], 0, service_name);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_authenticated (self, conversation->service_name);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_authentication_failed (GdmSession             *self,
-                                          GdmSessionConversation *conversation,
-                                          DBusMessage            *message)
+static gboolean
+gdm_session_handle_authentication_failed (GdmDBusSession        *skeleton,
+                                          GDBusMethodInvocation *invocation,
+                                          const char            *service_name,
+                                          const char            *message,
+                                          GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'authentication-failed' signal");
+        g_signal_emit (self, signals[AUTHENTICATION_FAILED], 0, service_name, message);
 
-        emit_authentication_failed (self, conversation->service_name, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_authorized (GdmSession             *self,
-                               GdmSessionConversation *conversation,
-                               DBusMessage            *message)
+static gboolean
+gdm_session_handle_authorized (GdmDBusSession        *skeleton,
+                               GDBusMethodInvocation *invocation,
+                               const char            *service_name,
+                               GdmSession            *self)
 {
-        DBusMessage *reply;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'authorized' signal");
+        g_signal_emit (self, signals[AUTHORIZED], 0, service_name);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_authorized (self, conversation->service_name);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_authorization_failed (GdmSession             *self,
-                                         GdmSessionConversation *conversation,
-                                         DBusMessage            *message)
+static gboolean
+gdm_session_handle_authorization_failed (GdmDBusSession        *skeleton,
+                                         GDBusMethodInvocation *invocation,
+                                         const char            *service_name,
+                                         const char            *message,
+                                         GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'authorization-failed' signal");
-
-        emit_authorization_failed (self, conversation->service_name, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        g_signal_emit (self, signals[AUTHORIZATION_FAILED], 0, service_name, message);
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_accredited (GdmSession             *self,
-                               GdmSessionConversation *conversation,
-                               DBusMessage            *message)
+static gboolean
+gdm_session_handle_accredited (GdmDBusSession        *skeleton,
+                               GDBusMethodInvocation *invocation,
+                               const char            *service_name,
+                               GdmSession            *self)
 {
-        DBusMessage *reply;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'accredited' signal");
+        g_signal_emit (self, signals[ACCREDITED], 0, service_name);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        emit_accredited (self, conversation->service_name);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_accreditation_failed (GdmSession             *self,
-                                         GdmSessionConversation *conversation,
-                                         DBusMessage            *message)
+static gboolean
+gdm_session_handle_accreditation_failed (GdmDBusSession        *skeleton,
+                                         GDBusMethodInvocation *invocation,
+                                         const char            *service_name,
+                                         const char            *message,
+                                         GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'accreditation-failed' signal");
-
-        emit_accreditation_failed (self, conversation->service_name, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        g_signal_emit (self, signals[ACCREDITATION_FAILED], 0, service_name, message);
+        return TRUE;
 }
 
 static const char **
@@ -1040,10 +608,15 @@ get_default_session_name (GdmSession *self)
 static void
 gdm_session_defaults_changed (GdmSession *self)
 {
-        emit_default_language_name_changed (self,
-                                            get_default_language_name (self));
-        emit_default_session_name_changed (self,
-                                           get_default_session_name (self));
+        g_signal_emit (self,
+                       signals[DEFAULT_LANGUAGE_NAME_CHANGED],
+                       0,
+                       get_default_language_name (self));
+
+        g_signal_emit (self,
+                       signals[DEFAULT_SESSION_NAME_CHANGED],
+                       0,
+                       get_default_session_name (self));
 }
 
 void
@@ -1063,426 +636,266 @@ gdm_session_select_user (GdmSession *self,
         self->priv->saved_language = NULL;
 }
 
-static DBusHandlerResult
-gdm_session_handle_username_changed (GdmSession             *self,
-                                     GdmSessionConversation *conversation,
-                                     DBusMessage            *message)
+static gboolean
+gdm_session_handle_username_changed (GdmDBusSession        *skeleton,
+                                     GDBusMethodInvocation *invocation,
+                                     const char            *service_name,
+                                     const char            *text,
+                                     GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: changing username from '%s' to '%s'",
                  self->priv->selected_user != NULL ? self->priv->selected_user : "<unset>",
                  (strlen (text)) ? text : "<unset>");
 
         gdm_session_select_user (self, (strlen (text) > 0) ? g_strdup (text) : NULL);
-
-        emit_selected_user_changed (self, self->priv->selected_user);
+        g_signal_emit (self, signals[SELECTED_USER_CHANGED], 0, self->priv->selected_user);
 
         gdm_session_defaults_changed (self);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
 static void
 cancel_pending_query (GdmSessionConversation *conversation)
 {
-        DBusMessage *reply;
-
-        if (conversation->message_pending_reply == NULL) {
+        if (conversation->pending_invocation == NULL) {
                 return;
         }
 
         g_debug ("GdmSession: Cancelling pending query");
 
-        reply = dbus_message_new_error (conversation->message_pending_reply,
-                                        GDM_SESSION_DBUS_ERROR_CANCEL,
-                                        "Operation cancelled");
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_connection_flush (conversation->worker_connection);
-
-        dbus_message_unref (reply);
-        dbus_message_unref (conversation->message_pending_reply);
-        conversation->message_pending_reply = NULL;
+        g_dbus_method_invocation_return_dbus_error (conversation->pending_invocation,
+                                                    GDM_SESSION_DBUS_ERROR_CANCEL,
+                                                    "Operation cancelled");
+        conversation->pending_invocation = NULL;
 }
 
 static void
 answer_pending_query (GdmSessionConversation *conversation,
                       const char             *answer)
 {
-        DBusMessage    *reply;
-        DBusMessageIter iter;
-
-        reply = dbus_message_new_method_return (conversation->message_pending_reply);
-        dbus_message_iter_init_append (reply, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &answer);
-
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        dbus_message_unref (conversation->message_pending_reply);
-        conversation->message_pending_reply = NULL;
+        g_dbus_method_invocation_return_value (conversation->pending_invocation,
+                                               g_variant_new ("(s)", answer));
+        conversation->pending_invocation = NULL;
 }
 
 static void
 set_pending_query (GdmSessionConversation *conversation,
-                   DBusMessage            *message)
+                   GDBusMethodInvocation  *message)
 {
-        g_assert (conversation->message_pending_reply == NULL);
+        g_assert (conversation->pending_invocation == NULL);
 
-        conversation->message_pending_reply = dbus_message_ref (message);
+        conversation->pending_invocation = g_object_ref (message);
 }
 
-static DBusHandlerResult
-gdm_session_handle_info_query (GdmSession             *self,
-                               GdmSessionConversation *conversation,
-                               DBusMessage            *message)
+static gboolean
+gdm_session_handle_info_query (GdmDBusSession        *skeleton,
+                               GDBusMethodInvocation *invocation,
+                               const char            *service_name,
+                               const char            *text,
+                               GdmSession            *self)
 {
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
+        GdmSessionConversation *conversation;
 
-        set_pending_query (conversation, message);
+        conversation = find_conversation_by_name (self, service_name);
+        set_pending_query (conversation, invocation);
 
         g_debug ("GdmSession: Emitting 'info-query' signal");
-        emit_info_query (self, conversation->service_name, text);
+        g_signal_emit (self, signals[INFO_QUERY], 0, service_name, text);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_secret_info_query (GdmSession             *self,
-                                      GdmSessionConversation *conversation,
-                                      DBusMessage            *message)
+static gboolean
+gdm_session_handle_secret_info_query (GdmDBusSession        *skeleton,
+                                      GDBusMethodInvocation *invocation,
+                                      const char            *service_name,
+                                      const char            *text,
+                                      GdmSession            *self)
 {
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
+        GdmSessionConversation *conversation;
 
-        set_pending_query (conversation, message);
+        conversation = find_conversation_by_name (self, service_name);
+        set_pending_query (conversation, invocation);
 
         g_debug ("GdmSession: Emitting 'secret-info-query' signal");
-        emit_secret_info_query (self, conversation->service_name, text);
+        g_signal_emit (self, signals[SECRET_INFO_QUERY], 0, service_name, text);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_info (GdmSession             *self,
-                         GdmSessionConversation *conversation,
-                         DBusMessage            *message)
+static gboolean
+gdm_session_handle_info (GdmDBusSession        *skeleton,
+                         GDBusMethodInvocation *invocation,
+                         const char            *service_name,
+                         const char            *text,
+                         GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'info' signal");
-        emit_info (self, conversation->service_name, text);
+        g_signal_emit (self, signals[INFO], 0, service_name, text);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_cancel_pending_query (GdmSession             *self,
-                                         GdmSessionConversation *conversation,
-                                         DBusMessage            *message)
+static gboolean
+gdm_session_handle_cancel_pending_query (GdmDBusSession        *skeleton,
+                                         GDBusMethodInvocation *invocation,
+                                         const char            *service_name,
+                                         GdmSession            *self)
 {
-        DBusMessage *reply;
-
-        g_debug ("GdmSession: worker cancelling pending query");
+        GdmSessionConversation *conversation;
 
+        conversation = find_conversation_by_name (self, service_name);
         cancel_pending_query (conversation);
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_problem (GdmSession             *self,
-                            GdmSessionConversation *conversation,
-                            DBusMessage            *message)
+static gboolean
+gdm_session_handle_problem (GdmDBusSession        *skeleton,
+                            GDBusMethodInvocation *invocation,
+                            const char            *service_name,
+                            const char            *text,
+                            GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'problem' signal");
-        emit_problem (self, conversation->service_name, text);
+        g_signal_emit (self, signals[PROBLEM], 0, service_name, text);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_session_opened (GdmSession             *self,
-                                   GdmSessionConversation *conversation,
-                                   DBusMessage            *message)
+static gboolean
+gdm_session_handle_opened (GdmDBusSession        *skeleton,
+                           GDBusMethodInvocation *invocation,
+                           const char            *service_name,
+                           GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-
-        g_debug ("GdmSession: Handling SessionOpened");
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error, DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'session-opened' signal");
+        g_signal_emit (self, signals[SESSION_OPENED], 0, service_name);
 
-        emit_session_opened (self, conversation->service_name);
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_open_failed (GdmSession             *self,
-                                GdmSessionConversation *conversation,
-                                DBusMessage            *message)
+static gboolean
+gdm_session_handle_open_failed (GdmDBusSession        *skeleton,
+                                GDBusMethodInvocation *invocation,
+                                const char            *service_name,
+                                const char            *message,
+                                GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         g_debug ("GdmSession: Emitting 'session-open-failed' signal");
-        emit_session_open_failed (self, conversation->service_name, text);
+        g_signal_emit (self, signals[SESSION_OPEN_FAILED], 0, service_name, message);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_session_started (GdmSession             *self,
-                                    GdmSessionConversation *conversation,
-                                    DBusMessage            *message)
+static gboolean
+gdm_session_handle_session_started (GdmDBusSession        *skeleton,
+                                    GDBusMethodInvocation *invocation,
+                                    const char            *service_name,
+                                    const char            *session_id,
+                                    int                    pid,
+                                    GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        int          pid;
-
-        pid = 0;
-
-        g_debug ("GdmSession: Handling SessionStarted");
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_INT32, &pid,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
+        GdmSessionConversation *conversation;
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
-        g_debug ("GdmSession: Emitting 'session-started' signal with pid '%d'",
-                 pid);
+        conversation = find_conversation_by_name (self, service_name);
 
         self->priv->session_pid = pid;
         self->priv->session_conversation = conversation;
 
-        emit_session_started (self, conversation->service_name, pid);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-gdm_session_handle_start_failed (GdmSession             *self,
-                                 GdmSessionConversation *conversation,
-                                 DBusMessage            *message)
-{
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *text;
+        g_clear_pointer (&conversation->session_id,
+                         (GDestroyNotify) g_free);
 
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &text,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
+        if (session_id != NULL && session_id[0] != '\0') {
+                conversation->session_id = g_strdup (session_id);
         }
 
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_debug ("GdmSession: Emitting 'session-started' signal with pid '%d'", pid);
+        g_signal_emit (self, signals[SESSION_STARTED], 0, service_name, pid);
 
-        g_debug ("GdmSession: Emitting 'session-start-failed' signal");
-        emit_session_start_failed (self, conversation->service_name, text);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_session_exited (GdmSession             *self,
-                                   GdmSessionConversation *conversation,
-                                   DBusMessage            *message)
+static gboolean
+gdm_session_handle_session_start_failed (GdmDBusSession        *skeleton,
+                                         GDBusMethodInvocation *invocation,
+                                         const char            *service_name,
+                                         const char            *message,
+                                         GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        int          code;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_INT32, &code,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        g_debug ("GdmSession: Emitting 'session-exited' signal with exit code '%d'",
-                 code);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
-        self->priv->session_conversation = NULL;
-        emit_session_exited (self, code);
+        g_debug ("GdmSession: Emitting 'session-start-failed' signal");
+        g_signal_emit (self, signals[SESSION_START_FAILED], 0, service_name, message);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_session_died (GdmSession             *self,
-                                 GdmSessionConversation *conversation,
-                                 DBusMessage            *message)
+static gboolean
+gdm_session_handle_session_exited_or_died (GdmDBusSession        *skeleton,
+                                           GDBusMethodInvocation *invocation,
+                                           const char            *service_name,
+                                           int                    status,
+                                           GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        int          code;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_INT32, &code,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
-
-        g_debug ("GdmSession: Emitting 'session-died' signal with signal number '%d'",
-                 code);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         self->priv->session_conversation = NULL;
-        emit_session_died (self, code);
 
-        return DBUS_HANDLER_RESULT_HANDLED;
+        if (WIFEXITED (status)) {
+                g_debug ("GdmSession: Emitting 'session-exited' signal with exit code '%d'",
+                  WEXITSTATUS (status));
+                g_signal_emit (self, signals[SESSION_EXITED], 0, WEXITSTATUS (status));
+        } else if (WIFSIGNALED (status)) {
+                g_debug ("GdmSession: Emitting 'session-died' signal with signal number '%d'",
+                  WTERMSIG (status));
+                g_signal_emit (self, signals[SESSION_DIED], 0, WTERMSIG (status));
+        }
+
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_saved_language_name_read (GdmSession             *self,
-                                             GdmSessionConversation *conversation,
-                                             DBusMessage            *message)
+static gboolean
+gdm_session_handle_saved_language_name_read (GdmDBusSession        *skeleton,
+                                             GDBusMethodInvocation *invocation,
+                                             const char            *language_name,
+                                             GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *language_name;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &language_name,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         if (strcmp (language_name,
                     get_default_language_name (self)) != 0) {
                 g_free (self->priv->saved_language);
                 self->priv->saved_language = g_strdup (language_name);
 
-                emit_default_language_name_changed (self, language_name);
+                g_signal_emit (self, signals[DEFAULT_LANGUAGE_NAME_CHANGED], 0, language_name);
         }
 
-
-        return DBUS_HANDLER_RESULT_HANDLED;
+        return TRUE;
 }
 
-static DBusHandlerResult
-gdm_session_handle_saved_session_name_read (GdmSession             *self,
-                                            GdmSessionConversation *conversation,
-                                            DBusMessage            *message)
+static gboolean
+gdm_session_handle_saved_session_name_read (GdmDBusSession        *skeleton,
+                                            GDBusMethodInvocation *invocation,
+                                            const char            *session_name,
+                                            GdmSession            *self)
 {
-        DBusMessage *reply;
-        DBusError    error;
-        const char  *session_name;
-
-        dbus_error_init (&error);
-        if (! dbus_message_get_args (message, &error,
-                                     DBUS_TYPE_STRING, &session_name,
-                                     DBUS_TYPE_INVALID)) {
-                g_warning ("ERROR: %s", error.message);
-        }
-
-        reply = dbus_message_new_method_return (message);
-        dbus_connection_send (conversation->worker_connection, reply, NULL);
-        dbus_message_unref (reply);
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
         if (! get_session_command_for_name (session_name, NULL)) {
                 /* ignore sessions that don't exist */
@@ -1497,317 +910,10 @@ gdm_session_handle_saved_session_name_read (GdmSession             *self,
                 g_free (self->priv->saved_session);
                 self->priv->saved_session = g_strdup (session_name);
 
-                emit_default_session_name_changed (self, session_name);
+                g_signal_emit (self, signals[DEFAULT_SESSION_NAME_CHANGED], 0, session_name);
         }
  out:
-        return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-session_worker_message (DBusConnection *connection,
-                        DBusMessage    *message,
-                        void           *user_data)
-{
-        GdmSessionConversation *conversation = user_data;
-        GdmSession *session;
-
-        session = conversation->session;
-
-        if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "InfoQuery")) {
-                return gdm_session_handle_info_query (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SecretInfoQuery")) {
-                return gdm_session_handle_secret_info_query (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Info")) {
-                return gdm_session_handle_info (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Problem")) {
-                return gdm_session_handle_problem (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "CancelPendingQuery")) {
-                return gdm_session_handle_cancel_pending_query (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "ServiceUnavailable")) {
-                return gdm_session_handle_service_unavailable (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SetupComplete")) {
-                return gdm_session_handle_setup_complete (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SetupFailed")) {
-                return gdm_session_handle_setup_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "ResetComplete")) {
-                return gdm_session_handle_reset_complete (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "ResetFailed")) {
-                return gdm_session_handle_reset_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Authenticated")) {
-                return gdm_session_handle_authenticated (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "AuthenticationFailed")) {
-                return gdm_session_handle_authentication_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Authorized")) {
-                return gdm_session_handle_authorized (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "AuthorizationFailed")) {
-                return gdm_session_handle_authorization_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Accredited")) {
-                return gdm_session_handle_accredited (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "AccreditationFailed")) {
-                return gdm_session_handle_accreditation_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "UsernameChanged")) {
-                return gdm_session_handle_username_changed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionOpened")) {
-                return gdm_session_handle_session_opened (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "OpenFailed")) {
-                return gdm_session_handle_open_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionStarted")) {
-                return gdm_session_handle_session_started (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "StartFailed")) {
-                return gdm_session_handle_start_failed (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionExited")) {
-                return gdm_session_handle_session_exited (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionDied")) {
-                return gdm_session_handle_session_died (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SavedLanguageNameRead")) {
-                return gdm_session_handle_saved_language_name_read (session, conversation, message);
-        } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SavedSessionNameRead")) {
-                return gdm_session_handle_saved_session_name_read (session, conversation, message);
-        }
-
-        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult
-do_introspect (DBusConnection *connection,
-               DBusMessage    *message)
-{
-        DBusMessage *reply;
-        GString     *xml;
-        char        *xml_string;
-
-        g_debug ("GdmSession: Do introspect");
-
-        /* standard header */
-        xml = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
-                            "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>\n"
-                            "<node>\n"
-                            "  <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
-                            "    <method name=\"Introspect\">\n"
-                            "      <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
-                            "    </method>\n"
-                            "  </interface>\n");
-
-        /* interface */
-        xml = g_string_append (xml,
-                               "  <interface name=\"org.gnome.DisplayManager.Session\">\n"
-                               "    <method name=\"SetupComplete\">\n"
-                               "    </method>\n"
-                               "    <method name=\"SetupFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"ResetComplete\">\n"
-                               "    </method>\n"
-                               "    <method name=\"ResetFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"Authenticated\">\n"
-                               "    </method>\n"
-                               "    <method name=\"AuthenticationFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"Authorized\">\n"
-                               "    </method>\n"
-                               "    <method name=\"AuthorizationFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"Accredited\">\n"
-                               "    </method>\n"
-                               "    <method name=\"AccreditationFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"CancelPendingQuery\">\n"
-                               "    </method>\n"
-                               "    <method name=\"InfoQuery\">\n"
-                               "      <arg name=\"query\" direction=\"in\" type=\"s\"/>\n"
-                               "      <arg name=\"answer\" direction=\"out\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"SecretInfoQuery\">\n"
-                               "      <arg name=\"query\" direction=\"in\" type=\"s\"/>\n"
-                               "      <arg name=\"answer\" direction=\"out\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"Info\">\n"
-                               "      <arg name=\"text\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"Problem\">\n"
-                               "      <arg name=\"text\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"UsernameChanged\">\n"
-                               "      <arg name=\"text\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"StartFailed\">\n"
-                               "      <arg name=\"message\" direction=\"in\" type=\"s\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"SessionStarted\">\n"
-                               "      <arg name=\"pid\" direction=\"in\" type=\"i\"/>\n"
-                               "      <arg name=\"environment\" direction=\"in\" type=\"as\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"SessionExited\">\n"
-                               "      <arg name=\"code\" direction=\"in\" type=\"i\"/>\n"
-                               "    </method>\n"
-                               "    <method name=\"SessionDied\">\n"
-                               "      <arg name=\"signal\" direction=\"in\" type=\"i\"/>\n"
-                               "    </method>\n"
-                               "    <signal name=\"Reset\">\n"
-                               "    </signal>\n"
-                               "    <signal name=\"Setup\">\n"
-                               "      <arg name=\"service_name\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_display_name\" type=\"s\"/>\n"
-                               "      <arg name=\"display_device\" type=\"s\"/>\n"
-                               "      <arg name=\"display_seat\" type=\"s\"/>\n"
-                               "      <arg name=\"hostname\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_authority_file\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetupForUser\">\n"
-                               "      <arg name=\"service_name\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_display_name\" type=\"s\"/>\n"
-                               "      <arg name=\"display_device\" type=\"s\"/>\n"
-                               "      <arg name=\"display_seat\" type=\"s\"/>\n"
-                               "      <arg name=\"hostname\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_authority_file\" type=\"s\"/>\n"
-                               "      <arg name=\"username\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetupForProgram\">\n"
-                               "      <arg name=\"service_name\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_display_name\" type=\"s\"/>\n"
-                               "      <arg name=\"display_device\" type=\"s\"/>\n"
-                               "      <arg name=\"display_seat\" type=\"s\"/>\n"
-                               "      <arg name=\"hostname\" type=\"s\"/>\n"
-                               "      <arg name=\"x11_authority_file\" type=\"s\"/>\n"
-                               "      <arg name=\"log_file\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"Authenticate\">\n"
-                               "    </signal>\n"
-                               "    <signal name=\"Authorize\">\n"
-                               "    </signal>\n"
-                               "    <signal name=\"EstablishCredentials\">\n"
-                               "    </signal>\n"
-                               "    <signal name=\"RefreshCredentials\">\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetEnvironmentVariable\">\n"
-                               "      <arg name=\"name\" type=\"s\"/>\n"
-                               "      <arg name=\"value\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetLanguageName\">\n"
-                               "      <arg name=\"language_name\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetSessionName\">\n"
-                               "      <arg name=\"session_name\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"SetSessionType\">\n"
-                               "      <arg name=\"session_type\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "    <signal name=\"StartProgram\">\n"
-                               "      <arg name=\"command\" type=\"s\"/>\n"
-                               "    </signal>\n"
-                               "  </interface>\n");
-
-        reply = dbus_message_new_method_return (message);
-
-        xml = g_string_append (xml, "</node>\n");
-        xml_string = g_string_free (xml, FALSE);
-
-        dbus_message_append_args (reply,
-                                  DBUS_TYPE_STRING, &xml_string,
-                                  DBUS_TYPE_INVALID);
-
-        g_free (xml_string);
-
-        if (reply == NULL) {
-                g_error ("No memory");
-        }
-
-        if (! dbus_connection_send (connection, reply, NULL)) {
-                g_error ("No memory");
-        }
-
-        dbus_message_unref (reply);
-
-        return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-session_message_handler (DBusConnection  *connection,
-                         DBusMessage     *message,
-                         void            *user_data)
-{
-        const char *dbus_destination = dbus_message_get_destination (message);
-        const char *dbus_path        = dbus_message_get_path (message);
-        const char *dbus_interface   = dbus_message_get_interface (message);
-        const char *dbus_member      = dbus_message_get_member (message);
-
-        g_debug ("session_message_handler: destination=%s obj_path=%s interface=%s method=%s",
-                 dbus_destination ? dbus_destination : "(null)",
-                 dbus_path        ? dbus_path        : "(null)",
-                 dbus_interface   ? dbus_interface   : "(null)",
-                 dbus_member      ? dbus_member      : "(null)");
-
-        if (dbus_message_is_method_call (message, "org.freedesktop.DBus", "AddMatch")) {
-                DBusMessage *reply;
-
-                reply = dbus_message_new_method_return (message);
-
-                if (reply == NULL) {
-                        g_error ("No memory");
-                }
-
-                if (! dbus_connection_send (connection, reply, NULL)) {
-                        g_error ("No memory");
-                }
-
-                dbus_message_unref (reply);
-
-                return DBUS_HANDLER_RESULT_HANDLED;
-        } else if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
-                   strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) {
-
-                g_debug ("GdmSession: Disconnected");
-
-                /*dbus_connection_unref (connection);*/
-
-                return DBUS_HANDLER_RESULT_HANDLED;
-        } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
-                return do_introspect (connection, message);
-        } else {
-                return session_worker_message (connection, message, user_data);
-        }
-
-        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* Note: Use abstract sockets like dbus does by default on Linux. Abstract
- * sockets are only available on Linux.
- */
-static char *
-generate_address (void)
-{
-        char *path;
-#if defined (__linux__)
-        int   i;
-        char  tmp[9];
-
-        for (i = 0; i < 8; i++) {
-                if (g_random_int_range (0, 2) == 0) {
-                        tmp[i] = g_random_int_range ('a', 'z' + 1);
-                } else {
-                        tmp[i] = g_random_int_range ('A', 'Z' + 1);
-                }
-        }
-        tmp[8] = '\0';
-
-        path = g_strdup_printf ("unix:abstract=/tmp/gdm-session-%s", tmp);
-#else
-        path = g_strdup ("unix:tmpdir=/tmp");
-#endif
-
-        return path;
-}
-
-static void
-session_unregister_handler (DBusConnection  *connection,
-                            void            *user_data)
-{
-        g_debug ("session_unregister_handler");
+        return TRUE;
 }
 
 static GdmSessionConversation *
@@ -1831,33 +937,55 @@ find_conversation_by_pid (GdmSession *self,
         return NULL;
 }
 
-static dbus_bool_t
-allow_user_function (DBusConnection *connection,
-                     unsigned long   uid,
-                     void           *data)
+static gboolean
+allow_user_function (GDBusAuthObserver *observer,
+                     GIOStream         *stream,
+                     GCredentials      *credentials)
 {
-        if (0 == uid) {
+        if (g_credentials_get_unix_user (credentials, NULL) == 0)
                 return TRUE;
-        }
 
         g_debug ("GdmSession: User not allowed");
 
         return FALSE;
 }
 
+static GPid
+credentials_get_unix_pid (GCredentials *credentials)
+{
+        GPid pid = 0;
+        gpointer native_credentials = NULL;
+
+#ifdef __linux__
+        native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_LINUX_UCRED);
+        pid = (GPid) ((struct ucred *) native_credentials)->pid;
+#elif defined (__FreeBSD__)
+        native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
+        pid = (GPid) ((struct cmsgcred *) native_credentials)->cmcred_pid;
+#elif defined (__OpenBSD__)
+        native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
+        pid = (GPid) ((struct sockpeercred *) native_credentials)->pid;
+#else
+#error "platform not supported, need mechanism to detect pid of connected process"
+#endif
+
+        return pid;
+}
+
 static gboolean
-register_worker (GdmSession *self,
-                 DBusConnection   *connection)
+register_worker (GdmDBusSession        *skeleton,
+                 GDBusMethodInvocation *invocation,
+                 GdmSession            *self)
 {
         GdmSessionConversation *conversation;
-        DBusObjectPathVTable vtable = { &session_unregister_handler,
-                                        &session_message_handler,
-                                        NULL, NULL, NULL, NULL };
+        GDBusConnection *connection;
         GList *connection_node;
-        gulong pid;
+        GCredentials *credentials;
+        GPid pid;
 
         g_debug ("GdmSession: Authenticating new connection");
 
+        connection = g_dbus_method_invocation_get_connection (invocation);
         connection_node = g_list_find (self->priv->pending_connections, connection);
 
         if (connection_node == NULL) {
@@ -1869,68 +997,42 @@ register_worker (GdmSession *self,
                 g_list_delete_link (self->priv->pending_connections,
                                     connection_node);
 
-        if (!dbus_connection_get_unix_process_id (connection, &pid)) {
-                g_warning ("GdmSession: Unable to read pid on new worker connection");
-                dbus_connection_unref (connection);
-                return FALSE;
-        }
+        credentials = g_dbus_connection_get_peer_credentials (connection);
+        pid = credentials_get_unix_pid (credentials);
 
         conversation = find_conversation_by_pid (self, (GPid) pid);
 
         if (conversation == NULL) {
                 g_warning ("GdmSession: New worker connection is from unknown source");
-                dbus_connection_unref (connection);
-                return FALSE;
+
+                g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
+                                                       G_DBUS_ERROR_ACCESS_DENIED,
+                                                       "Connection is not from a known conversation");
+                g_dbus_connection_close_sync (connection, NULL, NULL);
+                return TRUE;
         }
 
-        conversation->worker_connection = connection;
+        g_dbus_method_invocation_return_value (invocation, NULL);
 
+        conversation->worker_connection = g_object_ref (connection);
+        conversation->worker_skeleton = g_object_ref (skeleton);
         g_debug ("GdmSession: worker connection is %p", connection);
 
-        dbus_connection_register_object_path (connection,
-                                              GDM_SESSION_DBUS_PATH,
-                                              &vtable,
-                                              conversation);
-
         g_debug ("GdmSession: Emitting conversation-started signal");
-        emit_conversation_started (self, conversation->service_name);
+        g_signal_emit (self, signals[CONVERSATION_STARTED], 0, conversation->service_name);
 
         g_debug ("GdmSession: Conversation started");
 
         return TRUE;
 }
 
-static DBusHandlerResult
-on_message (DBusConnection *connection,
-            DBusMessage    *message,
-            void           *user_data)
+static gboolean
+handle_connection (GDBusServer      *server,
+                   GDBusConnection  *connection,
+                   GdmSession       *self)
 {
-        GdmSession *self = GDM_SESSION (user_data);
-
-        g_debug ("GdmSession: got message");
+        GdmDBusSession *skeleton;
 
-        if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Hello")) {
-                DBusMessage *reply;
-
-                if (register_worker (self, connection)) {
-                        reply = dbus_message_new_method_return (message);
-                } else {
-                        reply = dbus_message_new_error (message, DBUS_ERROR_FAILED, "");
-                }
-
-                dbus_connection_send (connection, reply, NULL);
-                return DBUS_HANDLER_RESULT_HANDLED;
-        }
-
-        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static void
-handle_connection (DBusServer      *server,
-                   DBusConnection  *new_connection,
-                   void            *user_data)
-{
-        GdmSession *self = GDM_SESSION (user_data);
         g_debug ("GdmSession: Handing new connection");
 
         /* add to the list of pending connections.  We won't be able to
@@ -1939,57 +1041,144 @@ handle_connection (DBusServer      *server,
          */
         self->priv->pending_connections =
                 g_list_prepend (self->priv->pending_connections,
-                                dbus_connection_ref (new_connection));
-        dbus_connection_setup_with_g_main (new_connection, NULL);
-        dbus_connection_set_exit_on_disconnect (new_connection, FALSE);
+                                g_object_ref (connection));
+
+        skeleton = GDM_DBUS_SESSION (gdm_dbus_session_skeleton_new ());
+        g_signal_connect (skeleton,
+                          "handle-hello",
+                          G_CALLBACK (register_worker),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-info-query",
+                          G_CALLBACK (gdm_session_handle_info_query),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-secret-info-query",
+                          G_CALLBACK (gdm_session_handle_secret_info_query),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-info",
+                          G_CALLBACK (gdm_session_handle_info),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-problem",
+                          G_CALLBACK (gdm_session_handle_problem),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-cancel-pending-query",
+                          G_CALLBACK (gdm_session_handle_cancel_pending_query),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-service-unavailable",
+                          G_CALLBACK (gdm_session_handle_service_unavailable),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-setup-complete",
+                          G_CALLBACK (gdm_session_handle_setup_complete),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-setup-failed",
+                          G_CALLBACK (gdm_session_handle_setup_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-authenticated",
+                          G_CALLBACK (gdm_session_handle_authenticated),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-authentication-failed",
+                          G_CALLBACK (gdm_session_handle_authentication_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-authorized",
+                          G_CALLBACK (gdm_session_handle_authorized),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-authorization-failed",
+                          G_CALLBACK (gdm_session_handle_authorization_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-accredited",
+                          G_CALLBACK (gdm_session_handle_accredited),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-accreditation-failed",
+                          G_CALLBACK (gdm_session_handle_accreditation_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-username-changed",
+                          G_CALLBACK (gdm_session_handle_username_changed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-opened",
+                          G_CALLBACK (gdm_session_handle_opened),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-open-failed",
+                          G_CALLBACK (gdm_session_handle_open_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-session-started",
+                          G_CALLBACK (gdm_session_handle_session_started),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-session-start-failed",
+                          G_CALLBACK (gdm_session_handle_session_start_failed),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-session-exited",
+                          G_CALLBACK (gdm_session_handle_session_exited_or_died),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-saved-language-name-read",
+                          G_CALLBACK (gdm_session_handle_saved_language_name_read),
+                          self);
+        g_signal_connect (skeleton,
+                          "handle-saved-session-name-read",
+                          G_CALLBACK (gdm_session_handle_saved_session_name_read),
+                          self);
+
+        g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton),
+                                          connection,
+                                          "/org/gnome/DisplayManager/Session",
+                                          NULL);
 
-        dbus_connection_set_unix_user_function (new_connection,
-                                                allow_user_function,
-                                                self,
-                                                NULL);
-        dbus_connection_add_filter (new_connection, on_message, self, NULL);
+        return TRUE;
 }
 
-static gboolean
+static void
 setup_server (GdmSession *self)
 {
-        DBusError   error;
-        gboolean    ret;
-        char       *address;
-        const char *auth_mechanisms[] = {"EXTERNAL", NULL};
-
-        ret = FALSE;
+        GDBusAuthObserver *observer;
+        GDBusServer *server;
+        GError *error = NULL;
 
         g_debug ("GdmSession: Creating D-Bus server for session");
 
-        address = generate_address ();
+        observer = g_dbus_auth_observer_new ();
+        g_signal_connect (observer,
+                          "authorize-authenticated-peer",
+                          G_CALLBACK (allow_user_function),
+                          NULL);
 
-        dbus_error_init (&error);
-        self->priv->server = dbus_server_listen (address, &error);
-        g_free (address);
+        server = gdm_dbus_setup_private_server (observer, &error);
+        g_object_unref (observer);
 
-        if (self->priv->server == NULL) {
-                g_warning ("Cannot create D-BUS server for the session: %s", error.message);
+        if (server == NULL) {
+                g_warning ("Cannot create D-BUS server for the session: %s", error->message);
                 /* FIXME: should probably fail if we can't create the socket */
-                goto out;
+                return;
         }
 
-        dbus_server_setup_with_g_main (self->priv->server, NULL);
-        dbus_server_set_auth_mechanisms (self->priv->server, auth_mechanisms);
-        dbus_server_set_new_connection_function (self->priv->server,
-                                                 handle_connection,
-                                                 self,
-                                                 NULL);
-        ret = TRUE;
-
-        g_free (self->priv->server_address);
-        self->priv->server_address = dbus_server_get_address (self->priv->server);
+        g_signal_connect (server,
+                          "new-connection",
+                          G_CALLBACK (handle_connection),
+                          self);
+        self->priv->server = server;
 
-        g_debug ("GdmSession: D-Bus server listening on %s", self->priv->server_address);
+        g_dbus_server_start (server);
 
- out:
-
-        return ret;
+        g_debug ("GdmSession: D-Bus server listening on %s",
+        g_dbus_server_get_client_address (self->priv->server));
 }
 
 static void
@@ -2038,7 +1227,6 @@ gdm_session_init (GdmSession *self)
                                                          (GDestroyNotify) g_free);
 
         setup_server (self);
-
 }
 
 static void
@@ -2053,19 +1241,19 @@ worker_exited (GdmSessionWorkerJob    *job,
                int                     code,
                GdmSessionConversation *conversation)
 {
+        GdmSession *self = conversation->session;
 
         g_debug ("GdmSession: Worker job exited: %d", code);
 
         g_object_ref (conversation->job);
-        if (conversation->session->priv->session_conversation == conversation) {
-                emit_session_exited (GDM_SESSION (conversation->session), code);
+        if (self->priv->session_conversation == conversation) {
+                g_signal_emit (self, signals[SESSION_EXITED], 0, code);
         }
 
-        g_hash_table_steal (conversation->session->priv->conversations, conversation->service_name);
+        g_hash_table_steal (self->priv->conversations, conversation->service_name);
 
         g_debug ("GdmSession: Emitting conversation-stopped signal");
-        emit_conversation_stopped (GDM_SESSION (conversation->session),
-                                   conversation->service_name);
+        g_signal_emit (self, signals[CONVERSATION_STOPPED], 0, conversation->service_name);
         g_object_unref (conversation->job);
 
         if (conversation->is_stopping) {
@@ -2081,19 +1269,19 @@ worker_died (GdmSessionWorkerJob    *job,
              int                     signum,
              GdmSessionConversation *conversation)
 {
+        GdmSession *self = conversation->session;
 
         g_debug ("GdmSession: Worker job died: %d", signum);
 
         g_object_ref (conversation->job);
-        if (conversation->session->priv->session_conversation == conversation) {
-                emit_session_died (GDM_SESSION (conversation->session), signum);
+        if (self->priv->session_conversation == conversation) {
+                g_signal_emit (self, signals[SESSION_DIED], 0, signum);
         }
 
-        g_hash_table_steal (conversation->session->priv->conversations, conversation->service_name);
+        g_hash_table_steal (self->priv->conversations, conversation->service_name);
 
         g_debug ("GdmSession: Emitting conversation-stopped signal");
-        emit_conversation_stopped (GDM_SESSION (conversation->session),
-                                   conversation->service_name);
+        g_signal_emit (self, signals[CONVERSATION_STOPPED], 0, conversation->service_name);
         g_object_unref (conversation->job);
 
         if (conversation->is_stopping) {
@@ -2116,7 +1304,8 @@ start_conversation (GdmSession *self,
         conversation->service_name = g_strdup (service_name);
         conversation->worker_pid = -1;
         conversation->job = gdm_session_worker_job_new ();
-        gdm_session_worker_job_set_server_address (conversation->job, self->priv->server_address);
+        gdm_session_worker_job_set_server_address (conversation->job,
+                                                   g_dbus_server_get_client_address (self->priv->server));
         g_signal_connect (conversation->job,
                           "started",
                           G_CALLBACK (worker_started),
@@ -2149,15 +1338,9 @@ start_conversation (GdmSession *self,
 static void
 stop_conversation (GdmSessionConversation *conversation)
 {
-        GdmSession *session;
-
-        session = conversation->session;
-
         if (conversation->worker_connection != NULL) {
-                dbus_connection_remove_filter (conversation->worker_connection, on_message, session);
-
-                dbus_connection_close (conversation->worker_connection);
-                conversation->worker_connection = NULL;
+                g_dbus_connection_close_sync (conversation->worker_connection, NULL, NULL);
+                g_clear_object (&conversation->worker_connection);
         }
 
         conversation->is_stopping = TRUE;
@@ -2167,20 +1350,15 @@ stop_conversation (GdmSessionConversation *conversation)
 static void
 stop_conversation_now (GdmSessionConversation *conversation)
 {
-        GdmSession *session;
-
-        session = conversation->session;
+        g_clear_object (&conversation->worker_skeleton);
 
         if (conversation->worker_connection != NULL) {
-                dbus_connection_remove_filter (conversation->worker_connection, on_message, session);
-
-                dbus_connection_close (conversation->worker_connection);
-                conversation->worker_connection = NULL;
+                g_dbus_connection_close_sync (conversation->worker_connection, NULL, NULL);
+                g_clear_object (&conversation->worker_connection);
         }
 
         gdm_session_worker_job_stop_now (conversation->job);
-        g_object_unref (conversation->job);
-        conversation->job = NULL;
+        g_clear_object (&conversation->job);
 }
 
 void
@@ -2234,8 +1412,6 @@ static void
 send_setup (GdmSession *self,
             const char *service_name)
 {
-        DBusMessage    *message;
-        DBusMessageIter iter;
         const char     *display_name;
         const char     *display_device;
         const char     *display_seat_id;
@@ -2273,32 +1449,22 @@ send_setup (GdmSession *self,
 
         g_debug ("GdmSession: Beginning setup");
 
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           "Setup");
-
-        dbus_message_iter_init_append (message, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &service_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_device);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_seat_id);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_hostname);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_x11_authority_file);
-
         conversation = find_conversation_by_name (self, service_name);
-        if (conversation != NULL && ! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal", "Setup");
+        if (conversation != NULL) {
+                gdm_dbus_session_emit_setup (conversation->worker_skeleton,
+                                             service_name,
+                                             display_name,
+                                             display_x11_authority_file,
+                                             display_device,
+                                             display_seat_id,
+                                             display_hostname);
         }
-
-        dbus_message_unref (message);
 }
 
 static void
 send_setup_for_user (GdmSession *self,
                      const char *service_name)
 {
-        DBusMessage    *message;
-        DBusMessageIter iter;
         const char     *display_name;
         const char     *display_device;
         const char     *display_seat_id;
@@ -2309,6 +1475,8 @@ send_setup_for_user (GdmSession *self,
 
         g_assert (service_name != NULL);
 
+        conversation = find_conversation_by_name (self, service_name);
+
         if (self->priv->display_name != NULL) {
                 display_name = self->priv->display_name;
         } else {
@@ -2342,25 +1510,16 @@ send_setup_for_user (GdmSession *self,
 
         g_debug ("GdmSession: Beginning setup for user %s", self->priv->selected_user);
 
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           "SetupForUser");
-
-        dbus_message_iter_init_append (message, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &service_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_device);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_seat_id);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_hostname);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_x11_authority_file);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &selected_user);
-
-        conversation = find_conversation_by_name (self, service_name);
-        if (conversation != NULL && ! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal", "SetupForUser");
+        if (conversation != NULL) {
+                gdm_dbus_session_emit_setup_for_user (conversation->worker_skeleton,
+                                                      service_name,
+                                                      selected_user,
+                                                      display_name,
+                                                      display_x11_authority_file,
+                                                      display_device,
+                                                      display_seat_id,
+                                                      display_hostname);
         }
-
-        dbus_message_unref (message);
 }
 
 static void
@@ -2368,8 +1527,6 @@ send_setup_for_program (GdmSession *self,
                         const char *service_name,
                         const char *log_file)
 {
-        DBusMessage    *message;
-        DBusMessageIter iter;
         const char     *display_name;
         const char     *display_device;
         const char     *display_seat_id;
@@ -2407,25 +1564,17 @@ send_setup_for_program (GdmSession *self,
 
         g_debug ("GdmSession: Beginning setup for session for program with log '%s'", log_file);
 
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           "SetupForProgram");
-
-        dbus_message_iter_init_append (message, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &service_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_name);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_device);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_seat_id);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_hostname);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &display_x11_authority_file);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &log_file);
-
         conversation = find_conversation_by_name (self, service_name);
-        if (conversation != NULL && ! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal", "SetupForProgram");
+        if (conversation != NULL) {
+                gdm_dbus_session_emit_setup_for_program (conversation->worker_skeleton,
+                                                         service_name,
+                                                         display_name,
+                                                         display_x11_authority_file,
+                                                         display_device,
+                                                         display_seat_id,
+                                                         display_hostname,
+                                                         log_file);
         }
-
-        dbus_message_unref (message);
 }
 
 void
@@ -2439,6 +1588,26 @@ gdm_session_setup (GdmSession *self,
         gdm_session_defaults_changed (self);
 }
 
+typedef struct {
+        GdmSession *instance;
+        char       *service_name;
+} SetupForUserClosure;
+
+static gboolean
+emit_setup_complete (gpointer data)
+{
+        SetupForUserClosure *closure = data;
+
+        g_signal_emit (closure->instance, signals[SETUP_COMPLETE], 0, closure->service_name);
+
+        g_free (closure->service_name);
+        g_object_unref (closure->instance);
+
+        g_slice_free (SetupForUserClosure, data);
+
+        return G_SOURCE_REMOVE;
+}
+
 void
 gdm_session_setup_for_user (GdmSession *self,
                             const char *service_name,
@@ -2448,10 +1617,23 @@ gdm_session_setup_for_user (GdmSession *self,
         g_return_if_fail (GDM_IS_SESSION (self));
         g_return_if_fail (username != NULL);
 
-        gdm_session_select_user (self, username);
+        if (self->priv->session_conversation != NULL &&
+            g_strcmp0 (self->priv->session_conversation->service_name, service_name) == 0) {
+                SetupForUserClosure *closure;
 
-        send_setup_for_user (self, service_name);
-        gdm_session_defaults_changed (self);
+                g_warn_if_fail (g_strcmp0 (self->priv->selected_user, username) == 0);
+
+                closure = g_slice_new (SetupForUserClosure);
+                closure->instance = g_object_ref (self);
+                closure->service_name = g_strdup (service_name);
+
+                g_idle_add (emit_setup_complete, closure);
+        } else {
+                gdm_session_select_user (self, username);
+
+                send_setup_for_user (self, service_name);
+                gdm_session_defaults_changed (self);
+        }
 }
 
 void
@@ -2475,7 +1657,8 @@ gdm_session_authenticate (GdmSession *self,
 
         conversation = find_conversation_by_name (self, service_name);
         if (conversation != NULL) {
-                send_dbus_void_signal (conversation, "Authenticate");
+                gdm_dbus_session_emit_authenticate (conversation->worker_skeleton,
+                                                    service_name);
         }
 }
 
@@ -2489,14 +1672,15 @@ gdm_session_authorize (GdmSession *self,
 
         conversation = find_conversation_by_name (self, service_name);
         if (conversation != NULL) {
-                send_dbus_void_signal (conversation, "Authorize");
+                gdm_dbus_session_emit_authorize (conversation->worker_skeleton,
+                                                 service_name);
         }
 }
 
 void
 gdm_session_accredit (GdmSession *self,
                       const char *service_name,
-                      int         cred_flag)
+                      gboolean    refresh)
 {
         GdmSessionConversation *conversation;
 
@@ -2507,15 +1691,14 @@ gdm_session_accredit (GdmSession *self,
                 return;
         }
 
-        switch (cred_flag) {
-        case GDM_SESSION_CRED_ESTABLISH:
-                send_dbus_void_signal (conversation, "EstablishCredentials");
-                break;
-        case GDM_SESSION_CRED_REFRESH:
-                send_dbus_void_signal (conversation, "RefreshCredentials");
-                break;
-        default:
-                g_assert_not_reached ();
+        if (refresh) {
+                /* FIXME: need to support refresh
+                 */
+                gdm_dbus_session_emit_establish_credentials (conversation->worker_skeleton,
+                                                             service_name);
+        } else {
+                gdm_dbus_session_emit_establish_credentials (conversation->worker_skeleton,
+                                                             service_name);
         }
 }
 
@@ -2524,26 +1707,13 @@ send_environment_variable (const char             *key,
                            const char             *value,
                            GdmSessionConversation *conversation)
 {
-        DBusMessage    *message;
-        DBusMessageIter iter;
-
-        message = dbus_message_new_signal (GDM_SESSION_DBUS_PATH,
-                                           GDM_SESSION_DBUS_INTERFACE,
-                                           "SetEnvironmentVariable");
-
-        dbus_message_iter_init_append (message, &iter);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &key);
-        dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &value);
-
-        if (! send_dbus_message (conversation, message)) {
-                g_debug ("GdmSession: Could not send %s signal", "SetEnvironmentVariable");
-        }
-
-        dbus_message_unref (message);
+        gdm_dbus_session_emit_set_environment_variable (conversation->worker_skeleton,
+                                                        key,
+                                                        value);
 }
 
 static void
-send_environment (GdmSession       *self,
+send_environment (GdmSession             *self,
                   GdmSessionConversation *conversation)
 {
 
@@ -2598,7 +1768,6 @@ gdm_session_set_environment_variable (GdmSession *self,
                                       const char *key,
                                       const char *value)
 {
-
         g_return_if_fail (key != NULL);
         g_return_if_fail (value != NULL);
 
@@ -2668,13 +1837,14 @@ gdm_session_open_session (GdmSession *self,
 
         conversation = find_conversation_by_name (self, service_name);
 
-        send_dbus_string_signal (conversation, "OpenSession", service_name);
+        gdm_dbus_session_emit_open_session (conversation->worker_skeleton,
+                                            service_name);
 }
 
 static void
-stop_all_other_conversations (GdmSession              *self,
-                              GdmSessionConversation  *conversation_to_keep,
-                              gboolean                 now)
+stop_all_other_conversations (GdmSession             *self,
+                              GdmSessionConversation *conversation_to_keep,
+                              gboolean                now)
 {
         GHashTableIter iter;
         gpointer key, value;
@@ -2686,8 +1856,8 @@ stop_all_other_conversations (GdmSession              *self,
         if (conversation_to_keep == NULL) {
                 g_debug ("GdmSession: Stopping all conversations");
         } else {
-                g_debug ("GdmSession: Stopping all conversations "
-                         "except for %s", conversation_to_keep->service_name);
+                g_debug ("GdmSession: Stopping all conversations except for %s",
+                         conversation_to_keep->service_name);
         }
 
         g_hash_table_iter_init (&iter, self->priv->conversations);
@@ -2764,7 +1934,8 @@ gdm_session_start_session (GdmSession *self,
         setup_session_environment (self);
         send_environment (self, conversation);
 
-        send_dbus_string_signal (conversation, "StartProgram", program);
+        gdm_dbus_session_emit_start_program (conversation->worker_skeleton,
+                                             program);
         g_free (program);
 }
 
@@ -2792,9 +1963,7 @@ gdm_session_close (GdmSession *self)
 
         stop_all_conversations (self);
 
-        g_list_foreach (self->priv->pending_connections,
-                        (GFunc) dbus_connection_unref, NULL);
-        g_list_free (self->priv->pending_connections);
+        g_list_free_full (self->priv->pending_connections, g_object_unref);
         self->priv->pending_connections = NULL;
 
         g_free (self->priv->selected_user);
@@ -2867,6 +2036,22 @@ gdm_session_get_display_seat_id (GdmSession *self)
         return g_strdup (self->priv->display_seat_id);
 }
 
+char *
+gdm_session_get_session_id (GdmSession *self)
+{
+        GdmSessionConversation *conversation;
+
+        g_return_val_if_fail (GDM_IS_SESSION (self), NULL);
+
+        conversation = self->priv->session_conversation;
+
+        if (conversation == NULL) {
+                return NULL;
+        }
+
+        return g_strdup (conversation->session_id);
+}
+
 gboolean
 gdm_session_bypasses_xsession (GdmSession *self)
 {
@@ -2938,8 +2123,8 @@ gdm_session_select_session_type (GdmSession *self,
 
                 conversation = (GdmSessionConversation *) value;
 
-                send_dbus_string_signal (conversation, "SetSessionType",
-                                         text);
+                gdm_dbus_session_emit_set_session_type (conversation->worker_skeleton,
+                                                        text);
         }
 }
 
@@ -2964,8 +2149,8 @@ gdm_session_select_session (GdmSession *self,
 
                 conversation = (GdmSessionConversation *) value;
 
-                send_dbus_string_signal (conversation, "SetSessionName",
-                                         get_session_name (self));
+                gdm_dbus_session_emit_set_session_name (conversation->worker_skeleton,
+                                                        get_session_name (self));
         }
 }
 
@@ -2990,8 +2175,8 @@ gdm_session_select_language (GdmSession *self,
 
                 conversation = (GdmSessionConversation *) value;
 
-                send_dbus_string_signal (conversation, "SetLanguageName",
-                                         get_language_name (self));
+                gdm_dbus_session_emit_set_language_name (conversation->worker_skeleton,
+                                                         get_language_name (self));
         }
 }
 
@@ -3158,13 +2343,9 @@ gdm_session_dispose (GObject *object)
         g_free (self->priv->display_x11_authority_file);
         self->priv->display_x11_authority_file = NULL;
 
-        g_free (self->priv->server_address);
-        self->priv->server_address = NULL;
-
         if (self->priv->server != NULL) {
-                dbus_server_disconnect (self->priv->server);
-                dbus_server_unref (self->priv->server);
-                self->priv->server = NULL;
+                g_dbus_server_stop (self->priv->server);
+                g_clear_object (&self->priv->server);
         }
 
         if (self->priv->environment != NULL) {
@@ -3203,8 +2384,6 @@ gdm_session_constructor (GType                  type,
                          GObjectConstructParam *construct_properties)
 {
         GdmSession *self;
-        gboolean    res;
-        const char *id;
 
         self = GDM_SESSION (G_OBJECT_CLASS (gdm_session_parent_class)->constructor (type,
                                                                                     n_construct_properties,
@@ -3280,27 +2459,6 @@ gdm_session_class_init (GdmSessionClass *session_class)
                               G_TYPE_NONE,
                               2,
                               G_TYPE_STRING, G_TYPE_STRING);
-        signals [RESET_COMPLETE] =
-                g_signal_new ("reset-complete",
-                              GDM_TYPE_SESSION,
-                              G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSessionClass, reset_complete),
-                              NULL,
-                              NULL,
-                              g_cclosure_marshal_VOID__VOID,
-                              G_TYPE_NONE,
-                              0);
-        signals [RESET_FAILED] =
-                g_signal_new ("reset-failed",
-                              GDM_TYPE_SESSION,
-                              G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSessionClass, reset_failed),
-                              NULL,
-                              NULL,
-                              g_cclosure_marshal_VOID__STRING,
-                              G_TYPE_NONE,
-                              1,
-                              G_TYPE_STRING);
         signals [AUTHENTICATED] =
                 g_signal_new ("authenticated",
                               GDM_TYPE_SESSION,
@@ -3560,13 +2718,10 @@ gdm_session_class_init (GdmSessionClass *session_class)
                                                               "display seat id",
                                                               NULL,
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
-        dbus_g_object_type_install_info (GDM_TYPE_SESSION, &dbus_glib_gdm_session_object_info);
 }
 
 GdmSession *
-gdm_session_new (const char *display_id,
-                 const char *display_name,
+gdm_session_new (const char *display_name,
                  const char *display_hostname,
                  const char *display_device,
                  const char *display_seat_id,
@@ -3576,14 +2731,13 @@ gdm_session_new (const char *display_id,
         GdmSession *self;
 
         self = g_object_new (GDM_TYPE_SESSION,
-                             "display-id", display_id,
                              "display-name", display_name,
                              "display-hostname", display_hostname,
                              "display-device", display_device,
                              "display-seat-id", display_seat_id,
                              "display-x11-authority-file", display_x11_authority_file,
                              "display-is-local", display_is_local,
-                              NULL);
+                             NULL);
 
         return self;
 }
diff --git a/daemon/gdm-session.h b/daemon/gdm-session.h
index 1961be0..2810c89 100644
--- a/daemon/gdm-session.h
+++ b/daemon/gdm-session.h
@@ -34,11 +34,6 @@ G_BEGIN_DECLS
 
 typedef struct _GdmSessionPrivate GdmSessionPrivate;
 
-enum {
-        GDM_SESSION_CRED_ESTABLISH = 0,
-        GDM_SESSION_CRED_REFRESH,
-};
-
 typedef struct
 {
         GObject            parent;
@@ -174,14 +169,6 @@ void              gdm_session_select_user                 (GdmSession *session,
                                                            const char *username);
 void              gdm_session_cancel                      (GdmSession *session);
 
-/* Exported methods */
-gboolean          gdm_session_restart                  (GdmSession   *session,
-                                                        GError      **error);
-gboolean          gdm_session_stop                     (GdmSession   *session,
-                                                        GError      **error);
-gboolean          gdm_session_detach                   (GdmSession   *session,
-                                                        GError      **error);
-
 G_END_DECLS
 
 #endif /* GDM_SESSION_H */
diff --git a/daemon/gdm-session.xml b/daemon/gdm-session.xml
new file mode 100644
index 0000000..c320c09
--- /dev/null
+++ b/daemon/gdm-session.xml
@@ -0,0 +1,159 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
+<node name="/org/gnome/DisplayManager/Session">
+  <!-- methods are called by the session worker,
+       signals are emitted by the simple slave -->
+  <interface name="org.gnome.DisplayManager.Session">
+    <method name="ConversationStarted">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <signal name="StartConversation">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="Close"/>
+    <signal name="Cancelled"/>
+    <method name="Hello" />
+    <method name="CancelPendingQuery">
+      <arg name="service_name" type="s" direction="in"/>
+    </method>
+    <method name="UsernameChanged">
+      <arg name="service_name" type="s" direction="in"/>
+      <arg name="new_username" type="s" direction="in"/>
+    </method>
+    <method name="SavedLanguageNameRead">
+      <arg name="language_name" type="s" direction="in"/>
+    </method>
+    <method name="SavedSessionNameRead">
+      <arg name="session_name" type="s" direction="in"/>
+    </method>
+    <signal name="StartProgram">
+      <arg name="command" type="s"/>
+    </signal>
+    <method name="ServiceUnavailable">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="SetupComplete">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <method name="SetupFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="Authenticated">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <method name="AuthenticationFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="Authorized">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <method name="AuthorizationFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="Accredited">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <method name="AccreditationFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="InfoQuery">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="text" direction="in" type="s"/>
+      <arg name="answer" direction="out" type="s"/>
+    </method>
+    <method name="SecretInfoQuery">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="text" direction="in" type="s"/>
+      <arg name="answer" direction="out" type="s"/>
+    </method>
+    <method name="Info">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="text" direction="in" type="s"/>
+    </method>
+    <method name="Problem">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="text" direction="in" type="s"/>
+    </method>
+    <method name="Opened">
+      <arg name="service_name" direction="in" type="s"/>
+    </method>
+    <method name="OpenFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="SessionStarted">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="pid" direction="in" type="i"/>
+    </method>
+    <method name="SessionStartFailed">
+      <arg name="service_name" direction="in" type="s"/>
+      <arg name="message" direction="in" type="s"/>
+    </method>
+    <method name="SessionExited">
+      <arg name="service_name" direction="in" type="s"/>
+      <!-- This is a combination of exit code and exit
+           signal. Use macros in sys/wait.h to handle it. -->
+      <arg name="status" direction="in" type="i"/>
+    </method>
+
+    <signal name="Reset" />
+    <signal name="Setup">
+      <arg name="service_name" type="s"/>
+      <arg name="x11_display_name" type="s"/>
+      <arg name="x11_authority_file" type="s"/>
+      <arg name="display_device" type="s"/>
+      <arg name="display_seat" type="s"/>
+      <arg name="hostname" type="s"/>
+    </signal>
+    <signal name="SetupForUser">
+      <arg name="service_name" type="s"/>
+      <arg name="user_name" type="s"/>
+      <arg name="x11_display_name" type="s"/>
+      <arg name="x11_authority_file" type="s"/>
+      <arg name="display_device" type="s"/>
+      <arg name="display_seat" type="s"/>
+      <arg name="hostname" type="s"/>
+    </signal>
+    <signal name="SetupForProgram">
+      <arg name="service_name" type="s"/>
+      <arg name="x11_display_name" type="s"/>
+      <arg name="x11_authority_file" type="s"/>
+      <arg name="display_device" type="s"/>
+      <arg name="display_seat" type="s"/>
+      <arg name="hostname" type="s"/>
+      <arg name="log_file" type="s"/>
+    </signal>
+    <signal name="Authenticate">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="Authorize">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="EstablishCredentials">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="OpenSession">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="StartSession">
+      <arg name="service_name" type="s"/>
+    </signal>
+    <signal name="SetEnvironmentVariable">
+      <arg name="name" type="s" />
+      <arg name="value" type="s" />
+    </signal>
+    <signal name="SetLanguageName">
+      <arg name="language" type="s" />
+    </signal>
+    <signal name="SetSessionName">
+      <arg name="session_name" type="s" />
+    </signal>
+    <signal name="SetSessionType">
+      <arg name="session_type" type="s" />
+    </signal>
+  </interface>
+</node>
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index e5a9dc1..a9138be 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -205,9 +205,9 @@ gdm_simple_slave_revoke_console_permissions (GdmSimpleSlave *slave)
 #endif  /* HAVE_LOGINDEVPERM */
 
 static void
-on_session_exited (GdmSession     *session,
-                   int             exit_code,
-                   GdmSimpleSlave *slave)
+on_session_exited (GdmSession       *session,
+                   int               exit_code,
+                   GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: session exited with code %d\n", exit_code);
         if (slave->priv->start_session_service_name == NULL) {
@@ -216,9 +216,9 @@ on_session_exited (GdmSession     *session,
 }
 
 static void
-on_session_died (GdmSession     *session,
-                 int             signal_number,
-                 GdmSimpleSlave *slave)
+on_session_died (GdmSession       *session,
+                 int               signal_number,
+                 GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: session died with signal %d, (%s)",
                  signal_number,
@@ -279,9 +279,9 @@ queue_greeter_reset (GdmSimpleSlave *slave)
 }
 
 static void
-on_session_service_unavailable (GdmSession     *session,
-                                const char     *service_name,
-                                GdmSimpleSlave *slave)
+on_session_service_unavailable (GdmSession       *session,
+                                const char       *service_name,
+                                GdmSimpleSlave   *slave)
 {
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_service_unavailable (slave->priv->greeter_server,
@@ -292,18 +292,18 @@ on_session_service_unavailable (GdmSession     *session,
 }
 
 static void
-on_session_setup_complete (GdmSession     *session,
-                           const char     *service_name,
-                           GdmSimpleSlave *slave)
+on_session_setup_complete (GdmSession       *session,
+                           const char       *service_name,
+                           GdmSimpleSlave   *slave)
 {
         gdm_session_authenticate (session, service_name);
 }
 
 static void
-on_session_setup_failed (GdmSession     *session,
-                         const char     *service_name,
-                         const char     *message,
-                         GdmSimpleSlave *slave)
+on_session_setup_failed (GdmSession       *session,
+                         const char       *service_name,
+                         const char       *message,
+                         GdmSimpleSlave   *slave)
 {
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_problem (slave->priv->greeter_server,
@@ -315,33 +315,18 @@ on_session_setup_failed (GdmSession     *session,
 }
 
 static void
-on_session_reset_complete (GdmSession     *session,
-                           GdmSimpleSlave *slave)
-{
-        g_debug ("GdmSimpleSlave: PAM reset");
-}
-
-static void
-on_session_reset_failed (GdmSession     *session,
-                         const char     *message,
-                         GdmSimpleSlave *slave)
-{
-        g_critical ("Unable to reset PAM");
-}
-
-static void
-on_session_authenticated (GdmSession     *session,
-                          const char     *service_name,
-                          GdmSimpleSlave *slave)
+on_session_authenticated (GdmSession       *session,
+                          const char       *service_name,
+                          GdmSimpleSlave   *slave)
 {
         gdm_session_authorize (session, service_name);
 }
 
 static void
-on_session_authentication_failed (GdmSession     *session,
-                                  const char     *service_name,
-                                  const char     *message,
-                                  GdmSimpleSlave *slave)
+on_session_authentication_failed (GdmSession       *session,
+                                  const char       *service_name,
+                                  const char       *message,
+                                  GdmSimpleSlave   *slave)
 {
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_problem (slave->priv->greeter_server,
@@ -366,34 +351,19 @@ gdm_simple_slave_start_session_when_ready (GdmSimpleSlave *slave,
 }
 
 static void
-on_session_authorized (GdmSession     *session,
-                       const char     *service_name,
-                       GdmSimpleSlave *slave)
+on_session_authorized (GdmSession       *session,
+                       const char       *service_name,
+                       GdmSimpleSlave   *slave)
 {
-        char *ssid;
-        char *username;
-        int   cred_flag;
-
-        username = gdm_session_get_username (slave->priv->session);
-
-        ssid = gdm_slave_get_primary_session_id_for_user (GDM_SLAVE (slave), username);
-        if (ssid != NULL && ssid [0] != '\0') {
-                /* FIXME: we don't yet support refresh */
-                cred_flag = GDM_SESSION_CRED_ESTABLISH;
-        } else {
-                cred_flag = GDM_SESSION_CRED_ESTABLISH;
-        }
-        g_free (ssid);
-        g_free (username);
-
-        gdm_session_accredit (GDM_SESSION (slave->priv->session), service_name, cred_flag);
+        /* FIXME: we don't yet support refresh */
+        gdm_session_accredit (slave->priv->session, service_name, FALSE);
 }
 
 static void
-on_session_authorization_failed (GdmSession     *session,
-                                 const char     *service_name,
-                                 const char     *message,
-                                 GdmSimpleSlave *slave)
+on_session_authorization_failed (GdmSession       *session,
+                                 const char       *service_name,
+                                 const char       *message,
+                                 GdmSimpleSlave   *slave)
 {
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_problem (slave->priv->greeter_server,
@@ -462,8 +432,8 @@ start_session (GdmSimpleSlave *slave)
 
         g_free (auth_file);
 
-        gdm_session_start_session (GDM_SESSION (slave->priv->session),
-                                   slave->priv->start_session_service_name);
+        gdm_session_start_session (slave->priv->session,
+                                          slave->priv->start_session_service_name);
 
         slave->priv->start_session_id = 0;
         g_free (slave->priv->start_session_service_name);
@@ -518,18 +488,18 @@ queue_start_session (GdmSimpleSlave *slave,
 }
 
 static void
-on_session_accredited (GdmSession     *session,
-                       const char     *service_name,
-                       GdmSimpleSlave *slave)
+on_session_accredited (GdmSession       *session,
+                       const char       *service_name,
+                       GdmSimpleSlave   *slave)
 {
         gdm_session_open_session (session, service_name);
 }
 
 static void
-on_session_accreditation_failed (GdmSession     *session,
-                                 const char     *service_name,
-                                 const char     *message,
-                                 GdmSimpleSlave *slave)
+on_session_accreditation_failed (GdmSession       *session,
+                                 const char       *service_name,
+                                 const char       *message,
+                                 GdmSimpleSlave   *slave)
 {
         gboolean migrated;
 
@@ -557,9 +527,9 @@ on_session_accreditation_failed (GdmSession     *session,
 }
 
 static void
-on_session_opened (GdmSession     *session,
-                   const char     *service_name,
-                   GdmSimpleSlave *slave)
+on_session_opened (GdmSession       *session,
+                   const char       *service_name,
+                   GdmSimpleSlave   *slave)
 {
 #ifdef  HAVE_LOGINDEVPERM
         gdm_simple_slave_grant_console_permissions (slave);
@@ -575,10 +545,10 @@ on_session_opened (GdmSession     *session,
 }
 
 static void
-on_session_open_failed (GdmSession     *session,
-                        const char     *service_name,
-                        const char     *message,
-                        GdmSimpleSlave *slave)
+on_session_open_failed (GdmSession       *session,
+                        const char       *service_name,
+                        const char       *message,
+                        GdmSimpleSlave   *slave)
 {
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_problem (slave->priv->greeter_server,
@@ -590,10 +560,10 @@ on_session_open_failed (GdmSession     *session,
 }
 
 static void
-on_session_info (GdmSession     *session,
-                 const char     *service_name,
-                 const char     *text,
-                 GdmSimpleSlave *slave)
+on_session_info (GdmSession       *session,
+                 const char       *service_name,
+                 const char       *text,
+                 GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Info: %s", text);
         if (slave->priv->greeter_server != NULL) {
@@ -602,20 +572,20 @@ on_session_info (GdmSession     *session,
 }
 
 static void
-on_session_problem (GdmSession     *session,
-                    const char     *service_name,
-                    const char     *text,
-                    GdmSimpleSlave *slave)
+on_session_problem (GdmSession       *session,
+                    const char       *service_name,
+                    const char       *text,
+                    GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Problem: %s", text);
         gdm_greeter_server_problem (slave->priv->greeter_server, service_name, text);
 }
 
 static void
-on_session_info_query (GdmSession     *session,
-                       const char     *service_name,
-                       const char     *text,
-                       GdmSimpleSlave *slave)
+on_session_info_query (GdmSession       *session,
+                       const char       *service_name,
+                       const char       *text,
+                       GdmSimpleSlave   *slave)
 {
 
         g_debug ("GdmSimpleSlave: Info query: %s", text);
@@ -623,19 +593,19 @@ on_session_info_query (GdmSession     *session,
 }
 
 static void
-on_session_secret_info_query (GdmSession     *session,
-                              const char     *service_name,
-                              const char     *text,
-                              GdmSimpleSlave *slave)
+on_session_secret_info_query (GdmSession       *session,
+                              const char       *service_name,
+                              const char       *text,
+                              GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Secret info query: %s", text);
         gdm_greeter_server_secret_info_query (slave->priv->greeter_server, service_name, text);
 }
 
 static void
-on_session_conversation_started (GdmSession     *session,
-                                 const char     *service_name,
-                                 GdmSimpleSlave *slave)
+on_session_conversation_started (GdmSession       *session,
+                                 const char       *service_name,
+                                 GdmSimpleSlave   *slave)
 {
         gboolean res;
         gboolean enabled;
@@ -663,18 +633,16 @@ on_session_conversation_started (GdmSession     *session,
                 g_debug ("GdmSimpleSlave: begin auto login for user '%s'", username);
                 /* service_name will be "gdm-autologin"
                  */
-                gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                            service_name,
-                                            username);
+                gdm_session_setup_for_user (slave->priv->session, service_name, username);
         }
 
         g_free (username);
 }
 
 static void
-on_session_conversation_stopped (GdmSession     *session,
-                                 const char     *service_name,
-                                 GdmSimpleSlave *slave)
+on_session_conversation_stopped (GdmSession       *session,
+                                 const char       *service_name,
+                                 GdmSimpleSlave   *slave)
 {
         gboolean res;
         g_debug ("GdmSimpleSlave: conversation stopped");
@@ -689,9 +657,9 @@ on_session_conversation_stopped (GdmSession     *session,
 }
 
 static void
-on_session_selected_user_changed (GdmSession     *session,
-                                  const char     *text,
-                                  GdmSimpleSlave *slave)
+on_session_selected_user_changed (GdmSession       *session,
+                                  const char       *text,
+                                  GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Selected user changed: %s", text);
 
@@ -701,9 +669,9 @@ on_session_selected_user_changed (GdmSession     *session,
 }
 
 static void
-on_default_language_name_changed (GdmSession     *session,
-                                  const char     *text,
-                                  GdmSimpleSlave *slave)
+on_default_language_name_changed (GdmSession       *session,
+                                  const char       *text,
+                                  GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Default language name changed: %s", text);
 
@@ -713,9 +681,9 @@ on_default_language_name_changed (GdmSession     *session,
 }
 
 static void
-on_default_session_name_changed (GdmSession     *session,
-                                 const char     *text,
-                                 GdmSimpleSlave *slave)
+on_default_session_name_changed (GdmSession       *session,
+                                 const char       *text,
+                                 GdmSimpleSlave   *slave)
 {
         g_debug ("GdmSimpleSlave: Default session name changed: %s", text);
 
@@ -735,8 +703,7 @@ start_autologin_conversation_if_necessary (GdmSimpleSlave *slave)
         }
 
         g_debug ("GdmSimpleSlave: Starting automatic login conversation");
-        gdm_session_start_conversation (GDM_SESSION (slave->priv->session),
-                                        "gdm-autologin");
+        gdm_session_start_conversation (slave->priv->session, "gdm-autologin");
 }
 
 static void
@@ -798,14 +765,6 @@ create_new_session (GdmSimpleSlave *slave)
                           G_CALLBACK (on_session_setup_failed),
                           slave);
         g_signal_connect (slave->priv->session,
-                          "reset-complete",
-                          G_CALLBACK (on_session_reset_complete),
-                          slave);
-        g_signal_connect (slave->priv->session,
-                          "reset-failed",
-                          G_CALLBACK (on_session_reset_failed),
-                          slave);
-        g_signal_connect (slave->priv->session,
                           "authenticated",
                           G_CALLBACK (on_session_authenticated),
                           slave);
@@ -906,12 +865,6 @@ destroy_session (GdmSimpleSlave *slave)
                                               G_CALLBACK (on_session_setup_failed),
                                               slave);
         g_signal_handlers_disconnect_by_func (slave->priv->session,
-                                              G_CALLBACK (on_session_reset_complete),
-                                              slave);
-        g_signal_handlers_disconnect_by_func (slave->priv->session,
-                                              G_CALLBACK (on_session_reset_failed),
-                                              slave);
-        g_signal_handlers_disconnect_by_func (slave->priv->session,
                                               G_CALLBACK (on_session_authenticated),
                                               slave);
         g_signal_handlers_disconnect_by_func (slave->priv->session,
@@ -968,9 +921,8 @@ destroy_session (GdmSimpleSlave *slave)
                                               G_CALLBACK (on_default_session_name_changed),
                                               slave);
 
-        gdm_session_close (GDM_SESSION (slave->priv->session));
-        g_object_unref (slave->priv->session);
-        slave->priv->session = NULL;
+        gdm_session_close (slave->priv->session);
+        g_clear_object (&slave->priv->session);
 }
 
 static void
@@ -1029,8 +981,7 @@ on_greeter_start_conversation (GdmGreeterServer *greeter_server,
         }
 
         g_debug ("GdmSimpleSlave: starting conversation with '%s' pam service'", service_name);
-        gdm_session_start_conversation (GDM_SESSION (slave->priv->session),
-                                        service_name);
+        gdm_session_start_conversation (slave->priv->session, service_name);
 }
 
 static void
@@ -1042,8 +993,7 @@ on_greeter_begin_verification (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_setup (GDM_SESSION (slave->priv->session),
-                           service_name);
+        gdm_session_setup (slave->priv->session, service_name);
 }
 
 static void
@@ -1055,9 +1005,7 @@ on_greeter_begin_auto_login (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                    "gdm-autologin",
-                                    username);
+        gdm_session_setup_for_user (slave->priv->session, "gdm-autologin", username);
 }
 
 static void
@@ -1070,9 +1018,7 @@ on_greeter_begin_verification_for_user (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                    service_name,
-                                    username);
+        gdm_session_setup_for_user (slave->priv->session, service_name, username);
 }
 
 static void
@@ -1084,7 +1030,7 @@ on_greeter_answer (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_answer_query (GDM_SESSION (slave->priv->session), service_name, text);
+        gdm_session_answer_query (slave->priv->session, service_name, text);
 }
 
 static void
@@ -1095,7 +1041,7 @@ on_greeter_session_selected (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_select_session (GDM_SESSION (slave->priv->session), text);
+        gdm_session_select_session (slave->priv->session, text);
 }
 
 static void
@@ -1106,7 +1052,7 @@ on_greeter_language_selected (GdmGreeterServer *greeter_server,
         if (slave->priv->greeter_reset_id > 0) {
                 return;
         }
-        gdm_session_select_language (GDM_SESSION (slave->priv->session), text);
+        gdm_session_select_language (slave->priv->session, text);
 }
 
 static void
@@ -1609,39 +1555,39 @@ gdm_simple_slave_start (GdmSlave *slave)
 static gboolean
 gdm_simple_slave_stop (GdmSlave *slave)
 {
+        GdmSimpleSlave *self = GDM_SIMPLE_SLAVE (slave);
+
         g_debug ("GdmSimpleSlave: Stopping simple_slave");
 
         GDM_SLAVE_CLASS (gdm_simple_slave_parent_class)->stop (slave);
 
-        if (GDM_SIMPLE_SLAVE (slave)->priv->greeter != NULL) {
-                stop_greeter (GDM_SIMPLE_SLAVE (slave));
+        if (self->priv->greeter != NULL) {
+                stop_greeter (self);
         }
 
-        if (GDM_SIMPLE_SLAVE (slave)->priv->session != NULL) {
+        if (self->priv->session != NULL) {
                 char *username;
 
                 /* Run the PostSession script. gdmslave suspends until script
                  * has terminated
                  */
-                username = gdm_session_get_username (GDM_SIMPLE_SLAVE (slave)->priv->session);
+                username = gdm_session_get_username (self->priv->session);
                 if (username != NULL) {
-                        gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PostSession", username);
+                        gdm_slave_run_script (slave, GDMCONFDIR "/PostSession", username);
                 }
                 g_free (username);
 
 #ifdef  HAVE_LOGINDEVPERM
-                gdm_simple_slave_revoke_console_permissions (GDM_SIMPLE_SLAVE (slave));
+                gdm_simple_slave_revoke_console_permissions (self);
 #endif
 
-                gdm_session_close (GDM_SESSION (GDM_SIMPLE_SLAVE (slave)->priv->session));
-                g_object_unref (GDM_SIMPLE_SLAVE (slave)->priv->session);
-                GDM_SIMPLE_SLAVE (slave)->priv->session = NULL;
+                gdm_session_close (self->priv->session);
+                g_clear_object (&self->priv->session);
         }
 
-        if (GDM_SIMPLE_SLAVE (slave)->priv->server != NULL) {
-                gdm_server_stop (GDM_SIMPLE_SLAVE (slave)->priv->server);
-                g_object_unref (GDM_SIMPLE_SLAVE (slave)->priv->server);
-                GDM_SIMPLE_SLAVE (slave)->priv->server = NULL;
+        if (self->priv->server != NULL) {
+                gdm_server_stop (self->priv->server);
+                g_clear_object (&self->priv->server);
         }
 
         return TRUE;
diff --git a/daemon/gdm-welcome-session.c b/daemon/gdm-welcome-session.c
index 503f4f8..693fbf7 100644
--- a/daemon/gdm-welcome-session.c
+++ b/daemon/gdm-welcome-session.c
@@ -40,9 +40,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <glib-object.h>
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
 
 #include "gdm-common.h"
 
@@ -59,7 +56,7 @@ extern char **environ;
 
 struct GdmWelcomeSessionPrivate
 {
-        GdmSession     *session;
+        GdmSession       *session;
         char           *command;
         GPid            pid;
 
@@ -693,13 +690,13 @@ on_session_setup_complete (GdmSession        *session,
 
         g_hash_table_iter_init (&iter, hash);
         while (g_hash_table_iter_next (&iter, &key, &value)) {
-                gdm_session_set_environment_variable (GDM_SESSION (welcome_session->priv->session), key, value);
+                gdm_session_set_environment_variable (welcome_session->priv->session, key, value);
         }
         g_hash_table_destroy (hash);
 
-        gdm_session_select_session_type (GDM_SESSION (welcome_session->priv->session), "LoginWindow");
+        gdm_session_select_session_type (welcome_session->priv->session, "LoginWindow");
 
-        gdm_session_authenticate (GDM_SESSION (welcome_session->priv->session), service_name);
+        gdm_session_authenticate (welcome_session->priv->session, service_name);
 }
 
 static void
@@ -707,8 +704,7 @@ on_session_authenticated (GdmSession        *session,
                           const char        *service_name,
                           GdmWelcomeSession *welcome_session)
 {
-        gdm_session_authorize (GDM_SESSION (welcome_session->priv->session),
-                               service_name);
+        gdm_session_authorize (welcome_session->priv->session, service_name);
 }
 
 static void
@@ -716,9 +712,7 @@ on_session_authorized (GdmSession        *session,
                        const char        *service_name,
                        GdmWelcomeSession *welcome_session)
 {
-        gdm_session_accredit (GDM_SESSION (welcome_session->priv->session),
-                              service_name,
-                              GDM_SESSION_CRED_ESTABLISH);
+        gdm_session_accredit (welcome_session->priv->session, service_name, FALSE);
 }
 
 static void
@@ -726,7 +720,7 @@ on_session_accredited (GdmSession        *session,
                        const char        *service_name,
                        GdmWelcomeSession *welcome_session)
 {
-        gdm_session_open_session (GDM_SESSION (welcome_session->priv->session), service_name);
+        gdm_session_open_session (welcome_session->priv->session, service_name);
 }
 
 static void
@@ -734,8 +728,7 @@ on_session_opened (GdmSession        *session,
                    const char        *service_name,
                    GdmWelcomeSession *welcome_session)
 {
-        gdm_session_start_session (GDM_SESSION (welcome_session->priv->session),
-                                   service_name);
+        gdm_session_start_session (welcome_session->priv->session, service_name);
 }
 
 static void
@@ -753,8 +746,7 @@ on_session_exited (GdmSession        *session,
                    int                exit_code,
                    GdmWelcomeSession *welcome_session)
 {
-        gdm_session_stop_conversation (GDM_SESSION (welcome_session->priv->session),
-                                       "gdm-welcome");
+        gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome");
 
         g_signal_emit (G_OBJECT (welcome_session), signals [EXITED], 0, exit_code);
 }
@@ -764,8 +756,7 @@ on_session_died (GdmSession        *session,
                  int                signal_number,
                  GdmWelcomeSession *welcome_session)
 {
-        gdm_session_stop_conversation (GDM_SESSION (welcome_session->priv->session),
-                                       "gdm-welcome");
+        gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome");
 
         g_signal_emit (G_OBJECT (welcome_session), signals [DIED], 0, signal_number);
 }
@@ -782,9 +773,7 @@ on_conversation_started (GdmSession        *session,
         log_path = g_build_filename (LOGDIR, log_file, NULL);
         g_free (log_file);
 
-        gdm_session_setup_for_program (GDM_SESSION (welcome_session->priv->session),
-                                       "gdm-welcome",
-                                       log_path);
+        gdm_session_setup_for_program (welcome_session->priv->session, "gdm-welcome", log_path);
         g_free (log_path);
 }
 
@@ -806,7 +795,7 @@ on_conversation_stopped (GdmSession        *session,
         }
 
         if (conversation_session != NULL) {
-                gdm_session_close (GDM_SESSION (conversation_session));
+                gdm_session_close (conversation_session);
                 g_object_unref (conversation_session);
         }
 }
@@ -836,11 +825,11 @@ gdm_welcome_session_start (GdmWelcomeSession *welcome_session)
                                                           welcome_session->priv->x11_authority_file,
                                                           welcome_session->priv->x11_display_is_local);
 
-        g_signal_connect (GDM_SESSION (welcome_session->priv->session),
+        g_signal_connect (welcome_session->priv->session,
                           "conversation-started",
                           G_CALLBACK (on_conversation_started),
                           welcome_session);
-        g_signal_connect (GDM_SESSION (welcome_session->priv->session),
+        g_signal_connect (welcome_session->priv->session,
                           "conversation-stopped",
                           G_CALLBACK (on_conversation_stopped),
                           welcome_session);
@@ -864,23 +853,21 @@ gdm_welcome_session_start (GdmWelcomeSession *welcome_session)
                           "session-opened",
                           G_CALLBACK (on_session_opened),
                           welcome_session);
-        g_signal_connect (GDM_SESSION (welcome_session->priv->session),
+        g_signal_connect (welcome_session->priv->session,
                           "session-started",
                           G_CALLBACK (on_session_started),
                           welcome_session);
-        g_signal_connect (GDM_SESSION (welcome_session->priv->session),
+        g_signal_connect (welcome_session->priv->session,
                           "session-exited",
                           G_CALLBACK (on_session_exited),
                           welcome_session);
-        g_signal_connect (GDM_SESSION (welcome_session->priv->session),
+        g_signal_connect (welcome_session->priv->session,
                           "session-died",
                           G_CALLBACK (on_session_died),
                           welcome_session);
 
-        gdm_session_start_conversation (GDM_SESSION (welcome_session->priv->session),
-                                        "gdm-welcome");
-        gdm_session_select_program (GDM_SESSION (welcome_session->priv->session),
-                                    welcome_session->priv->command);
+        gdm_session_start_conversation (welcome_session->priv->session, "gdm-welcome");
+        gdm_session_select_program (welcome_session->priv->session, welcome_session->priv->command);
         return TRUE;
 }
 
@@ -891,12 +878,10 @@ gdm_welcome_session_stop (GdmWelcomeSession *welcome_session)
                 gdm_signal_pid (welcome_session->priv->pid, SIGTERM);
         } else {
                 if (welcome_session->priv->session != NULL) {
-                        gdm_session_stop_conversation (GDM_SESSION (welcome_session->priv->session),
-                                                       "gdm-welcome");
-                        gdm_session_close (GDM_SESSION (welcome_session->priv->session));
+                        gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome");
+                        gdm_session_close (welcome_session->priv->session);
 
-                        g_object_unref (welcome_session->priv->session);
-                        welcome_session->priv->session = NULL;
+                        g_clear_object (&welcome_session->priv->session);
                 } else {
                         stop_dbus_daemon (welcome_session);
                 }
diff --git a/daemon/test-session.c b/daemon/test-session.c
index 23eca7a..3a16eb1 100644
--- a/daemon/test-session.c
+++ b/daemon/test-session.c
@@ -62,23 +62,6 @@ on_session_setup_failed (GdmSession *session,
 }
 
 static void
-on_session_reset_complete (GdmSession *session,
-                           gpointer    data)
-{
-        g_debug ("Session reset complete");
-}
-
-static void
-on_session_reset_failed (GdmSession *session,
-                         const char *message,
-                         gpointer    data)
-{
-        g_print ("Unable to reset PAM: %s\n", message);
-
-        exit (1);
-}
-
-static void
 on_session_authenticated (GdmSession *session,
                           const char *service_name,
                           gpointer    data)
@@ -103,7 +86,7 @@ on_session_authorized (GdmSession *session,
                        gpointer    data)
 {
         g_debug ("Session authorized");
-        gdm_session_accredit (session, service_name, GDM_SESSION_CRED_ESTABLISH);
+        gdm_session_accredit (session, service_name, FALSE);
 }
 
 static void
@@ -124,7 +107,7 @@ on_session_accredited (GdmSession *session,
 {
         char *username;
 
-        username = gdm_session_get_username (GDM_SESSION (session));
+        username = gdm_session_get_username (session);
 
         g_print ("%s%ssuccessfully accredited\n",
                  username ? username : "", username ? " " : "");
@@ -278,7 +261,7 @@ main (int   argc,
                         username = argv[1];
                 }
 
-                gdm_session_start_conversation (GDM_SESSION (session), "gdm");
+                gdm_session_start_conversation (session, "gdm");
 
                 g_signal_connect (session,
                                   "conversation-started",
@@ -293,14 +276,6 @@ main (int   argc,
                                   G_CALLBACK (on_session_setup_failed),
                                   NULL);
                 g_signal_connect (session,
-                                  "reset-complete",
-                                  G_CALLBACK (on_session_reset_complete),
-                                  NULL);
-                g_signal_connect (session,
-                                  "reset-failed",
-                                  G_CALLBACK (on_session_reset_failed),
-                                  NULL);
-                g_signal_connect (session,
                                   "authenticated",
                                   G_CALLBACK (on_session_authenticated),
                                   NULL);



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