diff options
author | Johan Dahlin <johan@gnome.org> | 2008-07-26 22:37:39 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-26 22:37:39 +0000 |
commit | c907856672c1f14acd5e161a51cfc6cff890f592 (patch) | |
tree | 66525fc341868f106265d3dc7a2d5ddf6cc599db | |
parent | 6b93ae8cb09fec1c95b42f791858b93f0ca10a53 (diff) | |
download | pygobject-c907856672c1f14acd5e161a51cfc6cff890f592.tar.gz pygobject-c907856672c1f14acd5e161a51cfc6cff890f592.tar.xz pygobject-c907856672c1f14acd5e161a51cfc6cff890f592.zip |
Move paramspec registration to a separate file, add a header for the
2008-07-27 Johan Dahlin <johan@gnome.org>
* gobject/Makefile.am:
* gobject/gobjectmodule.c (init_gobject):
* gobject/pygobject-private.h:
* gobject/pygobject.c:
* gobject/pygparamspec.c (pygobject_paramspec_register_types):
* gobject/pygparamspec.h:
* gobject/pygtype.c:
Move paramspec registration to a separate file, add a header
for the internal API.
svn path=/trunk/; revision=878
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | gobject/Makefile.am | 1 | ||||
-rw-r--r-- | gobject/gobjectmodule.c | 10 | ||||
-rw-r--r-- | gobject/pygobject-private.h | 5 | ||||
-rw-r--r-- | gobject/pygobject.c | 6 | ||||
-rw-r--r-- | gobject/pygparamspec.c | 12 | ||||
-rw-r--r-- | gobject/pygparamspec.h | 31 | ||||
-rw-r--r-- | gobject/pygtype.c | 5 |
8 files changed, 69 insertions, 13 deletions
@@ -1,3 +1,15 @@ +2008-07-27 Johan Dahlin <johan@gnome.org> + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (init_gobject): + * gobject/pygobject-private.h: + * gobject/pygobject.c: + * gobject/pygparamspec.c (pygobject_paramspec_register_types): + * gobject/pygparamspec.h: + * gobject/pygtype.c: + Move paramspec registration to a separate file, add a header + for the internal API. + 2008-07-27 Paul Pogonyshev <pogonyshev@gmx.net> * gobject/pygtype.c (pyg_enum_get_value): Issue warning if 'obj' diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 539decb..75e62cd 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -53,6 +53,7 @@ _gobject_la_SOURCES = \ pygobject.h \ pygobject-private.h \ pygparamspec.c \ + pygparamspec.h \ pygpointer.c \ pygtype.c _gobject_la_DEPENDENCIES = constants.py diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index aa3e6c5..c08edf6 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -26,9 +26,10 @@ #include <gobject/gvaluecollector.h> #include <pyglib.h> +#include <pythread.h> #include "pygobject-private.h" -#include "pythread.h" #include "pyginterface.h" +#include "pygparamspec.h" #ifdef HAVE_FFI_H #include "ffi-marshaller.h" @@ -2566,15 +2567,9 @@ init_gobject(void) PyObject *descr; PyObject *warning; - PyGParamSpec_Type.ob_type = &PyType_Type; - if (PyType_Ready(&PyGParamSpec_Type)) - return; - m = Py_InitModule("gobject._gobject", pygobject_functions); d = PyModule_GetDict(m); - PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type); - g_type_init(); pyglib_init(); @@ -2619,6 +2614,7 @@ init_gobject(void) Py_DECREF(o); pygobject_interface_register_types(d); + pygobject_paramspec_register_types(d); REGISTER_GTYPE(d, PyGBoxed_Type, "GBoxed", G_TYPE_BOXED); REGISTER_GTYPE(d, PyGPointer_Type, "GPointer", G_TYPE_POINTER); diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h index 0db5550..fecb46e 100644 --- a/gobject/pygobject-private.h +++ b/gobject/pygobject-private.h @@ -224,11 +224,6 @@ extern PyObject * pyg_enum_add (PyObject * module, extern PyObject * pyg_enum_from_gtype (GType gtype, int value); -/* pygparamspec */ - -extern PyTypeObject PyGParamSpec_Type; -PyObject * pyg_param_spec_new (GParamSpec *pspec); - /* pygtype.c */ extern GHashTable *custom_type_registration; void pyg_type_register_custom_callback(const gchar *type_name, diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 5cc9ae1..246633b 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -20,9 +20,15 @@ * USA */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <pyglib.h> #include "pygobject-private.h" #include "pyginterface.h" +#include "pygparamspec.h" + static void pygobject_dealloc(PyGObject *self); static int pygobject_traverse(PyGObject *self, visitproc visit, void *arg); diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c index 2c0e001..8cc3b3e 100644 --- a/gobject/pygparamspec.c +++ b/gobject/pygparamspec.c @@ -26,6 +26,7 @@ #endif #include "pygobject-private.h" +#include "pygparamspec.h" static int pyg_param_spec_compare(PyGParamSpec *self, PyGParamSpec *v) @@ -99,7 +100,7 @@ pygflags_from_pspec(GParamSpec *pspec) return pyclass; } -PyObject * +static PyObject * pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) { GParamSpec *pspec; @@ -397,3 +398,12 @@ pyg_param_spec_new(GParamSpec *pspec) self->pspec = g_param_spec_ref(pspec); return (PyObject *)self; } + +void +pygobject_paramspec_register_types(PyObject *d) +{ + PyGParamSpec_Type.ob_type = &PyType_Type; + if (PyType_Ready(&PyGParamSpec_Type)) + return; + PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type); +} diff --git a/gobject/pygparamspec.h b/gobject/pygparamspec.h new file mode 100644 index 0000000..1a33618 --- /dev/null +++ b/gobject/pygparamspec.h @@ -0,0 +1,31 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * pyginterface.c: wrapper for the gobject library. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef __PYGOBJECT_PARAMSPEC_H__ +#define __PYGOBJECT_PARAMSPEC_H__ + +extern PyTypeObject PyGParamSpec_Type; +PyObject * pyg_param_spec_new (GParamSpec *pspec); + +void pygobject_paramspec_register_types(PyObject *d); + +#endif /* __PYGOBJECT_PARAMSPEC_H__ */ diff --git a/gobject/pygtype.c b/gobject/pygtype.c index b4d029b..e77aee7 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -20,9 +20,14 @@ * USA */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <pyglib.h> #include "pygobject-private.h" +#include "pygparamspec.h" /* -------------- __gtype__ objects ---------------------------- */ |