process.h \
seat.c \
seat.h \
- seat-local.c \
- seat-local.h \
- seat-xdmcp-client.c \
- seat-xdmcp-client.h \
seat-xdmcp-session.c \
seat-xdmcp-session.h \
+ seat-xlocal.c \
+ seat-xlocal.h \
session.c \
session.h \
user.c \
#include "configuration.h"
#include "display.h"
#include "xdmcp-server.h"
-#include "seat-local.h"
-#include "seat-xdmcp-client.h"
+#include "seat-xlocal.h"
#include "seat-xdmcp-session.h"
#include "plymouth.h"
SeatXDMCPSession *seat;
gboolean result;
- seat = seat_xdmcp_session_new ("XDMCPServer", session);
+ seat = seat_xdmcp_session_new (session);
result = add_seat (manager, SEAT (seat));
g_object_unref (seat);
g_return_if_fail (manager != NULL);
/* Load the seat modules */
- seat_register_module ("xlocal", SEAT_LOCAL_TYPE);
+ seat_register_module ("xlocal", SEAT_XLOCAL_TYPE);
/* Load the static display entries */
seats = config_get_string (config_get_instance (), "LightDM", "seats");
g_object_unref (seat);
}
else
- g_debug ("Unknown seat type %s", type);
+ g_debug ("Unknown seat type %s", type);
}
g_strfreev (tokens);
display->priv->greeter_user = config_get_string (config_get_instance (), config_section, "greeter-user");
if (!display->priv->greeter_user)
display->priv->greeter_user = config_get_string (config_get_instance (), "SeatDefaults", "greeter-user");
+
if (config_section)
display->priv->greeter_session = config_get_string (config_get_instance (), config_section, "greeter-session");
if (!display->priv->greeter_session)
filename = g_strdup_printf ("%s.desktop", session_name);
path = g_build_filename (sessions_dir, filename, NULL);
- g_free (sessions_dir);
g_free (filename);
session_desktop_file = g_key_file_new ();
+++ /dev/null
-/*
- * 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
- * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
- * license.
- */
-
-#include <string.h>
-
-#include "seat-local.h"
-#include "configuration.h"
-#include "xdisplay.h"
-#include "xserver-local.h"
-#include "vt.h"
-
-struct SeatLocalPrivate
-{
- /* The section in the config for this seat */
- gchar *config_section;
-};
-
-G_DEFINE_TYPE (SeatLocal, seat_local, SEAT_TYPE);
-
-SeatLocal *
-seat_local_new (const gchar *config_section)
-{
- SeatLocal *seat;
-
- seat = g_object_new (SEAT_LOCAL_TYPE, NULL);
- seat->priv->config_section = g_strdup (config_section);
- seat_load_config (SEAT (seat), config_section);
- seat_set_can_switch (SEAT (seat), TRUE);
-
- return seat;
-}
-
-static Display *
-seat_local_add_display (Seat *seat)
-{
- XServerLocal *xserver;
- XAuthority *authority = NULL;
- gchar *number;
- gchar hostname[1024];
- XDisplay *display;
-
- g_debug ("Starting display");
-
- xserver = xserver_local_new (SEAT_LOCAL (seat)->priv->config_section);
- number = g_strdup_printf ("%d", xserver_get_display_number (XSERVER (xserver)));
- gethostname (hostname, 1024);
- authority = xauth_new_cookie (XAUTH_FAMILY_LOCAL, hostname, number);
- g_free (number);
-
- xserver_set_authority (XSERVER (xserver), authority);
- g_object_unref (authority);
-
- display = xdisplay_new (SEAT_LOCAL (seat)->priv->config_section, XSERVER (xserver));
- g_object_unref (xserver);
-
- return DISPLAY (display);
-}
-
-static void
-seat_local_set_active_display (Seat *seat, Display *display)
-{
- gint number = xserver_local_get_vt (XSERVER_LOCAL (XSERVER (display_get_display_server (display))));
- if (number >= 0)
- vt_set_active (number);
-}
-
-static void
-seat_local_init (SeatLocal *seat)
-{
- seat->priv = G_TYPE_INSTANCE_GET_PRIVATE (seat, SEAT_LOCAL_TYPE, SeatLocalPrivate);
-}
-
-static void
-seat_local_finalize (GObject *object)
-{
- SeatLocal *self;
-
- self = SEAT_LOCAL (object);
-
- g_free (self->priv->config_section);
-
- G_OBJECT_CLASS (seat_local_parent_class)->finalize (object);
-}
-
-static void
-seat_local_class_init (SeatLocalClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SeatClass *seat_class = SEAT_CLASS (klass);
-
- seat_class->add_display = seat_local_add_display;
- seat_class->set_active_display = seat_local_set_active_display;
- object_class->finalize = seat_local_finalize;
-
- g_type_class_add_private (klass, sizeof (SeatLocalPrivate));
-}
+++ /dev/null
-/*
- * 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
- * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
- * license.
- */
-
-#include <string.h>
-
-#include "seat-xdmcp-client.h"
-#include "xdisplay.h"
-#include "configuration.h"
-#include "xserver-local.h"
-
-struct SeatXDMCPClientPrivate
-{
- /* The section in the config for this seat */
- gchar *config_section;
-
- /* The display we are running */
- XDisplay *display;
-};
-
-G_DEFINE_TYPE (SeatXDMCPClient, seat_xdmcp_client, SEAT_TYPE);
-
-SeatXDMCPClient *
-seat_xdmcp_client_new (const gchar *config_section)
-{
- SeatXDMCPClient *seat;
-
- seat = g_object_new (SEAT_XDMCP_CLIENT_TYPE, NULL);
- seat->priv->config_section = g_strdup (config_section);
- seat_load_config (SEAT (seat), config_section);
-
- return seat;
-}
-
-static Display *
-seat_xdmcp_client_add_display (Seat *seat)
-{
- XServerLocal *xserver;
- XAuthority *authority = NULL;
- gchar *xdmcp_manager;
- gint port;
- //gchar *key;
-
- g_assert (SEAT_XDMCP_CLIENT (seat)->priv->display == NULL);
-
- g_debug ("Starting seat %s", SEAT_XDMCP_CLIENT (seat)->priv->config_section);
-
- xserver = xserver_local_new (SEAT_XDMCP_CLIENT (seat)->priv->config_section);
-
- xdmcp_manager = config_get_string (config_get_instance (), "SeatDefaults", "xdmcp-manager");
- if (!xdmcp_manager)
- xdmcp_manager = config_get_string (config_get_instance (), SEAT_XDMCP_CLIENT (seat)->priv->config_section, "xdmcp-manager");
- xserver_local_set_xdmcp_server (xserver, xdmcp_manager);
- g_free (xdmcp_manager);
-
- if (config_has_key (config_get_instance (), "SeatDefaults", "xdmcp-port"))
- port = config_get_integer (config_get_instance (), "SeatDefaults", "xdmcp-port");
- else
- port = config_get_integer (config_get_instance (), SEAT_XDMCP_CLIENT (seat)->priv->config_section, "xdmcp-port");
- if (port > 0)
- xserver_local_set_xdmcp_port (xserver, port);
- /*FIXME key = config_get_string (config_get_instance (), SEAT_XDMCP_CLIENT (seat)->priv->config_section, "key");
- if (key)
- {
- guint8 data[8];
-
- string_to_xdm_auth_key (key, data);
- xserver_set_authentication (xserver, "XDM-AUTHENTICATION-1", data, 8);
- authority = xauth_new (XAUTH_FAMILY_WILD, "", "", "XDM-AUTHORIZATION-1", data, 8);
- }*/
-
- xserver_set_authority (XSERVER (xserver), authority);
- g_object_unref (authority);
-
- SEAT_XDMCP_CLIENT (seat)->priv->display = g_object_ref (xdisplay_new (SEAT_XDMCP_CLIENT (seat)->priv->config_section, XSERVER (xserver)));
- g_object_unref (xserver);
-
- return DISPLAY (SEAT_XDMCP_CLIENT (seat)->priv->display);
-}
-
-static void
-seat_xdmcp_client_init (SeatXDMCPClient *seat)
-{
- seat->priv = G_TYPE_INSTANCE_GET_PRIVATE (seat, SEAT_XDMCP_CLIENT_TYPE, SeatXDMCPClientPrivate);
-}
-
-static void
-seat_xdmcp_client_finalize (GObject *object)
-{
- SeatXDMCPClient *self;
-
- self = SEAT_XDMCP_CLIENT (object);
-
- g_free (self->priv->config_section);
-
- G_OBJECT_CLASS (seat_xdmcp_client_parent_class)->finalize (object);
-}
-
-static void
-seat_xdmcp_client_class_init (SeatXDMCPClientClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SeatClass *seat_class = SEAT_CLASS (klass);
-
- seat_class->add_display = seat_xdmcp_client_add_display;
- object_class->finalize = seat_xdmcp_client_finalize;
-
- g_type_class_add_private (klass, sizeof (SeatXDMCPClientPrivate));
-}
+++ /dev/null
-/*
- * 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
- * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
- * license.
- */
-
-#ifndef _SEAT_XDMCP_CLIENT_H_
-#define _SEAT_XDMCP_CLIENT_H_
-
-#include "seat.h"
-
-G_BEGIN_DECLS
-
-#define SEAT_XDMCP_CLIENT_TYPE (seat_xdmcp_client_get_type())
-#define SEAT_XDMCP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAT_XDMCP_CLIENT_TYPE, SeatXDMCPClient))
-
-typedef struct SeatXDMCPClientPrivate SeatXDMCPClientPrivate;
-
-typedef struct
-{
- Seat parent_instance;
- SeatXDMCPClientPrivate *priv;
-} SeatXDMCPClient;
-
-typedef struct
-{
- SeatClass parent_class;
-} SeatXDMCPClientClass;
-
-GType seat_xdmcp_client_get_type (void);
-
-SeatXDMCPClient *seat_xdmcp_client_new (const gchar *config_section);
-
-G_END_DECLS
-
-#endif /* _SEAT_XDMCP_CLIENT_H_ */
struct SeatXDMCPSessionPrivate
{
- /* The section in the config for this seat */
- gchar *config_section;
-
/* Session being serviced */
XDMCPSession *session;
};
G_DEFINE_TYPE (SeatXDMCPSession, seat_xdmcp_session, SEAT_TYPE);
SeatXDMCPSession *
-seat_xdmcp_session_new (const gchar *config_section, XDMCPSession *session)
+seat_xdmcp_session_new (XDMCPSession *session)
{
SeatXDMCPSession *seat;
seat = g_object_new (SEAT_XDMCP_SESSION_TYPE, NULL);
seat->priv->session = g_object_ref (session);
- seat_load_config (SEAT (seat), config_section);
return seat;
}
xserver = xserver_remote_new (xauth_get_address (authority), xdmcp_session_get_display_number (SEAT_XDMCP_SESSION (seat)->priv->session));
xserver_set_authority (XSERVER (xserver), authority);
- display = xdisplay_new (SEAT_XDMCP_SESSION (seat)->priv->config_section, XSERVER (xserver));
+ display = xdisplay_new (XSERVER (xserver));
g_object_unref (xserver);
return DISPLAY (display);
seat->priv = G_TYPE_INSTANCE_GET_PRIVATE (seat, SEAT_XDMCP_SESSION_TYPE, SeatXDMCPSessionPrivate);
}
-static void
-seat_xdmcp_session_finalize (GObject *object)
-{
- SeatXDMCPSession *self;
-
- self = SEAT_XDMCP_SESSION (object);
-
- g_free (self->priv->config_section);
-
- G_OBJECT_CLASS (seat_xdmcp_session_parent_class)->finalize (object);
-}
-
static void
seat_xdmcp_session_class_init (SeatXDMCPSessionClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
SeatClass *seat_class = SEAT_CLASS (klass);
seat_class->add_display = seat_xdmcp_session_add_display;
- object_class->finalize = seat_xdmcp_session_finalize;
g_type_class_add_private (klass, sizeof (SeatXDMCPSessionPrivate));
}
GType seat_xdmcp_session_get_type (void);
-SeatXDMCPSession *seat_xdmcp_session_new (const gchar *config_section, XDMCPSession *session);
+SeatXDMCPSession *seat_xdmcp_session_new (XDMCPSession *session);
G_END_DECLS
--- /dev/null
+/*
+ * 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
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+#include <string.h>
+
+#include "seat-xlocal.h"
+#include "configuration.h"
+#include "xdisplay.h"
+#include "xserver-local.h"
+#include "vt.h"
+
+G_DEFINE_TYPE (SeatXLocal, seat_xlocal, SEAT_TYPE);
+
+static void
+seat_xlocal_setup (Seat *seat)
+{
+ seat_set_can_switch (seat, TRUE);
+ SEAT_CLASS (seat_xlocal_parent_class)->setup (seat);
+}
+
+static Display *
+seat_xlocal_add_display (Seat *seat)
+{
+ XServerLocal *xserver;
+ XAuthority *authority = NULL;
+ gchar *number;
+ gchar hostname[1024];
+ XDisplay *display;
+ const gchar *config_section;
+ gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL;
+ gint port = 0;
+
+ g_debug ("Starting Local X Display");
+
+ xserver = xserver_local_new ();
+
+ config_section = seat_get_config_section (seat);
+
+ /* If running inside an X server use Xephyr instead */
+ if (g_getenv ("DISPLAY"))
+ command = g_strdup ("Xephyr");
+ if (!command && config_section)
+ command = config_get_string (config_get_instance (), config_section, "xserver-command");
+ if (!command)
+ command = config_get_string (config_get_instance (), "SeatDefaults", "xserver-command");
+ if (command)
+ xserver_local_set_command (xserver, command);
+ g_free (command);
+
+ if (config_section)
+ layout = config_get_string (config_get_instance (), config_section, "xserver-layout");
+ if (!layout)
+ layout = config_get_string (config_get_instance (), "SeatDefaults", "layout");
+ if (layout)
+ xserver_local_set_layout (xserver, layout);
+ g_free (layout);
+
+ if (config_section)
+ config_file = config_get_string (config_get_instance (), config_section, "xserver-config");
+ if (!config_file)
+ config_file = config_get_string (config_get_instance (), "SeatDefaults", "xserver-config");
+ if (config_file)
+ xserver_local_set_config (xserver, config_file);
+ g_free (config_file);
+
+ if (config_section)
+ xdmcp_manager = config_get_string (config_get_instance (), config_section, "xdmcp-manager");
+ if (!xdmcp_manager)
+ xdmcp_manager = config_get_string (config_get_instance (), "SeatDefaults", "xdmcp-manager");
+ if (xdmcp_manager)
+ xserver_local_set_xdmcp_server (xserver, xdmcp_manager);
+ g_free (xdmcp_manager);
+
+ if (config_section && config_has_key (config_get_instance (), config_section, "xdmcp-port"))
+ port = config_get_integer (config_get_instance (), config_section, "xdmcp-port");
+ else if (config_has_key (config_get_instance (), "SeatDefaults", "xdmcp-port"))
+ port = config_get_integer (config_get_instance (), "SeatDefaults", "xdmcp-port");
+ if (port > 0)
+ xserver_local_set_xdmcp_port (xserver, port);
+ /*FIXME key = config_get_string (config_get_instance (), config_section, "key");
+ if (key)
+ {
+ guint8 data[8];
+
+ string_to_xdm_auth_key (key, data);
+ xserver_set_authentication (xserver, "XDM-AUTHENTICATION-1", data, 8);
+ authority = xauth_new (XAUTH_FAMILY_WILD, "", "", "XDM-AUTHORIZATION-1", data, 8);
+ }*/
+
+ number = g_strdup_printf ("%d", xserver_get_display_number (XSERVER (xserver)));
+ gethostname (hostname, 1024);
+ authority = xauth_new_cookie (XAUTH_FAMILY_LOCAL, hostname, number);
+ g_free (number);
+ xserver_set_authority (XSERVER (xserver), authority);
+ g_object_unref (authority);
+
+ display = xdisplay_new (XSERVER (xserver));
+ g_object_unref (xserver);
+
+ return DISPLAY (display);
+}
+
+static void
+seat_xlocal_set_active_display (Seat *seat, Display *display)
+{
+ gint number = xserver_local_get_vt (XSERVER_LOCAL (XSERVER (display_get_display_server (display))));
+ if (number >= 0)
+ vt_set_active (number);
+}
+
+static void
+seat_xlocal_init (SeatXLocal *seat)
+{
+}
+
+static void
+seat_xlocal_class_init (SeatXLocalClass *klass)
+{
+ SeatClass *seat_class = SEAT_CLASS (klass);
+
+ seat_class->setup = seat_xlocal_setup;
+ seat_class->add_display = seat_xlocal_add_display;
+ seat_class->set_active_display = seat_xlocal_set_active_display;
+}
* license.
*/
-#ifndef _SEAT_LOCAL_H_
-#define _SEAT_LOCAL_H_
+#ifndef _SEAT_XLOCAL_H_
+#define _SEAT_XLOCAL_H_
#include <glib-object.h>
#include "seat.h"
G_BEGIN_DECLS
-#define SEAT_LOCAL_TYPE (seat_local_get_type())
-#define SEAT_LOCAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAT_LOCAL_TYPE, SeatLocal))
-
-typedef struct SeatLocalPrivate SeatLocalPrivate;
+#define SEAT_XLOCAL_TYPE (seat_xlocal_get_type())
+#define SEAT_XLOCAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAT_XLOCAL_TYPE, SeatXLocal))
typedef struct
{
- Seat parent_instance;
- SeatLocalPrivate *priv;
-} SeatLocal;
+ Seat parent_instance;
+} SeatXLocal;
typedef struct
{
SeatClass parent_class;
-} SeatLocalClass;
-
-GType seat_local_get_type (void);
+} SeatXLocalClass;
-SeatLocal *seat_local_new (const gchar *config_section);
+GType seat_xlocal_get_type (void);
G_END_DECLS
-#endif /* _SEAT_LOCAL_H_ */
+#endif /* _SEAT_XLOCAL_H_ */
struct SeatPrivate
{
+ /* Configuration for this seat */
+ gchar *config_section;
+
/* True if able to switch users */
gboolean can_switch;
return NULL;
seat = g_object_new (m->type, NULL);
+ seat->priv->config_section = g_strdup (config_section);
return seat;
}
-void
-seat_load_config (Seat *seat, const gchar *config_section)
+const gchar *
+seat_get_config_section (Seat *seat)
{
- if (config_section && config_has_key (config_get_instance (), config_section, "autologin-guest"))
- seat->priv->autologin_guest = config_get_boolean (config_get_instance (), config_section, "autologin-guest");
- else if (config_has_key (config_get_instance (), "SeatDefaults", "autologin-guest"))
- seat->priv->autologin_guest = config_get_boolean (config_get_instance (), "SeatDefaults", "autologin-guest");
- if (config_section)
- seat->priv->autologin_username = config_get_string (config_get_instance (), config_section, "autologin-user");
- if (!seat->priv->autologin_username)
- seat->priv->autologin_username = config_get_string (config_get_instance (), "SeatDefaults", "autologin-user");
- if (config_section && config_has_key (config_get_instance (), config_section, "autologin-user-timeout"))
- seat->priv->autologin_timeout = config_get_integer (config_get_instance (), config_section, "autologin-user-timeout");
- else
- seat->priv->autologin_timeout = config_get_integer (config_get_instance (), "SeatDefaults", "autologin-user-timeout");
- if (seat->priv->autologin_timeout < 0)
- seat->priv->autologin_timeout = 0;
+ g_return_val_if_fail (seat != NULL, NULL);
+ return seat->priv->config_section;
}
void
seat_start (Seat *seat)
{
g_return_val_if_fail (seat != NULL, FALSE);
+
+ SEAT_GET_CLASS (seat)->setup (seat);
return SEAT_GET_CLASS (seat)->start (seat);
}
Display *display;
display = SEAT_GET_CLASS (seat)->add_display (seat);
+ display_load_config (DISPLAY (display), seat->priv->config_section);
g_signal_connect (display, "activate-user", G_CALLBACK (display_activate_user_cb), seat);
g_signal_connect (display, "stopped", G_CALLBACK (display_stopped_cb), seat);
seat->priv->displays = g_list_append (seat->priv->displays, g_object_ref (display));
SEAT_GET_CLASS (seat)->stop (seat);
}
+static void
+seat_real_setup (Seat *seat)
+{
+ if (seat->priv->config_section && config_has_key (config_get_instance (), seat->priv->config_section, "autologin-guest"))
+ seat->priv->autologin_guest = config_get_boolean (config_get_instance (), seat->priv->config_section, "autologin-guest");
+ else if (config_has_key (config_get_instance (), "SeatDefaults", "autologin-guest"))
+ seat->priv->autologin_guest = config_get_boolean (config_get_instance (), "SeatDefaults", "autologin-guest");
+ if (seat->priv->config_section)
+ seat->priv->autologin_username = config_get_string (config_get_instance (), seat->priv->config_section, "autologin-user");
+ if (!seat->priv->autologin_username)
+ seat->priv->autologin_username = config_get_string (config_get_instance (), "SeatDefaults", "autologin-user");
+ if (seat->priv->config_section && config_has_key (config_get_instance (), seat->priv->config_section, "autologin-user-timeout"))
+ seat->priv->autologin_timeout = config_get_integer (config_get_instance (), seat->priv->config_section, "autologin-user-timeout");
+ else
+ seat->priv->autologin_timeout = config_get_integer (config_get_instance (), "SeatDefaults", "autologin-user-timeout");
+ if (seat->priv->autologin_timeout < 0)
+ seat->priv->autologin_timeout = 0;
+}
+
static gboolean
seat_real_start (Seat *seat)
{
self = SEAT (object);
+ g_free (self->priv->config_section);
g_list_free_full (self->priv->displays, g_object_unref);
G_OBJECT_CLASS (seat_parent_class)->finalize (object);
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ klass->setup = seat_real_setup;
klass->start = seat_real_start;
klass->add_display = seat_real_add_display;
klass->set_active_display = seat_real_set_active_display;
{
GObjectClass parent_class;
+ void (*setup)(Seat *seat);
gboolean (*start)(Seat *seat);
Display *(*add_display)(Seat *seat);
void (*set_active_display)(Seat *seat, Display *display);
Seat *seat_new (const gchar *module, const gchar *config_section);
-void seat_load_config (Seat *seat, const gchar *config_section);
+const gchar *seat_get_config_section (Seat *seat);
void seat_set_can_switch (Seat *seat, gboolean can_switch);
G_DEFINE_TYPE (XDisplay, xdisplay, DISPLAY_TYPE);
XDisplay *
-xdisplay_new (const gchar *config_section, XServer *server)
+xdisplay_new (XServer *server)
{
XDisplay *self = g_object_new (XDISPLAY_TYPE, NULL);
g_return_val_if_fail (server != NULL, NULL);
- display_load_config (DISPLAY (self), config_section);
display_set_display_server (DISPLAY (self), DISPLAY_SERVER (server));
return self;
GType xdisplay_get_type (void);
-XDisplay *xdisplay_new (const gchar *config_section, XServer *server);
+XDisplay *xdisplay_new (XServer *server);
G_END_DECLS
/* Path of file to log to */
gchar *log_file;
-
+
/* Command to run the X server */
gchar *command;
}
XServerLocal *
-xserver_local_new (const gchar *config_section)
+xserver_local_new (void)
{
XServerLocal *self = g_object_new (XSERVER_LOCAL_TYPE, NULL);
xserver_set_display_number (XSERVER (self), get_free_display_number ());
-
- /* If running inside an X server use Xephyr instead */
- if (g_getenv ("DISPLAY"))
- self->priv->command = g_strdup ("Xephyr");
- if (!self->priv->command && config_section)
- self->priv->command = config_get_string (config_get_instance (), config_section, "xserver-command");
- if (!self->priv->command)
- self->priv->command = config_get_string (config_get_instance (), "SeatDefaults", "xserver-command");
-
- if (config_section)
- self->priv->layout = config_get_string (config_get_instance (), config_section, "xserver-layout");
- if (!self->priv->layout)
- self->priv->layout = config_get_string (config_get_instance (), "SeatDefaults", "layout");
-
- if (config_section)
- self->priv->config_file = config_get_string (config_get_instance (), config_section, "xserver-config");
- if (!self->priv->config_file)
- self->priv->config_file = config_get_string (config_get_instance (), "SeatDefaults", "xserver-config");
/* Replace Plymouth if it is running */
if (plymouth_get_is_active () && plymouth_has_active_vt ())
return self;
}
+void
+xserver_local_set_command (XServerLocal *server, const gchar *command)
+{
+ g_return_if_fail (server != NULL);
+ g_free (server->priv->command);
+ server->priv->command = g_strdup (command);
+}
+
+void
+xserver_local_set_config (XServerLocal *server, const gchar *path)
+{
+ g_return_if_fail (server != NULL);
+ g_free (server->priv->config_file);
+ server->priv->config_file = g_strdup (path);
+}
+
+void
+xserver_local_set_layout (XServerLocal *server, const gchar *layout)
+{
+ g_return_if_fail (server != NULL);
+ g_free (server->priv->layout);
+ server->priv->layout = g_strdup (layout);
+}
+
void
xserver_local_set_xdmcp_server (XServerLocal *server, const gchar *hostname)
{
{
server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, XSERVER_LOCAL_TYPE, XServerLocalPrivate);
server->priv->vt = -1;
+ server->priv->command = g_strdup ("X");
}
static void
GType xserver_local_get_type (void);
-XServerLocal *xserver_local_new (const gchar *config_section);
+XServerLocal *xserver_local_new (void);
+
+void xserver_local_set_command (XServerLocal *server, const gchar *command);
+
+void xserver_local_set_config (XServerLocal *server, const gchar *path);
+
+void xserver_local_set_layout (XServerLocal *server, const gchar *layout);
void xserver_local_set_xdmcp_server (XServerLocal *server, const gchar *hostname);