[gdm/wip/slave-display-merger: 25/29] daemon: move plymouth code from slave to manager
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/slave-display-merger: 25/29] daemon: move plymouth code from slave to manager
- Date: Tue, 3 Feb 2015 22:18:26 +0000 (UTC)
commit 45866caeae85dbc7ac5ed635bbed4f4e144aaf3d
Author: Ray Strode <rstrode redhat com>
Date: Mon Feb 2 16:11:28 2015 -0500
daemon: move plymouth code from slave to manager
In an effort to pare down the slave code, this commit
moves the plymouth bits to GdmManager.
daemon/gdm-manager.c | 96 ++++++++++++++++++++++++++++++++++++++++++
daemon/gdm-simple-slave.c | 102 ---------------------------------------------
2 files changed, 96 insertions(+), 102 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 155b998..4bd1b42 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -83,6 +83,10 @@ struct GdmManagerPrivate
GDBusProxy *bus_proxy;
GDBusConnection *connection;
GDBusObjectManagerServer *object_manager;
+
+#ifdef WITH_PLYMOUTH
+ guint plymouth_is_running : 1;
+#endif
};
enum {
@@ -117,6 +121,72 @@ G_DEFINE_TYPE_WITH_CODE (GdmManager,
G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_MANAGER,
manager_interface_init));
+#ifdef WITH_PLYMOUTH
+static gboolean
+plymouth_is_running (void)
+{
+ int status;
+ gboolean res;
+ GError *error;
+
+ error = NULL;
+ res = g_spawn_command_line_sync ("/bin/plymouth --ping",
+ NULL, NULL, &status, &error);
+ if (! res) {
+ g_debug ("Could not ping plymouth: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
+}
+
+static void
+plymouth_prepare_for_transition (void)
+{
+ gboolean res;
+ GError *error;
+
+ error = NULL;
+ res = g_spawn_command_line_sync ("/bin/plymouth deactivate",
+ NULL, NULL, NULL, &error);
+ if (! res) {
+ g_warning ("Could not deactivate plymouth: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+plymouth_quit_with_transition (void)
+{
+ gboolean res;
+ GError *error;
+
+ error = NULL;
+ res = g_spawn_command_line_sync ("/bin/plymouth quit --retain-splash",
+ NULL, NULL, NULL, &error);
+ if (! res) {
+ g_warning ("Could not quit plymouth: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+plymouth_quit_without_transition (void)
+{
+ gboolean res;
+ GError *error;
+
+ error = NULL;
+ res = g_spawn_command_line_sync ("/bin/plymouth quit",
+ NULL, NULL, NULL, &error);
+ if (! res) {
+ g_warning ("Could not quit plymouth: %s", error->message);
+ g_error_free (error);
+ }
+}
+#endif
+
#ifdef WITH_SYSTEMD
static char *
get_session_id_for_pid_systemd (pid_t pid,
@@ -1270,16 +1340,35 @@ on_display_status_changed (GdmDisplay *display,
GdmManager *manager)
{
int status;
+#ifdef WITH_PLYMOUTH
+ gboolean display_is_local = FALSE;
+ gboolean quit_plymouth = FALSE;
+
+ g_object_get (display, "is-local", &display_is_local, NULL);
+ quit_plymouth = display_is_local && manager->priv->plymouth_is_running;
+#endif
status = gdm_display_get_status (display);
switch (status) {
case GDM_DISPLAY_MANAGED:
+#ifdef WITH_PLYMOUTH
+ if (quit_plymouth) {
+ plymouth_quit_with_transition ();
+ manager->priv->plymouth_is_running = FALSE;
+ }
set_up_greeter_session (manager, display);
+#endif
break;
case GDM_DISPLAY_FAILED:
case GDM_DISPLAY_UNMANAGED:
case GDM_DISPLAY_FINISHED:
+#ifdef WITH_PLYMOUTH
+ if (quit_plymouth) {
+ plymouth_quit_without_transition ();
+ manager->priv->plymouth_is_running = FALSE;
+ }
+#endif
break;
default:
break;
@@ -2036,6 +2125,13 @@ gdm_manager_start (GdmManager *manager)
{
g_debug ("GdmManager: GDM starting to manage displays");
+#ifdef WITH_PLYMOUTH
+ manager->priv->plymouth_is_running = plymouth_is_running ();
+
+ if (manager->priv->plymouth_is_running) {
+ plymouth_prepare_for_transition ();
+ }
+#endif
if (!manager->priv->xdmcp_enabled || manager->priv->show_local_greeter) {
gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->local_factory));
}
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 2dda553..2bab7be 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -64,10 +64,6 @@ struct GdmSimpleSlavePrivate
guint connection_attempts;
GdmServer *server;
-
-#ifdef WITH_PLYMOUTH
- guint plymouth_is_running : 1;
-#endif
};
enum {
@@ -79,83 +75,9 @@ static void gdm_simple_slave_init (GdmSimpleSlave *simple_sla
G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE)
-#ifdef WITH_PLYMOUTH
-static gboolean
-plymouth_is_running (void)
-{
- int status;
- gboolean res;
- GError *error;
-
- error = NULL;
- res = g_spawn_command_line_sync ("/bin/plymouth --ping",
- NULL, NULL, &status, &error);
- if (! res) {
- g_debug ("Could not ping plymouth: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
- return WIFEXITED (status) && WEXITSTATUS (status) == 0;
-}
-
-static void
-plymouth_prepare_for_transition (GdmSimpleSlave *slave)
-{
- gboolean res;
- GError *error;
-
- error = NULL;
- res = g_spawn_command_line_sync ("/bin/plymouth deactivate",
- NULL, NULL, NULL, &error);
- if (! res) {
- g_warning ("Could not deactivate plymouth: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-plymouth_quit_with_transition (GdmSimpleSlave *slave)
-{
- gboolean res;
- GError *error;
-
- error = NULL;
- res = g_spawn_command_line_sync ("/bin/plymouth quit --retain-splash",
- NULL, NULL, NULL, &error);
- if (! res) {
- g_warning ("Could not quit plymouth: %s", error->message);
- g_error_free (error);
- }
- slave->priv->plymouth_is_running = FALSE;
-}
-
-static void
-plymouth_quit_without_transition (GdmSimpleSlave *slave)
-{
- gboolean res;
- GError *error;
-
- error = NULL;
- res = g_spawn_command_line_sync ("/bin/plymouth quit",
- NULL, NULL, NULL, &error);
- if (! res) {
- g_warning ("Could not quit plymouth: %s", error->message);
- g_error_free (error);
- }
- slave->priv->plymouth_is_running = FALSE;
-}
-#endif
-
static void
setup_server (GdmSimpleSlave *slave)
{
-#ifdef WITH_PLYMOUTH
- /* Plymouth is waiting for the go-ahead to exit */
- if (slave->priv->plymouth_is_running) {
- plymouth_quit_with_transition (slave);
- }
-#endif
}
static gboolean
@@ -194,12 +116,6 @@ on_server_exited (GdmServer *server,
g_debug ("GdmSimpleSlave: server exited with code %d\n", exit_code);
gdm_slave_stop (GDM_SLAVE (slave));
-
-#ifdef WITH_PLYMOUTH
- if (slave->priv->plymouth_is_running) {
- plymouth_quit_without_transition (slave);
- }
-#endif
}
static void
@@ -212,12 +128,6 @@ on_server_died (GdmServer *server,
g_strsignal (signal_number));
gdm_slave_stop (GDM_SLAVE (slave));
-
-#ifdef WITH_PLYMOUTH
- if (slave->priv->plymouth_is_running) {
- plymouth_quit_without_transition (slave);
- }
-#endif
}
static gboolean
@@ -265,13 +175,6 @@ gdm_simple_slave_run (GdmSimpleSlave *slave)
G_CALLBACK (on_server_ready),
slave);
-#ifdef WITH_PLYMOUTH
- slave->priv->plymouth_is_running = plymouth_is_running ();
-
- if (slave->priv->plymouth_is_running) {
- plymouth_prepare_for_transition (slave);
- }
-#endif
res = gdm_server_start (slave->priv->server);
if (! res) {
g_warning (_("Could not start the X "
@@ -282,11 +185,6 @@ gdm_simple_slave_run (GdmSimpleSlave *slave)
"In the meantime this display will be "
"disabled. Please restart GDM when "
"the problem is corrected."));
-#ifdef WITH_PLYMOUTH
- if (slave->priv->plymouth_is_running) {
- plymouth_quit_without_transition (slave);
- }
-#endif
exit (1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]