3caf6f38d31d447eb68cd1c20e0158c91e6e2588
[platform/upstream/python-gobject.git] / gi / pygi.h
1 /* -*- Mode: C; c-basic-offset: 4 -*-
2  * vim: tabstop=4 shiftwidth=4 expandtab
3  *
4  * Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef __PYGI_H__
21 #define __PYGI_H__
22
23 #ifdef HAVE_CONFIG_H
24 #  include <config.h>
25 #endif
26
27 #include <pygobject-private.h>
28
29 #include <girepository.h>
30 #include "pygi-cache.h"
31
32 extern PyObject *PyGIDeprecationWarning;
33 extern PyObject *_PyGIDefaultArgPlaceholder;
34
35 typedef struct {
36     PyObject_HEAD
37     GIRepository *repository;
38 } PyGIRepository;
39
40 typedef struct {
41     PyObject_HEAD
42     GIBaseInfo *info;
43     PyObject *inst_weakreflist;
44     PyGICallableCache *cache;
45 } PyGIBaseInfo;
46
47 typedef struct {
48     PyGIBaseInfo base;
49
50     /* Reference the unbound version of this struct.
51      * We use this for the actual call to invoke because it manages the cache.
52      */
53     struct PyGICallableInfo *py_unbound_info;
54
55     /* Holds bound argument for instance, class, and vfunc methods. */
56     PyObject *py_bound_arg;
57
58 } PyGICallableInfo;
59
60 typedef struct {
61     PyGPointer base;
62     gboolean free_on_dealloc;
63 } PyGIStruct;
64
65 typedef struct {
66     PyGBoxed base;
67     gboolean slice_allocated;
68     gsize size;
69 } PyGIBoxed;
70
71 typedef struct {
72     PyObject_HEAD
73     GCallback callback;
74     GIFunctionInfo *info;
75     gpointer user_data;
76     GIScopeType scope;
77     GDestroyNotify destroy_notify_func;
78     PyGICCallbackCache *cache;
79 } PyGICCallback;
80
81
82 #endif /* __PYGI_H__ */