logind-button.h revision 65b5116220a8ebf8a260716152409aa05377aacc
3802a3d3d7af51ddff31943d5514382f01265770Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen#ifndef foologindbuttonhfoo
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek#define foologindbuttonhfoo
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek/***
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek This file is part of systemd.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek Copyright 2012 Lennart Poettering
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek (at your option) any later version.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek***/
48f69d8fb4d0cf34d578352572c96d86e13caa79Lennart Poettering
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmektypedef struct Button Button;
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmektypedef enum HandleButton {
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_IGNORE,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_POWEROFF,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_REBOOT,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_HALT,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_KEXEC,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_SUSPEND,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek HANDLE_HIBERNATE,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek _HANDLE_BUTTON_MAX,
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek _HANDLE_BUTTON_INVALID = -1
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek} HandleButton;
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek#include "list.h"
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek#include "util.h"
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek#include "logind.h"
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmekstruct Button {
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek Manager *manager;
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek char *name;
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poettering char *seat;
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek int fd;
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poettering bool lid_close_queued;
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poettering};
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poettering
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-SzmekButton* button_new(Manager *m, const char *name);
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poetteringvoid button_free(Button*b);
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poetteringint button_open(Button *b);
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poetteringint button_process(Button *b);
52d7c4dcf157745767931d49c9fa9c73448f746aLennart Poetteringint button_recheck(Button *b);
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmekint button_set_seat(Button *b, const char *sn);
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmekconst char* handle_button_to_string(HandleButton h);
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-SzmekHandleButton handle_button_from_string(const char *s);
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmekint config_parse_handle_button(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
cd6d5e1c7631d6e74cb04be279dee22e423e08b8Zbigniew Jędrzejewski-Szmek
f6f7a9848e27fbc1748aec9264e58a2aeaf736dbLennart Poettering#endif
f6f7a9848e27fbc1748aec9264e58a2aeaf736dbLennart Poettering