diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:40:27 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:40:31 +0900 |
commit | 8e71f268f3e991f68355f535b399cc8cb51fc95d (patch) | |
tree | 25009f8fe0fd468c5e5f8e32aa6e8ad03d914a3c /gi/pyglib.h | |
parent | 9e05f0b92b0d6cde13d729955af7b911f79ba833 (diff) | |
download | pygobject2-8e71f268f3e991f68355f535b399cc8cb51fc95d.tar.gz pygobject2-8e71f268f3e991f68355f535b399cc8cb51fc95d.tar.bz2 pygobject2-8e71f268f3e991f68355f535b399cc8cb51fc95d.zip |
Imported Upstream version 3.11.5
Change-Id: I5b5a3e71a92ea82cb98feb0c11f00c68804188dc
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/pyglib.h')
-rw-r--r-- | gi/pyglib.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gi/pyglib.h b/gi/pyglib.h new file mode 100644 index 0000000..9c7b22b --- /dev/null +++ b/gi/pyglib.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pyglib - Python bindings for GLib toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#ifndef __PYGLIB_H__ +#define __PYGLIB_H__ + +#include <Python.h> + +#include <glib.h> + +G_BEGIN_DECLS + +typedef void (*PyGLibThreadsEnabledFunc) (void); +typedef void (*PyGLibThreadBlockFunc) (void); + +#ifdef DISABLE_THREADING +# define pyglib_gil_state_ensure() PyGILState_LOCKED +# define pyglib_gil_state_release(state) state +#else +# define pyglib_gil_state_ensure PyGILState_Ensure +# define pyglib_gil_state_release PyGILState_Release +#endif + +gboolean pyglib_error_check(GError **error); +PyObject *pyglib_error_marshal (GError **error); +gboolean pyglib_gerror_exception_check(GError **error); +PyObject *pyglib_register_exception_for_domain(gchar *name, + gint error_domain); +GOptionGroup * pyglib_option_group_transfer_group(PyObject *self); + +/* Private: for gobject <-> glib interaction only. */ +PyObject* _pyglib_generic_ptr_richcompare(void* a, void *b, int op); +PyObject* _pyglib_generic_long_richcompare(long a, long b, int op); + + +#define PYGLIB_REGISTER_TYPE(d, type, name) \ + if (!type.tp_alloc) \ + type.tp_alloc = PyType_GenericAlloc; \ + if (!type.tp_new) \ + type.tp_new = PyType_GenericNew; \ + if (PyType_Ready(&type)) \ + return; \ + PyDict_SetItemString(d, name, (PyObject *)&type); + + +G_END_DECLS + +#endif /* __PYGLIB_H__ */ + |