diff options
author | Ray Strode <rstrode@redhat.com> | 2015-02-03 17:13:51 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2015-02-18 17:34:12 -0500 |
commit | ca5fccc2217644ab5c4c5e8de7fa2fc8b627f63a (patch) | |
tree | a6b570a88c104a8b8a3e3970ab2ec1eee35e0738 /daemon/gdm-local-display.c | |
parent | 8b2ac7e7ac11165187c8314f8c20efec18305863 (diff) | |
download | gdm-ca5fccc2217644ab5c4c5e8de7fa2fc8b627f63a.tar.gz |
display: get rid of more simple slave code.
This commit moves GdmServer to GdmLocalDisplay, and
XDMCP connection retries to GdmXdmcpDisplay.
https://bugzilla.gnome.org/show_bug.cgi?id=744764
Diffstat (limited to 'daemon/gdm-local-display.c')
-rw-r--r-- | daemon/gdm-local-display.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/daemon/gdm-local-display.c b/daemon/gdm-local-display.c index 112a7cd2..505a1b3a 100644 --- a/daemon/gdm-local-display.c +++ b/daemon/gdm-local-display.c @@ -41,12 +41,17 @@ #include "gdm-launch-environment.h" #include "gdm-local-display.h" #include "gdm-local-display-glue.h" +#include "gdm-server.h" +#include "gdm-settings-direct.h" +#include "gdm-settings-keys.h" #define GDM_LOCAL_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LOCAL_DISPLAY, GdmLocalDisplayPrivate)) struct GdmLocalDisplayPrivate { GdmDBusLocalDisplay *skeleton; + + GdmServer *server; }; static void gdm_local_display_class_init (GdmLocalDisplayClass *klass); @@ -79,6 +84,7 @@ gdm_local_display_finalize (GObject *object) GdmLocalDisplay *display = GDM_LOCAL_DISPLAY (object); g_clear_object (&display->priv->skeleton); + g_clear_object (&display->priv->server); G_OBJECT_CLASS (gdm_local_display_parent_class)->finalize (object); } @@ -120,6 +126,106 @@ gdm_local_display_prepare (GdmDisplay *display) } static void +on_server_ready (GdmServer *server, + GdmLocalDisplay *self) +{ + gboolean ret; + + ret = gdm_display_connect (GDM_DISPLAY (self)); + + if (!ret) { + g_debug ("GdmDisplay: could not connect to display"); + gdm_display_unmanage (GDM_DISPLAY (self)); + } else { + g_debug ("GdmDisplay: connected to display"); + g_object_set (G_OBJECT (self), "status", GDM_DISPLAY_MANAGED, NULL); + } +} + +static void +on_server_exited (GdmServer *server, + int exit_code, + GdmDisplay *self) +{ + g_debug ("GdmDisplay: server exited with code %d\n", exit_code); + + gdm_display_unmanage (GDM_DISPLAY (self)); +} + +static void +on_server_died (GdmServer *server, + int signal_number, + GdmDisplay *self) +{ + g_debug ("GdmDisplay: server died with signal %d, (%s)", + signal_number, + g_strsignal (signal_number)); + + gdm_display_unmanage (GDM_DISPLAY (self)); +} + +static void +gdm_local_display_manage (GdmDisplay *display) +{ + GdmLocalDisplay *self = GDM_LOCAL_DISPLAY (display); + char *display_name; + char *auth_file; + char *seat_id; + gboolean is_initial; + gboolean res; + gboolean disable_tcp; + + g_object_get (G_OBJECT (self), + "x11-display-name", &display_name, + "x11-authority-file", &auth_file, + "seat-id", &seat_id, + "is-initial", &is_initial, + NULL); + + self->priv->server = gdm_server_new (display_name, seat_id, auth_file, is_initial); + + g_free (display_name); + g_free (auth_file); + g_free (seat_id); + + disable_tcp = TRUE; + if (gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disable_tcp)) { + g_object_set (self->priv->server, + "disable-tcp", disable_tcp, + NULL); + } + + g_signal_connect (self->priv->server, + "exited", + G_CALLBACK (on_server_exited), + self); + g_signal_connect (self->priv->server, + "died", + G_CALLBACK (on_server_died), + self); + g_signal_connect (self->priv->server, + "ready", + G_CALLBACK (on_server_ready), + self); + + res = gdm_server_start (self->priv->server); + if (! res) { + g_warning (_("Could not start the X " + "server (your graphical environment) " + "due to an internal error. " + "Please contact your system administrator " + "or check your syslog to diagnose. " + "In the meantime this display will be " + "disabled. Please restart GDM when " + "the problem is corrected.")); + gdm_display_unmanage (GDM_DISPLAY (self)); + } + + g_debug ("GdmDisplay: Started X server"); + +} + +static void gdm_local_display_class_init (GdmLocalDisplayClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -129,6 +235,7 @@ gdm_local_display_class_init (GdmLocalDisplayClass *klass) object_class->finalize = gdm_local_display_finalize; display_class->prepare = gdm_local_display_prepare; + display_class->manage = gdm_local_display_manage; g_type_class_add_private (klass, sizeof (GdmLocalDisplayPrivate)); } |