user-accounts: Require logind for session tracking
As is already used in gnome-settings-daemon.
This commit is contained in:
parent
3fd861b3f0
commit
f6cc4a970a
2 changed files with 2 additions and 58 deletions
18
configure.ac
18
configure.ac
|
@ -63,17 +63,6 @@ CPPFLAGS=$savecppflags
|
|||
|
||||
AC_CHECK_LIB(m, floor)
|
||||
|
||||
AC_ARG_ENABLE([systemd],
|
||||
AS_HELP_STRING([--enable-systemd], [Use systemd]),
|
||||
[with_systemd=$enableval],
|
||||
[with_systemd=no])
|
||||
if test "$with_systemd" = "yes" ; then
|
||||
SYSTEMD=libsystemd-login
|
||||
AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd is available])
|
||||
else
|
||||
SYSTEMD=
|
||||
fi
|
||||
|
||||
# IBus support
|
||||
IBUS_REQUIRED_VERSION=1.4.99
|
||||
|
||||
|
@ -158,7 +147,7 @@ PKG_CHECK_MODULES(USER_ACCOUNTS_PANEL, $COMMON_MODULES
|
|||
gnome-desktop-3.0
|
||||
gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION
|
||||
pwquality
|
||||
$SYSTEMD)
|
||||
libsystemd-login)
|
||||
|
||||
GDESKTOP_PREFIX=`$PKG_CONFIG --variable prefix gsettings-desktop-schemas`
|
||||
AC_SUBST(GDESKTOP_PREFIX)
|
||||
|
@ -524,11 +513,6 @@ if test "x$with_libsocialweb" = "xyes"; then
|
|||
else
|
||||
AC_MSG_NOTICE([ Background panel Flickr support disabled])
|
||||
fi
|
||||
if test "x$with_systemd" = "xyes"; then
|
||||
AC_MSG_NOTICE([** systemd (Systemd session tracking)])
|
||||
else
|
||||
AC_MSG_NOTICE([ Using ConsoleKit for session tracking])
|
||||
fi
|
||||
if test "x$have_wacom" = "xyes"; then
|
||||
AC_MSG_NOTICE([** wacom (Wacom tablet panel)])
|
||||
else
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <systemd/sd-login.h>
|
||||
|
||||
#include "um-user.h"
|
||||
#include "um-account-type.h"
|
||||
|
@ -942,10 +943,6 @@ um_user_set_password (UmUser *user,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSTEMD
|
||||
|
||||
#include <systemd/sd-login.h>
|
||||
|
||||
gboolean
|
||||
um_user_is_logged_in (UmUser *user)
|
||||
{
|
||||
|
@ -956,43 +953,6 @@ um_user_is_logged_in (UmUser *user)
|
|||
return n_sessions > 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
gboolean
|
||||
um_user_is_logged_in (UmUser *user)
|
||||
{
|
||||
GVariant *result;
|
||||
GVariantIter *iter;
|
||||
gint n_sessions;
|
||||
GError *error = NULL;
|
||||
|
||||
result = g_dbus_connection_call_sync (user->bus,
|
||||
"org.freedesktop.ConsoleKit",
|
||||
"/org/freedesktop/ConsoleKit/Manager",
|
||||
"org.freedesktop.ConsoleKit.Manager",
|
||||
"GetSessionsForUnixUser",
|
||||
g_variant_new ("(u)", um_user_get_uid (user)),
|
||||
G_VARIANT_TYPE ("(ao)"),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
&error);
|
||||
if (!result) {
|
||||
g_warning ("GetSessionsForUnixUser failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_variant_get (result, "(ao)", &iter);
|
||||
n_sessions = g_variant_iter_n_children (iter);
|
||||
g_variant_iter_free (iter);
|
||||
g_variant_unref (result);
|
||||
|
||||
return n_sessions > 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
um_user_set_automatic_login (UmUser *user,
|
||||
gboolean enabled)
|
||||
|
|
Loading…
Add table
Reference in a new issue