Put AUTHORS in the right order
[dbus-python-phuang.git] / include / dbus_bindings.h
blob8b115854e0d0c70ffcbb80100f3c6bec16781dc5
1 /* C API for _dbus_bindings, used by _dbus_glib_bindings.
3 * Copyright (C) 2006 Collabora Ltd.
5 * Licensed under the Academic Free License version 2.1
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef DBUS_BINDINGS_H
26 #define DBUS_BINDINGS_H
28 #define DBUS_API_SUBJECT_TO_CHANGE 1
29 #include <dbus/dbus.h>
31 DBUS_BEGIN_DECLS
33 #ifdef INSIDE_DBUS_BINDINGS
35 static DBusConnection *Connection_BorrowDBusConnection (PyObject *);
37 #else
39 static void **dbus_bindings_API;
40 #define Connection_BorrowDBusConnection \
41 (*(DBusConnection *(*)(PyObject *))dbus_bindings_API[0])
42 static int
43 import_dbus_bindings(void)
45 PyObject *module = PyImport_ImportModule ("_dbus_bindings");
47 if (module != NULL)
49 PyObject *c_api = PyObject_GetAttrString (module, "_C_API");
50 if (c_api == NULL) return -1;
51 if (PyCObject_Check (c_api))
53 dbus_bindings_API = (void **)PyCObject_AsVoidPtr (c_api);
55 Py_DECREF (c_api);
57 return 0;
60 #endif
62 DBUS_END_DECLS
64 #endif