2
* Copyright (C) 2010-2011 Robert Ancell.
3
* Author: Robert Ancell <robert.ancell@canonical.com>
5
* This program is free software: you can redistribute it and/or modify it under
6
* the terms of the GNU General Public License as published by the Free Software
7
* Foundation, either version 3 of the License, or (at your option) any later
8
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
17
static gboolean have_pinged = FALSE;
18
static gboolean have_checked_active_vt = FALSE;
20
static gboolean is_running = FALSE;
21
static gboolean is_active = FALSE;
22
static gboolean has_active_vt = FALSE;
25
plymouth_run_command (const gchar *command, gint *exit_status)
31
command_line = g_strdup_printf ("plymouth %s", command);
32
result = g_spawn_command_line_sync (command_line, NULL, NULL, exit_status, &error);
35
g_debug ("Could not run %s: %s", command_line, error->message);
36
g_clear_error (&error);
38
g_free (command_line);
44
plymouth_command_returns_true (gchar *command)
47
if (!plymouth_run_command (command, &exit_status))
49
return WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0;
53
plymouth_get_is_running (void)
58
is_running = plymouth_command_returns_true ("--ping");
59
is_active = is_running;
66
plymouth_get_is_active (void)
68
return plymouth_get_is_running () && is_active;
72
plymouth_has_active_vt (void)
74
if (!have_checked_active_vt)
76
have_checked_active_vt = TRUE;
77
has_active_vt = plymouth_command_returns_true ("--has-active-vt");
84
plymouth_deactivate (void)
87
plymouth_run_command ("deactivate", NULL);
91
plymouth_quit (gboolean retain_splash)
96
plymouth_run_command ("quit --retain-splash", NULL);
98
plymouth_run_command ("quit", NULL);