diff options
Diffstat (limited to '_dbus_bindings/mainloop.c')
-rw-r--r-- | _dbus_bindings/mainloop.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/_dbus_bindings/mainloop.c b/_dbus_bindings/mainloop.c index 3b56ade..1733410 100644 --- a/_dbus_bindings/mainloop.c +++ b/_dbus_bindings/mainloop.c @@ -1,6 +1,7 @@ /* Implementation of main-loop integration for dbus-python. * * Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/> + * Copyright (C) 2008 Huang Peng <phuang@redhat.com> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -131,6 +132,24 @@ dbus_py_set_up_connection(PyObject *conn, PyObject *mainloop) return FALSE; } +dbus_bool_t +dbus_py_set_up_server(PyObject *server, PyObject *mainloop) +{ + if (NativeMainLoop_Check(mainloop)) { + /* Native mainloops are allowed to do arbitrary strange things */ + NativeMainLoop *nml = (NativeMainLoop *)mainloop; + DBusServer *dbs = DBusPyServer_BorrowDBusServer(server); + + if (!dbs) { + return FALSE; + } + return (nml->set_up_server_cb)(dbs, nml->data); + } + PyErr_SetString(PyExc_TypeError, + "A dbus.mainloop.NativeMainLoop instance is required"); + return FALSE; +} + /* C API ============================================================ */ PyObject * |