summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon McVittie <smcv@celebrin.pseudorandom.co.uk>2006-09-26 18:53:55 +0100
committerSimon McVittie <smcv@celebrin.pseudorandom.co.uk>2006-09-26 18:53:55 +0100
commit97900c452754b832d0817edc03f3e00fe888d24a (patch)
tree4a2ea6529e7f1250101b031e7437798cd233934c /include
parent0a189b73baa8e7b1d1d7743534b635fabe1aaf80 (diff)
Add a C reimplementation of the formerly-Pyrex bits of dbus-python.
Diffstat (limited to 'include')
-rw-r--r--include/dbus_bindings.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/dbus_bindings.h b/include/dbus_bindings.h
new file mode 100644
index 0000000..8b11585
--- /dev/null
+++ b/include/dbus_bindings.h
@@ -0,0 +1,64 @@
+/* C API for _dbus_bindings, used by _dbus_glib_bindings.
+ *
+ * Copyright (C) 2006 Collabora Ltd.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef DBUS_BINDINGS_H
+#define DBUS_BINDINGS_H
+
+#define DBUS_API_SUBJECT_TO_CHANGE 1
+#include <dbus/dbus.h>
+
+DBUS_BEGIN_DECLS
+
+#ifdef INSIDE_DBUS_BINDINGS
+
+static DBusConnection *Connection_BorrowDBusConnection (PyObject *);
+
+#else
+
+static void **dbus_bindings_API;
+#define Connection_BorrowDBusConnection \
+ (*(DBusConnection *(*)(PyObject *))dbus_bindings_API[0])
+static int
+import_dbus_bindings(void)
+{
+ PyObject *module = PyImport_ImportModule ("_dbus_bindings");
+
+ if (module != NULL)
+ {
+ PyObject *c_api = PyObject_GetAttrString (module, "_C_API");
+ if (c_api == NULL) return -1;
+ if (PyCObject_Check (c_api))
+ {
+ dbus_bindings_API = (void **)PyCObject_AsVoidPtr (c_api);
+ }
+ Py_DECREF (c_api);
+ }
+ return 0;
+}
+
+#endif
+
+DBUS_END_DECLS
+
+#endif