Quit when requested from the menu
[ladish.git] / dbus / interface.h
blob548b82189c19817d17c2b25c3cb371be124f8903
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
6 * Copyright (C) 2008 Juuso Alasuutari <juuso.alasuutari@gmail.com>
8 **************************************************************************
9 * This file contains declaration of macros used to define D-Bus interfaces
10 **************************************************************************
12 * LADI Session Handler is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * LADI Session Handler is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
24 * or write to the Free Software Foundation, Inc.,
25 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28 #ifndef __LASH_DBUS_INTERFACE_H__
29 #define __LASH_DBUS_INTERFACE_H__
31 #include <stdbool.h>
33 #include "types.h"
34 #include "method.h"
35 #include "signal.h"
37 struct _interface
39 const char *name;
40 const interface_handler_t handler;
41 const method_t *methods;
42 const signal_t *signals;
45 bool
46 interface_default_handler(const interface_t *interface,
47 method_call_t *call);
49 #define INTERFACE_BEGIN(iface_var, iface_name) \
50 const struct _interface iface_var = \
51 { \
52 .name = iface_name,
54 #define INTERFACE_DEFAULT_HANDLER \
55 .handler = interface_default_handler,
57 #define INTERFACE_HANDLER(handler_func) \
58 .handler = handler_func,
60 #define INTERFACE_EXPOSE_METHODS \
61 .methods = methods_dtor,
63 #define INTERFACE_EXPOSE_SIGNALS \
64 .signals = signals_dtor,
66 #define INTERFACE_END \
69 #endif /* __LASH_DBUS_INTERFACE_H__ */