summaryrefslogtreecommitdiff
path: root/src/login1.c
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2014-05-14 14:27:06 -0400
committerMichael Terry <michael.terry@canonical.com>2014-05-14 14:27:06 -0400
commitab5126f1424828d96190b336cd91976f8a8489f2 (patch)
tree72377e2ad4972dd1877b45192e6939c7a054595c /src/login1.c
parent564c66a68df282423b643d386a32e2cfcb2a0b56 (diff)
downloadlightdm-ab5126f1424828d96190b336cd91976f8a8489f2.tar.gz
DBus-activate logind
Diffstat (limited to 'src/login1.c')
-rw-r--r--src/login1.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/login1.c b/src/login1.c
index 7f858d63..60eec457 100644
--- a/src/login1.c
+++ b/src/login1.c
@@ -14,10 +14,53 @@
#include "login1.h"
+static gboolean
+start_login1 (void)
+{
+ GDBusConnection *bus;
+ GVariant *result;
+ guint32 success;
+
+ bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+ if (!bus)
+ return FALSE;
+
+ result = g_dbus_connection_call_sync (bus,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "StartServiceByName",
+ g_variant_new ("(su)",
+ "org.freedesktop.login1",
+ 0),
+ G_VARIANT_TYPE ("(u)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL);
+ g_object_unref (bus);
+ if (!result)
+ return FALSE;
+
+ g_variant_get (result, "(u)", &success);
+ g_variant_unref (result);
+
+ return success == 1 || success == 2; // started or already existed
+}
+
gboolean
login1_is_running (void)
{
- return access ("/run/systemd/seats/", F_OK) >= 0;
+ static gboolean have_checked = FALSE;
+ static gboolean is_running = FALSE;
+
+ if (!have_checked)
+ {
+ have_checked = TRUE;
+ is_running = start_login1();
+ }
+
+ return is_running;
}
gchar *