[gdm/wip/slave-display-merger: 18/29] display: start greeter session from display object
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/slave-display-merger: 18/29] display: start greeter session from display object
- Date: Tue, 3 Feb 2015 22:17:50 +0000 (UTC)
commit d690cadbddc65b9844891bc976e9a430155adcb4
Author: Ray Strode <rstrode redhat com>
Date: Thu Jan 29 16:47:56 2015 -0500
display: start greeter session from display object
This is just more gutting of the slave code.
daemon/gdm-display.c | 332 ++++++++++++++++++++++++++++++++++-
daemon/gdm-simple-slave.c | 430 ---------------------------------------------
daemon/gdm-slave.c | 12 --
daemon/gdm-slave.h | 6 -
4 files changed, 329 insertions(+), 451 deletions(-)
---
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 09c233e..a07924a 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -41,6 +41,7 @@
#include "gdm-settings-direct.h"
#include "gdm-settings-keys.h"
+#include "gdm-launch-environment.h"
#include "gdm-simple-slave.h"
#include "gdm-dbus-util.h"
@@ -78,11 +79,15 @@ struct GdmDisplayPrivate
GDBusProxy *accountsservice_proxy;
+ /* this spawns and controls the greeter session */
+ GdmLaunchEnvironment *greeter_environment;
+
guint is_local : 1;
guint is_initial : 1;
guint allow_timed_login : 1;
guint accountsservice_ready : 1;
guint have_existing_user_accounts : 1;
+ guint doing_initial_setup : 1;
};
enum {
@@ -109,9 +114,79 @@ static void gdm_display_finalize (GObject *object);
static void queue_finish (GdmDisplay *self);
static void _gdm_display_set_status (GdmDisplay *self,
int status);
-
G_DEFINE_ABSTRACT_TYPE (GdmDisplay, gdm_display, G_TYPE_OBJECT)
+static gboolean
+chown_file (GFile *file,
+ uid_t uid,
+ gid_t gid,
+ GError **error)
+{
+ if (!g_file_set_attribute_uint32 (file, G_FILE_ATTRIBUTE_UNIX_UID, uid,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, error)) {
+ return FALSE;
+ }
+ if (!g_file_set_attribute_uint32 (file, G_FILE_ATTRIBUTE_UNIX_GID, gid,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, error)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean
+chown_recursively (GFile *dir,
+ uid_t uid,
+ gid_t gid,
+ GError **error)
+{
+ GFile *file = NULL;
+ GFileInfo *info = NULL;
+ GFileEnumerator *enumerator = NULL;
+ gboolean retval = FALSE;
+
+ if (chown_file (dir, uid, gid, error) == FALSE) {
+ goto out;
+ }
+
+ enumerator = g_file_enumerate_children (dir,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE","
+ G_FILE_ATTRIBUTE_STANDARD_NAME,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, error);
+ if (!enumerator) {
+ goto out;
+ }
+
+ while ((info = g_file_enumerator_next_file (enumerator, NULL, error)) != NULL) {
+ file = g_file_get_child (dir, g_file_info_get_name (info));
+
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ if (chown_recursively (file, uid, gid, error) == FALSE) {
+ goto out;
+ }
+ } else if (chown_file (file, uid, gid, error) == FALSE) {
+ goto out;
+ }
+
+ g_clear_object (&file);
+ g_clear_object (&info);
+ }
+
+ if (*error) {
+ goto out;
+ }
+
+ retval = TRUE;
+out:
+ g_clear_object (&file);
+ g_clear_object (&info);
+ g_clear_object (&enumerator);
+
+ return retval;
+}
+
GQuark
gdm_display_error_quark (void)
{
@@ -1377,6 +1452,55 @@ gdm_display_get_object_skeleton (GdmDisplay *self)
return self->priv->object_skeleton;
}
+static void
+on_greeter_environment_session_opened (GdmLaunchEnvironment *greeter_environment,
+ GdmDisplay *self)
+{
+ char *session_id;
+
+ g_debug ("GdmDisplay: Greeter session opened");
+ session_id = gdm_launch_environment_get_session_id (GDM_LAUNCH_ENVIRONMENT (greeter_environment));
+
+ g_object_set (GDM_SLAVE (self), "session-id", session_id, NULL);
+ g_free (session_id);
+}
+
+static void
+on_greeter_environment_session_started (GdmLaunchEnvironment *greeter_environment,
+ GdmDisplay *self)
+{
+ g_debug ("GdmDisplay: Greeter started");
+}
+
+static void
+on_greeter_environment_session_stopped (GdmLaunchEnvironment *greeter_environment,
+ GdmDisplay *self)
+{
+ g_debug ("GdmDisplay: Greeter stopped");
+ gdm_slave_stop (self->priv->slave);
+
+ g_object_unref (self->priv->greeter_environment);
+ self->priv->greeter_environment = NULL;
+}
+
+static void
+on_greeter_environment_session_exited (GdmLaunchEnvironment *greeter_environment,
+ int code,
+ GdmDisplay *self)
+{
+ g_debug ("GdmDisplay: Greeter exited: %d", code);
+ gdm_slave_stop (self->priv->slave);
+}
+
+static void
+on_greeter_environment_session_died (GdmLaunchEnvironment *greeter_environment,
+ int signal,
+ GdmDisplay *self)
+{
+ g_debug ("GdmDisplay: Greeter died: %d", signal);
+ gdm_slave_stop (self->priv->slave);
+}
+
static gboolean
can_create_environment (const char *session_id)
{
@@ -1391,6 +1515,121 @@ can_create_environment (const char *session_id)
return session_exists;
}
+static GdmLaunchEnvironment *
+create_environment (const char *session_id,
+ const char *user_name,
+ const char *display_name,
+ const char *seat_id,
+ const char *display_hostname,
+ gboolean display_is_local)
+{
+ gboolean debug = FALSE;
+ char *command;
+ GdmLaunchEnvironment *launch_environment;
+ char **argv;
+ GPtrArray *args;
+
+ gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
+
+ args = g_ptr_array_new ();
+ g_ptr_array_add (args, BINDIR "/gnome-session");
+
+ g_ptr_array_add (args, "--autostart");
+ g_ptr_array_add (args, DATADIR "/gdm/greeter/autostart");
+
+ if (debug) {
+ g_ptr_array_add (args, "--debug");
+ }
+
+ if (session_id != NULL) {
+ g_ptr_array_add (args, " --session");
+ g_ptr_array_add (args, (char *) session_id);
+ }
+
+ g_ptr_array_add (args, NULL);
+
+ argv = (char **) g_ptr_array_free (args, FALSE);
+ command = g_strjoinv (" ", argv);
+ g_free (argv);
+
+ launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT,
+ "command", command,
+ "user-name", user_name,
+ "x11-display-name", display_name,
+ "x11-display-seat-id", seat_id,
+ "x11-display-hostname", display_hostname,
+ "x11-display-is-local", display_is_local,
+ "runtime-dir", GDM_SCREENSHOT_DIR,
+ NULL);
+
+ g_free (command);
+ return launch_environment;
+}
+
+static void
+start_launch_environment (GdmDisplay *self,
+ char *username,
+ char *session_id)
+{
+ char *display_name;
+ char *seat_id;
+ char *hostname;
+ char *auth_file;
+
+ g_debug ("GdmDisplay: Running greeter");
+
+ display_name = NULL;
+ seat_id = NULL;
+ auth_file = NULL;
+ hostname = NULL;
+
+ g_object_get (self,
+ "x11-display-name", &display_name,
+ "seat-id", &seat_id,
+ "remote-hostname", &hostname,
+ "x11-authority-file", &auth_file,
+ NULL);
+
+ g_debug ("GdmDisplay: Creating greeter for %s %s", display_name, hostname);
+
+ self->priv->greeter_environment = create_environment (session_id,
+ username,
+ display_name,
+ seat_id,
+ hostname,
+ self->priv->is_local);
+ g_signal_connect (self->priv->greeter_environment,
+ "opened",
+ G_CALLBACK (on_greeter_environment_session_opened),
+ self);
+ g_signal_connect (self->priv->greeter_environment,
+ "started",
+ G_CALLBACK (on_greeter_environment_session_started),
+ self);
+ g_signal_connect (self->priv->greeter_environment,
+ "stopped",
+ G_CALLBACK (on_greeter_environment_session_stopped),
+ self);
+ g_signal_connect (self->priv->greeter_environment,
+ "exited",
+ G_CALLBACK (on_greeter_environment_session_exited),
+ self);
+ g_signal_connect (self->priv->greeter_environment,
+ "died",
+ G_CALLBACK (on_greeter_environment_session_died),
+ self);
+ g_object_set (self->priv->greeter_environment,
+ "x11-authority-file", auth_file,
+ NULL);
+
+ gdm_launch_environment_start (GDM_LAUNCH_ENVIRONMENT (self->priv->greeter_environment));
+
+ g_free (display_name);
+ g_free (seat_id);
+ g_free (hostname);
+ g_free (auth_file);
+}
+
static gboolean
wants_autologin (GdmDisplay *self)
{
@@ -1446,16 +1685,103 @@ gdm_display_set_up_greeter_session (GdmDisplay *self,
}
}
+static void
+start_greeter (GdmDisplay *self)
+{
+ start_launch_environment (self, GDM_USERNAME, NULL);
+}
+
+static void
+start_initial_setup (GdmDisplay *self)
+{
+ self->priv->doing_initial_setup = TRUE;
+ start_launch_environment (self, INITIAL_SETUP_USERNAME, "gnome-initial-setup");
+}
+
void
gdm_display_start_greeter_session (GdmDisplay *self)
{
- gdm_slave_start_greeter_session (self->priv->slave);
+
+ if (wants_initial_setup (self)) {
+ start_initial_setup (self);
+ } else if (!wants_autologin (self)) {
+ start_greeter (self);
+ }
+}
+
+static void
+chown_initial_setup_home_dir (void)
+{
+ GFile *dir;
+ GError *error;
+ char *gis_dir_path;
+ char *gis_uid_path;
+ char *gis_uid_contents;
+ struct passwd *pwe;
+ uid_t uid;
+
+ if (!gdm_get_pwent_for_name (INITIAL_SETUP_USERNAME, &pwe)) {
+ g_warning ("Unknown user %s", INITIAL_SETUP_USERNAME);
+ return;
+ }
+
+ gis_dir_path = g_strdup (pwe->pw_dir);
+
+ gis_uid_path = g_build_filename (gis_dir_path,
+ "gnome-initial-setup-uid",
+ NULL);
+ if (!g_file_get_contents (gis_uid_path, &gis_uid_contents, NULL, NULL)) {
+ g_warning ("Unable to read %s", gis_uid_path);
+ goto out;
+ }
+
+ uid = (uid_t) atoi (gis_uid_contents);
+ pwe = getpwuid (uid);
+ if (uid == 0 || pwe == NULL) {
+ g_warning ("UID '%s' in %s is not valid", gis_uid_contents, gis_uid_path);
+ goto out;
+ }
+
+ error = NULL;
+ dir = g_file_new_for_path (gis_dir_path);
+ if (!chown_recursively (dir, pwe->pw_uid, pwe->pw_gid, &error)) {
+ g_warning ("Failed to change ownership for %s: %s", gis_dir_path, error->message);
+ g_error_free (error);
+ }
+ g_object_unref (dir);
+out:
+ g_free (gis_uid_contents);
+ g_free (gis_uid_path);
+ g_free (gis_dir_path);
}
+
void
gdm_display_stop_greeter_session (GdmDisplay *self)
{
- gdm_slave_stop_greeter_session (self->priv->slave);
+ if (self->priv->greeter_environment != NULL) {
+ g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
+ G_CALLBACK (on_greeter_environment_session_opened),
+ self);
+ g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
+ G_CALLBACK (on_greeter_environment_session_started),
+ self);
+ g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
+ G_CALLBACK (on_greeter_environment_session_stopped),
+ self);
+ g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
+ G_CALLBACK (on_greeter_environment_session_exited),
+ self);
+ g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
+ G_CALLBACK (on_greeter_environment_session_died),
+ self);
+ gdm_launch_environment_stop (GDM_LAUNCH_ENVIRONMENT (self->priv->greeter_environment));
+ g_clear_object (&self->priv->greeter_environment);
+ }
+
+ if (self->priv->doing_initial_setup) {
+ chown_initial_setup_home_dir ();
+ }
}
GdmSlave *
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index ba462e9..b1a4445 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -76,9 +76,6 @@ struct GdmSimpleSlavePrivate
GdmServer *server;
- /* this spawns and controls the greeter session */
- GdmLaunchEnvironment *greeter_environment;
-
GDBusProxy *accountsservice_proxy;
guint have_existing_user_accounts : 1;
guint accountsservice_ready : 1;
@@ -101,126 +98,8 @@ static void gdm_simple_slave_class_init (GdmSimpleSlaveClass *klass);
static void gdm_simple_slave_init (GdmSimpleSlave *simple_slave);
static void gdm_simple_slave_finalize (GObject *object);
-static gboolean wants_initial_setup (GdmSimpleSlave *slave);
G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE)
-static gboolean
-chown_file (GFile *file,
- uid_t uid,
- gid_t gid,
- GError **error)
-{
- if (!g_file_set_attribute_uint32 (file, G_FILE_ATTRIBUTE_UNIX_UID, uid,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, error)) {
- return FALSE;
- }
- if (!g_file_set_attribute_uint32 (file, G_FILE_ATTRIBUTE_UNIX_GID, gid,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, error)) {
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
-chown_recursively (GFile *dir,
- uid_t uid,
- gid_t gid,
- GError **error)
-{
- GFile *file = NULL;
- GFileInfo *info = NULL;
- GFileEnumerator *enumerator = NULL;
- gboolean retval = FALSE;
-
- if (chown_file (dir, uid, gid, error) == FALSE) {
- goto out;
- }
-
- enumerator = g_file_enumerate_children (dir,
- G_FILE_ATTRIBUTE_STANDARD_TYPE","
- G_FILE_ATTRIBUTE_STANDARD_NAME,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL, error);
- if (!enumerator) {
- goto out;
- }
-
- while ((info = g_file_enumerator_next_file (enumerator, NULL, error)) != NULL) {
- file = g_file_get_child (dir, g_file_info_get_name (info));
-
- if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
- if (chown_recursively (file, uid, gid, error) == FALSE) {
- goto out;
- }
- } else if (chown_file (file, uid, gid, error) == FALSE) {
- goto out;
- }
-
- g_clear_object (&file);
- g_clear_object (&info);
- }
-
- if (*error) {
- goto out;
- }
-
- retval = TRUE;
-out:
- g_clear_object (&file);
- g_clear_object (&info);
- g_clear_object (&enumerator);
-
- return retval;
-}
-
-static void
-chown_initial_setup_home_dir (void)
-{
- GFile *dir;
- GError *error;
- char *gis_dir_path;
- char *gis_uid_path;
- char *gis_uid_contents;
- struct passwd *pwe;
- uid_t uid;
-
- if (!gdm_get_pwent_for_name (INITIAL_SETUP_USERNAME, &pwe)) {
- g_warning ("Unknown user %s", INITIAL_SETUP_USERNAME);
- return;
- }
-
- gis_dir_path = g_strdup (pwe->pw_dir);
-
- gis_uid_path = g_build_filename (gis_dir_path,
- "gnome-initial-setup-uid",
- NULL);
- if (!g_file_get_contents (gis_uid_path, &gis_uid_contents, NULL, NULL)) {
- g_warning ("Unable to read %s", gis_uid_path);
- goto out;
- }
-
- uid = (uid_t) atoi (gis_uid_contents);
- pwe = getpwuid (uid);
- if (uid == 0 || pwe == NULL) {
- g_warning ("UID '%s' in %s is not valid", gis_uid_contents, gis_uid_path);
- goto out;
- }
-
- error = NULL;
- dir = g_file_new_for_path (gis_dir_path);
- if (!chown_recursively (dir, pwe->pw_uid, pwe->pw_gid, &error)) {
- g_warning ("Failed to change ownership for %s: %s", gis_dir_path, error->message);
- g_error_free (error);
- }
- g_object_unref (dir);
-out:
- g_free (gis_uid_contents);
- g_free (gis_uid_path);
- g_free (gis_dir_path);
-}
-
#ifdef HAVE_LOGINDEVPERM
static void
gdm_simple_slave_grant_console_permissions (GdmSimpleSlave *slave)
@@ -288,55 +167,6 @@ gdm_simple_slave_revoke_console_permissions (GdmSimpleSlave *slave)
}
#endif /* HAVE_LOGINDEVPERM */
-static void
-on_greeter_environment_session_opened (GdmLaunchEnvironment *greeter_environment,
- GdmSimpleSlave *slave)
-{
- char *session_id;
-
- g_debug ("GdmSimpleSlave: Greeter session opened");
- session_id = gdm_launch_environment_get_session_id (GDM_LAUNCH_ENVIRONMENT (greeter_environment));
-
- g_object_set (GDM_SLAVE (slave), "session-id", session_id, NULL);
- g_free (session_id);
-}
-
-static void
-on_greeter_environment_session_started (GdmLaunchEnvironment *greeter_environment,
- GdmSimpleSlave *slave)
-{
- g_debug ("GdmSimpleSlave: Greeter started");
-}
-
-static void
-on_greeter_environment_session_stopped (GdmLaunchEnvironment *greeter_environment,
- GdmSimpleSlave *slave)
-{
- g_debug ("GdmSimpleSlave: Greeter stopped");
- gdm_slave_stop (GDM_SLAVE (slave));
-
- g_object_unref (slave->priv->greeter_environment);
- slave->priv->greeter_environment = NULL;
-}
-
-static void
-on_greeter_environment_session_exited (GdmLaunchEnvironment *greeter_environment,
- int code,
- GdmSimpleSlave *slave)
-{
- g_debug ("GdmSimpleSlave: Greeter exited: %d", code);
- gdm_slave_stop (GDM_SLAVE (slave));
-}
-
-static void
-on_greeter_environment_session_died (GdmLaunchEnvironment *greeter_environment,
- int signal,
- GdmSimpleSlave *slave)
-{
- g_debug ("GdmSimpleSlave: Greeter died: %d", signal);
- gdm_slave_stop (GDM_SLAVE (slave));
-}
-
#ifdef WITH_PLYMOUTH
static gboolean
plymouth_is_running (void)
@@ -417,262 +247,6 @@ setup_server (GdmSimpleSlave *slave)
}
static gboolean
-can_create_environment (const char *session_id)
-{
- char *path;
- gboolean session_exists;
-
- path = g_strdup_printf (GNOME_SESSION_SESSIONS_PATH "/%s.session", session_id);
- session_exists = g_file_test (path, G_FILE_TEST_EXISTS);
-
- g_free (path);
-
- return session_exists;
-}
-
-static GdmLaunchEnvironment *
-create_environment (const char *session_id,
- const char *user_name,
- const char *display_name,
- const char *seat_id,
- const char *display_device,
- const char *display_hostname,
- gboolean display_is_local)
-{
- gboolean debug = FALSE;
- char *command;
- GdmLaunchEnvironment *launch_environment;
- char **argv;
- GPtrArray *args;
-
- gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug);
-
- args = g_ptr_array_new ();
- g_ptr_array_add (args, BINDIR "/gnome-session");
-
- g_ptr_array_add (args, "--autostart");
- g_ptr_array_add (args, DATADIR "/gdm/greeter/autostart");
-
- if (debug) {
- g_ptr_array_add (args, "--debug");
- }
-
- if (session_id != NULL) {
- g_ptr_array_add (args, " --session");
- g_ptr_array_add (args, (char *) session_id);
- }
-
- g_ptr_array_add (args, NULL);
-
- argv = (char **) g_ptr_array_free (args, FALSE);
- command = g_strjoinv (" ", argv);
- g_free (argv);
-
- launch_environment = g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT,
- "command", command,
- "user-name", user_name,
- "x11-display-name", display_name,
- "x11-display-seat-id", seat_id,
- "x11-display-device", display_device,
- "x11-display-hostname", display_hostname,
- "x11-display-is-local", display_is_local,
- "runtime-dir", GDM_SCREENSHOT_DIR,
- NULL);
-
- g_free (command);
- return launch_environment;
-}
-
-static void
-start_launch_environment (GdmSimpleSlave *slave,
- char *username,
- char *session_id)
-{
- gboolean display_is_local;
- char *display_name;
- char *seat_id;
- char *display_device;
- char *display_hostname;
- char *auth_file;
- gboolean res;
-
- g_debug ("GdmSimpleSlave: Running greeter");
-
- display_is_local = FALSE;
- display_name = NULL;
- seat_id = NULL;
- auth_file = NULL;
- display_device = NULL;
- display_hostname = NULL;
-
- g_object_get (slave,
- "display-is-local", &display_is_local,
- "display-name", &display_name,
- "display-seat-id", &seat_id,
- "display-hostname", &display_hostname,
- "display-x11-authority-file", &auth_file,
- NULL);
-
- g_debug ("GdmSimpleSlave: Creating greeter for %s %s", display_name, display_hostname);
-
- if (slave->priv->server != NULL) {
- display_device = gdm_server_get_display_device (slave->priv->server);
- }
-
- /* FIXME: send a signal back to the master */
-
- /* If XDMCP setup pinging */
- slave->priv->ping_interval = DEFAULT_PING_INTERVAL;
- res = gdm_settings_direct_get_int (GDM_KEY_PING_INTERVAL,
- &(slave->priv->ping_interval));
-
- if ( ! display_is_local && res && slave->priv->ping_interval > 0) {
- alarm (slave->priv->ping_interval);
- }
-
- g_debug ("GdmSimpleSlave: Creating greeter on %s %s %s", display_name, display_device,
display_hostname);
- slave->priv->greeter_environment = create_environment (session_id,
- username,
- display_name,
- seat_id,
- display_device,
- display_hostname,
- display_is_local);
- g_signal_connect (slave->priv->greeter_environment,
- "opened",
- G_CALLBACK (on_greeter_environment_session_opened),
- slave);
- g_signal_connect (slave->priv->greeter_environment,
- "started",
- G_CALLBACK (on_greeter_environment_session_started),
- slave);
- g_signal_connect (slave->priv->greeter_environment,
- "stopped",
- G_CALLBACK (on_greeter_environment_session_stopped),
- slave);
- g_signal_connect (slave->priv->greeter_environment,
- "exited",
- G_CALLBACK (on_greeter_environment_session_exited),
- slave);
- g_signal_connect (slave->priv->greeter_environment,
- "died",
- G_CALLBACK (on_greeter_environment_session_died),
- slave);
- g_object_set (slave->priv->greeter_environment,
- "x11-authority-file", auth_file,
- NULL);
-
- gdm_launch_environment_start (GDM_LAUNCH_ENVIRONMENT (slave->priv->greeter_environment));
-
- g_free (display_name);
- g_free (seat_id);
- g_free (display_device);
- g_free (display_hostname);
- g_free (auth_file);
-}
-
-static void
-start_greeter (GdmSimpleSlave *slave)
-{
- start_launch_environment (slave, GDM_USERNAME, NULL);
-}
-
-static void
-start_initial_setup (GdmSimpleSlave *slave)
-{
- slave->priv->doing_initial_setup = TRUE;
- start_launch_environment (slave, INITIAL_SETUP_USERNAME, "gnome-initial-setup");
-}
-
-static gboolean
-wants_autologin (GdmSimpleSlave *slave)
-{
- gboolean enabled = FALSE;
- int delay = 0;
- /* FIXME: handle wait-for-go */
-
- if (g_file_test (GDM_RAN_ONCE_MARKER_FILE, G_FILE_TEST_EXISTS)) {
- return FALSE;
- }
-
- gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, NULL, &delay);
- return enabled && delay == 0;
-}
-
-static gboolean
-wants_initial_setup (GdmSimpleSlave *slave)
-{
- gboolean enabled = FALSE;
- gboolean display_is_local = FALSE;
-
- g_object_get (G_OBJECT (slave),
- "display-is-local", &display_is_local,
- NULL);
-
- /* don't run initial-setup on remote displays
- */
- if (!display_is_local) {
- return FALSE;
- }
-
- /* don't run if the system has existing users */
- if (slave->priv->have_existing_user_accounts) {
- return FALSE;
- }
-
- /* don't run if initial-setup is unavailable */
- if (!can_create_environment ("gnome-initial-setup")) {
- return FALSE;
- }
-
- if (!gdm_settings_direct_get_boolean (GDM_KEY_INITIAL_SETUP_ENABLE, &enabled)) {
- return FALSE;
- }
-
- return enabled;
-}
-
-static void
-gdm_simple_slave_stop_greeter_session (GdmSlave *slave)
-{
- GdmSimpleSlave *self = GDM_SIMPLE_SLAVE (slave);
-
- if (self->priv->greeter_environment != NULL) {
- g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
- G_CALLBACK (on_greeter_environment_session_opened),
- self);
- g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
- G_CALLBACK (on_greeter_environment_session_started),
- self);
- g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
- G_CALLBACK (on_greeter_environment_session_stopped),
- self);
- g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
- G_CALLBACK (on_greeter_environment_session_exited),
- self);
- g_signal_handlers_disconnect_by_func (self->priv->greeter_environment,
- G_CALLBACK (on_greeter_environment_session_died),
- self);
- gdm_launch_environment_stop (GDM_LAUNCH_ENVIRONMENT (self->priv->greeter_environment));
- g_clear_object (&self->priv->greeter_environment);
- }
-
- if (GDM_SIMPLE_SLAVE (slave)->priv->doing_initial_setup) {
- chown_initial_setup_home_dir ();
- }
-}
-
-static void
-gdm_simple_slave_start_greeter_session (GdmSlave *slave)
-{
- if (wants_initial_setup (GDM_SIMPLE_SLAVE (slave))) {
- start_initial_setup (GDM_SIMPLE_SLAVE (slave));
- } else if (!wants_autologin (GDM_SIMPLE_SLAVE (slave))) {
- start_greeter (GDM_SIMPLE_SLAVE (slave));
- }
-}
-
-static gboolean
idle_connect_to_display (GdmSimpleSlave *slave)
{
gboolean res;
@@ -896,8 +470,6 @@ gdm_simple_slave_stop (GdmSlave *slave)
GDM_SLAVE_CLASS (gdm_simple_slave_parent_class)->stop (slave);
- gdm_simple_slave_stop_greeter_session (slave);
-
if (self->priv->server != NULL) {
gdm_server_stop (self->priv->server);
g_clear_object (&self->priv->server);
@@ -918,8 +490,6 @@ gdm_simple_slave_class_init (GdmSimpleSlaveClass *klass)
slave_class->start = gdm_simple_slave_start;
slave_class->stop = gdm_simple_slave_stop;
- slave_class->start_greeter_session = gdm_simple_slave_start_greeter_session;
- slave_class->stop_greeter_session = gdm_simple_slave_stop_greeter_session;
g_type_class_add_private (klass, sizeof (GdmSimpleSlavePrivate));
}
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index 6942aec..a16b563 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -697,18 +697,6 @@ gdm_slave_get_property (GObject *object,
}
}
-void
-gdm_slave_start_greeter_session (GdmSlave *slave)
-{
- GDM_SLAVE_GET_CLASS (slave)->start_greeter_session (slave);
-}
-
-void
-gdm_slave_stop_greeter_session (GdmSlave *slave)
-{
- GDM_SLAVE_GET_CLASS (slave)->stop_greeter_session (slave);
-}
-
static void
gdm_slave_class_init (GdmSlaveClass *klass)
{
diff --git a/daemon/gdm-slave.h b/daemon/gdm-slave.h
index 9ed3992..e003319 100644
--- a/daemon/gdm-slave.h
+++ b/daemon/gdm-slave.h
@@ -50,9 +50,6 @@ typedef struct
gboolean (*start) (GdmSlave *slave);
gboolean (*stop) (GdmSlave *slave);
- void (* start_greeter_session) (GdmSlave *slave);
- void (* stop_greeter_session) (GdmSlave *slave);
-
/* signals */
void (*stopped) (GdmSlave *slave);
} GdmSlaveClass;
@@ -81,9 +78,6 @@ gboolean gdm_slave_add_user_authorization (GdmSlave *slave,
gboolean gdm_slave_connect_to_x11_display (GdmSlave *slave);
-void gdm_slave_start_greeter_session (GdmSlave *slave);
-void gdm_slave_stop_greeter_session (GdmSlave *slave);
-
G_END_DECLS
#endif /* __GDM_SLAVE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]