Blob: logind.h

Blob id: 3cdb0333888a353f24ba4a2e5e0127e760dbe83f

Size: 799 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *
 *  Enable functionality only when the user is active
 *
 *  Copyright (C) 2007-2010  Marcel Holtmann <marcel@holtmann.org>
 *
 *
 */

typedef int (*logind_init_cb)(gboolean at_register);
typedef void (*logind_exit_cb)(gboolean at_unregister);

#ifdef SYSTEMD

int logind_register(logind_init_cb init_cb, logind_exit_cb exit_cb);
void logind_unregister(logind_init_cb init_cb, logind_exit_cb exit_cb);
int logind_set(gboolean enabled);

#else

static inline int logind_register(logind_init_cb init_cb,
					logind_exit_cb exit_cb)
{
	return init_cb(TRUE);
}
static inline void logind_unregister(logind_init_cb init_cb,
					logind_exit_cb exit_cb)
{
	return exit_cb(TRUE);
}
static inline int logind_set(gboolean enabled)
{
	return 0;
}

#endif