summaryrefslogtreecommitdiff
path: root/src/seat-xvnc.c
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2011-09-16 12:10:21 +1000
committerRobert Ancell <robert.ancell@canonical.com>2011-09-16 12:10:21 +1000
commit9c0a1b73b6e99a24af52e7d716f22be2da8134c6 (patch)
tree60f3405fbcb09201d0727c3637c26e85c0287830 /src/seat-xvnc.c
parent1e21160c3bdbdd973dd58490e28cb178afd0eee4 (diff)
downloadlightdm-9c0a1b73b6e99a24af52e7d716f22be2da8134c6.tar.gz
Refactor X code out of display.c and seat.c. Drop obsolete GetSeatForCookie and GetSessionForCookie D-Bus calls
Diffstat (limited to 'src/seat-xvnc.c')
-rw-r--r--src/seat-xvnc.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/seat-xvnc.c b/src/seat-xvnc.c
index 82339e51..db1ae66f 100644
--- a/src/seat-xvnc.c
+++ b/src/seat-xvnc.c
@@ -10,16 +10,13 @@
*/
#include "seat-xvnc.h"
-#include "xdisplay.h"
#include "xserver-xvnc.h"
+#include "xsession.h"
G_DEFINE_TYPE (SeatXVNC, seat_xvnc, SEAT_TYPE);
struct SeatXVNCPrivate
{
- /* Remote display */
- XDisplay *display;
-
/* VNC connection */
GSocket *connection;
};
@@ -34,18 +31,35 @@ SeatXVNC *seat_xvnc_new (GSocket *connection)
return seat;
}
-static Display *
-seat_xvnc_add_display (Seat *seat)
+static DisplayServer *
+seat_xvnc_create_display_server (Seat *seat)
{
XServerXVNC *xserver;
xserver = xserver_xvnc_new ();
xserver_xvnc_set_stdin (xserver, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
- SEAT_XVNC (seat)->priv->display = xdisplay_new (XSERVER (xserver));
- g_object_unref (xserver);
+ return DISPLAY_SERVER (xserver);
+}
+
+static Session *
+seat_xvnc_create_session (Seat *seat, Display *display)
+{
+ XServerXVNC *xserver;
+ XSession *session;
+ GInetSocketAddress *address;
+ gchar *hostname;
+
+ xserver = XSERVER_XVNC (display_get_display_server (display));
+
+ session = xsession_new (XSERVER (xserver));
+ address = G_INET_SOCKET_ADDRESS (g_socket_get_remote_address (SEAT_XVNC (seat)->priv->connection, NULL));
+ hostname = g_inet_address_to_string (g_inet_socket_address_get_address (address));
+ session_set_console_kit_parameter (SESSION (session), "remote-host-name", g_variant_new_string (hostname));
+ g_free (hostname);
+ session_set_console_kit_parameter (SESSION (session), "is-local", g_variant_new_boolean (FALSE));
- return DISPLAY (SEAT_XVNC (seat)->priv->display);
+ return SESSION (session);
}
static void
@@ -67,8 +81,6 @@ seat_xdmcp_session_finalize (GObject *object)
self = SEAT_XVNC (object);
- if (self->priv->display)
- g_object_unref (self->priv->display);
g_object_unref (self->priv->connection);
G_OBJECT_CLASS (seat_xvnc_parent_class)->finalize (object);
@@ -80,7 +92,8 @@ seat_xvnc_class_init (SeatXVNCClass *klass)
SeatClass *seat_class = SEAT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- seat_class->add_display = seat_xvnc_add_display;
+ seat_class->create_display_server = seat_xvnc_create_display_server;
+ seat_class->create_session = seat_xvnc_create_session;
seat_class->display_removed = seat_xvnc_display_removed;
object_class->finalize = seat_xdmcp_session_finalize;