Imported Upstream version 3.21.91
[platform/upstream/python-gobject.git] / gi / pygobject-object.h
1 #ifndef _PYGOBJECT_OBJECT_H_
2 #define _PYGOBJECT_OBJECT_H_
3
4 #include <Python.h>
5 #include <glib-object.h>
6 #include "pyglib-python-compat.h"
7 #include "pygobject-internal.h"
8
9 /* Data that belongs to the GObject instance, not the Python wrapper */
10 struct _PyGObjectData {
11     PyTypeObject *type; /* wrapper type for this instance */
12     GSList *closures;
13 };
14
15 extern GType PY_TYPE_OBJECT;
16 extern GQuark pygobject_instance_data_key;
17 extern GQuark pygobject_custom_key;
18 extern GQuark pygobject_wrapper_key;
19 extern GQuark pygobject_class_key;
20 extern GQuark pygobject_class_init_key;
21
22 extern PyTypeObject PyGObjectWeakRef_Type;
23 extern PyTypeObject PyGPropsIter_Type;
24 extern PyTypeObject PyGPropsDescr_Type;
25 extern PyTypeObject PyGProps_Type;
26 extern PyTypeObject PyGObject_Type;
27 extern PyTypeObject *PyGObject_MetaType;
28
29 static inline PyGObjectData *
30 pyg_object_peek_inst_data(GObject *obj)
31 {
32     return ((PyGObjectData *)
33             g_object_get_qdata(obj, pygobject_instance_data_key));
34 }
35
36 gboolean      pygobject_prepare_construct_properties  (GObjectClass *class,
37                                                        PyObject *kwargs,
38                                                        guint *n_params,
39                                                        GParameter **params);
40 void          pygobject_register_class   (PyObject *dict,
41                                           const gchar *type_name,
42                                           GType gtype, PyTypeObject *type,
43                                           PyObject *bases);
44 void          pygobject_register_wrapper (PyObject *self);
45 PyObject *    pygobject_new              (GObject *obj);
46 PyObject *    pygobject_new_full         (GObject *obj, gboolean steal, gpointer g_class);
47 void          pygobject_sink             (GObject *obj);
48 PyTypeObject *pygobject_lookup_class     (GType gtype);
49 void          pygobject_watch_closure    (PyObject *self, GClosure *closure);
50 void          pygobject_object_register_types(PyObject *d);
51 void          pygobject_ref_float(PyGObject *self);
52 void          pygobject_ref_sink(PyGObject *self);
53
54 GClosure *    gclosure_from_pyfunc(PyGObject *object, PyObject *func);
55
56 #endif /*_PYGOBJECT_OBJECT_H_*/