/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
}
static DisplayServer *
-seat_xvnc_create_display_server (Seat *seat, const gchar *session_type)
+seat_xvnc_create_display_server (Seat *seat, Session *session)
{
XServerXVNC *x_server;
+ gchar *number;
+ XAuthority *cookie;
const gchar *command = NULL;
- if (strcmp (session_type, "x") != 0)
- {
- g_warning ("XVNC seat only supports X display servers, not '%s'", session_type);
+ if (strcmp (session_get_session_type (session), "x") != 0)
return NULL;
- }
-
+
x_server = x_server_xvnc_new ();
+ number = g_strdup_printf ("%d", x_server_get_display_number (X_SERVER (x_server)));
+ cookie = x_authority_new_local_cookie (number);
+ x_server_set_authority (X_SERVER (x_server), cookie);
+ g_free (number);
+ g_object_unref (cookie);
x_server_xvnc_set_socket (x_server, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
command = config_get_string (config_get_instance (), "VNCServer", "command");
if (command)
- x_server_xvnc_set_command (x_server, command);
+ x_server_local_set_command (X_SERVER_LOCAL (x_server), command);
if (config_has_key (config_get_instance (), "VNCServer", "width") &&
config_has_key (config_get_instance (), "VNCServer", "height"))
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));
- path = x_server_xvnc_get_authority_file_path (x_server);
+ path = x_server_local_get_authority_file_path (X_SERVER_LOCAL (x_server));
process_set_env (script, "REMOTE_HOST", hostname);
process_set_env (script, "DISPLAY", x_server_get_address (X_SERVER (x_server)));
}
static void
-seat_xdmcp_session_finalize (GObject *object)
+seat_xvnc_session_finalize (GObject *object)
{
- SeatXVNC *self;
-
- self = SEAT_XVNC (object);
+ SeatXVNC *self = SEAT_XVNC (object);
- g_object_unref (self->priv->connection);
+ g_clear_object (&self->priv->connection);
G_OBJECT_CLASS (seat_xvnc_parent_class)->finalize (object);
}
seat_class->create_display_server = seat_xvnc_create_display_server;
seat_class->run_script = seat_xvnc_run_script;
- object_class->finalize = seat_xdmcp_session_finalize;
+ object_class->finalize = seat_xvnc_session_finalize;
g_type_class_add_private (klass, sizeof (SeatXVNCPrivate));
}