summaryrefslogtreecommitdiff
path: root/src/plymouth.c
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2011-07-16 17:34:25 +1000
committerRobert Ancell <robert.ancell@canonical.com>2011-07-16 17:34:25 +1000
commit4451f024416b1a29c7466447715c1dd0c47bfe81 (patch)
tree77691550a05b319aeb2436ff0c49569217213787 /src/plymouth.c
parentceed298ba93f1798f4c38e80163dbdaff0de7e5a (diff)
downloadlightdm-git-4451f024416b1a29c7466447715c1dd0c47bfe81.tar.gz
Reimplement Plymouth support
Diffstat (limited to 'src/plymouth.c')
-rw-r--r--src/plymouth.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/plymouth.c b/src/plymouth.c
index cd0f4088..43204e9c 100644
--- a/src/plymouth.c
+++ b/src/plymouth.c
@@ -13,6 +13,13 @@
#include "plymouth.h"
+static gboolean have_pinged = FALSE;
+static gboolean have_checked_active_vt = FALSE;
+
+static gboolean is_running = FALSE;
+static gboolean is_active = FALSE;
+static gboolean has_active_vt = FALSE;
+
static gboolean
plymouth_run_command (const gchar *command, gint *exit_status)
{
@@ -41,26 +48,48 @@ plymouth_command_returns_true (gchar *command)
}
gboolean
-plymouth_is_running (void)
+plymouth_get_is_running (void)
+{
+ if (!have_pinged)
+ {
+ have_pinged = TRUE;
+ is_running = plymouth_command_returns_true ("--ping");
+ is_active = is_running;
+ }
+
+ return is_running;
+}
+
+gboolean
+plymouth_get_is_active (void)
{
- return plymouth_command_returns_true ("--ping");
+ return plymouth_get_is_running () && is_active;
}
gboolean
plymouth_has_active_vt (void)
{
- return plymouth_command_returns_true ("--has-active-vt");
+ if (!have_checked_active_vt)
+ {
+ have_checked_active_vt = TRUE;
+ has_active_vt = plymouth_command_returns_true ("--has-active-vt");
+ }
+
+ return has_active_vt;
}
void
plymouth_deactivate (void)
{
+ is_active = FALSE;
plymouth_run_command ("deactivate", NULL);
}
void
plymouth_quit (gboolean retain_splash)
{
+ have_pinged = TRUE;
+ is_running = FALSE;
if (retain_splash)
plymouth_run_command ("quit --retain-splash", NULL);
else