chiark / gitweb /
logind: add 'lock' as possible choice for handling hw keys
[elogind.git] / src / login / logind-button.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef foologindbuttonhfoo
4 #define foologindbuttonhfoo
5
6 /***
7   This file is part of systemd.
8
9   Copyright 2012 Lennart Poettering
10
11   systemd is free software; you can redistribute it and/or modify it
12   under the terms of the GNU Lesser General Public License as published by
13   the Free Software Foundation; either version 2.1 of the License, or
14   (at your option) any later version.
15
16   systemd is distributed in the hope that it will be useful, but
17   WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   Lesser General Public License for more details.
20
21   You should have received a copy of the GNU Lesser General Public License
22   along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ***/
24
25 typedef struct Button Button;
26
27 typedef enum HandleButton {
28         HANDLE_IGNORE,
29         HANDLE_POWEROFF,
30         HANDLE_REBOOT,
31         HANDLE_HALT,
32         HANDLE_KEXEC,
33         HANDLE_SUSPEND,
34         HANDLE_HIBERNATE,
35         HANDLE_HYBRID_SLEEP,
36         HANDLE_LOCK,
37         _HANDLE_BUTTON_MAX,
38         _HANDLE_BUTTON_INVALID = -1
39 } HandleButton;
40
41 #include "list.h"
42 #include "util.h"
43 #include "logind.h"
44
45 struct Button {
46         Manager *manager;
47
48         char *name;
49         char *seat;
50         int fd;
51
52         bool lid_close_queued;
53 };
54
55 Button* button_new(Manager *m, const char *name);
56 void button_free(Button*b);
57 int button_open(Button *b);
58 int button_process(Button *b);
59 int button_recheck(Button *b);
60 int button_set_seat(Button *b, const char *sn);
61
62 const char* handle_button_to_string(HandleButton h);
63 HandleButton handle_button_from_string(const char *s);
64
65 int config_parse_handle_button(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
66
67 #endif