From 8da25b61fb3203208b57e2a61c4772c6f17182d5 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Thu, 21 Dec 2017 14:59:25 +1300 Subject: [PATCH] Expose the automatic login user as a daemon property. This stops us having to iterate across each user to find which one is configured for automatic login. Due to D-Bus not having support for nullable types a client must treat the '/' value as automatic login not supported. [1] https://bugs.freedesktop.org/show_bug.cgi?id=27857 --- data/org.freedesktop.Accounts.xml | 10 ++++++++++ src/daemon.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/data/org.freedesktop.Accounts.xml b/data/org.freedesktop.Accounts.xml index 70e9586..0c330aa 100644 --- a/data/org.freedesktop.Accounts.xml +++ b/data/org.freedesktop.Accounts.xml @@ -243,5 +243,15 @@ + + + + + User to automatically log in as or '/' for none + + + + + diff --git a/src/daemon.c b/src/daemon.c index 3d588ac..f295555 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -551,6 +551,7 @@ static gboolean load_autologin (Daemon *daemon, static gboolean reload_autologin_timeout (Daemon *daemon) { + AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon); gboolean enabled; g_autofree gchar *name = NULL; g_autoptr(GError) error = NULL; @@ -574,6 +575,7 @@ reload_autologin_timeout (Daemon *daemon) if (enabled) { g_debug ("automatic login is enabled for '%s'", name); + accounts_accounts_set_automatic_login_user (accounts, user_get_object_path (user)); if (daemon->priv->autologin != user) { g_object_set (user, "automatic-login", TRUE, NULL); daemon->priv->autologin = g_object_ref (user); @@ -582,6 +584,7 @@ reload_autologin_timeout (Daemon *daemon) } else { g_debug ("automatic login is disabled"); + accounts_accounts_set_automatic_login_user (accounts, NULL); } return FALSE; -- 2.15.1