diff options
| author | Johan Dahlin <johan@gnome.org> | 2008-07-27 09:00:06 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-27 09:00:06 +0000 |
| commit | 28cc14391b52dcbef2e148dcc985b2803623234d (patch) | |
| tree | b32b6503d4908b8742d74b8040954d273011e592 /gobject | |
| parent | 6fafcbb5c9492c0f1c9022389107b7955d9b9318 (diff) | |
| download | pygobject-28cc14391b52dcbef2e148dcc985b2803623234d.tar.gz pygobject-28cc14391b52dcbef2e148dcc985b2803623234d.tar.xz pygobject-28cc14391b52dcbef2e148dcc985b2803623234d.zip | |
Split out quark and type registration to the respective implementation
2008-07-27 Johan Dahlin <johan@gnome.org>
* gobject/Makefile.am:
* gobject/gobjectmodule.c (init_gobject):
* gobject/pygboxed.c (pygobject_boxed_register_types):
* gobject/pygboxed.h:
* gobject/pygenum.c (pygobject_enum_register_types):
* gobject/pygenum.h:
* gobject/pygflags.c (pygobject_flags_register_types):
* gobject/pygflags.h:
* gobject/pygpointer.c (pygobject_pointer_register_types):
* gobject/pygpointer.h:
Split out quark and type registration to the respective
implementation source files, add headers.
svn path=/trunk/; revision=880
Diffstat (limited to 'gobject')
| -rw-r--r-- | gobject/Makefile.am | 4 | ||||
| -rw-r--r-- | gobject/gobjectmodule.c | 28 | ||||
| -rw-r--r-- | gobject/pygboxed.c | 13 | ||||
| -rw-r--r-- | gobject/pygboxed.h | 27 | ||||
| -rw-r--r-- | gobject/pygenum.c | 11 | ||||
| -rw-r--r-- | gobject/pygenum.h | 27 | ||||
| -rw-r--r-- | gobject/pygflags.c | 12 | ||||
| -rw-r--r-- | gobject/pygflags.h | 27 | ||||
| -rw-r--r-- | gobject/pygpointer.c | 12 | ||||
| -rw-r--r-- | gobject/pygpointer.h | 27 |
10 files changed, 169 insertions, 19 deletions
diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 3baa8f3..e7c5291 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -45,8 +45,11 @@ _gobject_la_LIBADD = \ _gobject_la_SOURCES = \ gobjectmodule.c \ pygboxed.c \ + pygboxed.h \ pygenum.c \ + pygenum.h \ pygflags.c \ + pygflags.h \ pyginterface.c \ pyginterface.h \ pygobject.c \ @@ -55,6 +58,7 @@ _gobject_la_SOURCES = \ pygparamspec.c \ pygparamspec.h \ pygpointer.c \ + pygpointer.h \ pygtype.c \ pygtype.h _gobject_la_DEPENDENCIES = constants.py diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 8cd6d77..0867c56 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -28,8 +28,12 @@ #include <pyglib.h> #include <pythread.h> #include "pygobject-private.h" +#include "pygboxed.h" +#include "pygenum.h" +#include "pygflags.h" #include "pyginterface.h" #include "pygparamspec.h" +#include "pygpointer.h" #include "pygtype.h" #ifdef HAVE_FFI_H @@ -43,12 +47,6 @@ static PyObject *_pyg_signal_accumulator_true_handled_func; static GHashTable *log_handlers = NULL; static gboolean log_handlers_disabled = FALSE; -GQuark pygboxed_type_key; -GQuark pygboxed_marshal_key; -GQuark pygenum_class_key; -GQuark pygflags_class_key; -GQuark pygpointer_class_key; - static void pyg_flags_add_constants(PyObject *module, GType flags_type, const gchar *strip_prefix); @@ -2553,6 +2551,7 @@ pygobject_register_warnings(PyObject *d) add_warning_redirection("GThread", warning); } + DL_EXPORT(void) init_gobject(void) { @@ -2564,12 +2563,6 @@ init_gobject(void) g_type_init(); pyglib_init(); - pygboxed_type_key = g_quark_from_static_string("PyGBoxed::class"); - pygboxed_marshal_key = g_quark_from_static_string("PyGBoxed::marshal"); - pygenum_class_key = g_quark_from_static_string("PyGEnum::class"); - pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); - pygpointer_class_key = g_quark_from_static_string("PyGPointer::class"); - pygobject_register_api(d); pygobject_register_constants(m); pygobject_register_features(d); @@ -2579,14 +2572,11 @@ init_gobject(void) pygobject_object_register_types(d); pygobject_interface_register_types(d); pygobject_paramspec_register_types(d); + pygobject_boxed_register_types(d); + pygobject_pointer_register_types(d); + pygobject_enum_register_types(d); + pygobject_flags_register_types(d); - PYGOBJECT_REGISTER_GTYPE(d, PyGBoxed_Type, "GBoxed", G_TYPE_BOXED); - PYGOBJECT_REGISTER_GTYPE(d, PyGPointer_Type, "GPointer", G_TYPE_POINTER); - PyGEnum_Type.tp_base = &PyInt_Type; - PYGOBJECT_REGISTER_GTYPE(d, PyGEnum_Type, "GEnum", G_TYPE_ENUM); - PyGFlags_Type.tp_base = &PyInt_Type; - PYGOBJECT_REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); - /* signal registration recognizes this special accumulator 'constant' */ _pyg_signal_accumulator_true_handled_func = \ PyDict_GetItemString(d, "signal_accumulator_true_handled"); diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c index 01217bb..d304fc4 100644 --- a/gobject/pygboxed.c +++ b/gobject/pygboxed.c @@ -26,6 +26,10 @@ #include <pyglib.h> #include "pygobject-private.h" +#include "pygboxed.h" + +GQuark pygboxed_type_key; +GQuark pygboxed_marshal_key; static void pyg_boxed_dealloc(PyGBoxed *self) @@ -243,3 +247,12 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, return (PyObject *)self; } +void +pygobject_boxed_register_types(PyObject *d) +{ + pygboxed_type_key = g_quark_from_static_string("PyGBoxed::class"); + pygboxed_marshal_key = g_quark_from_static_string("PyGBoxed::marshal"); + + PYGOBJECT_REGISTER_GTYPE(d, PyGBoxed_Type, "GBoxed", G_TYPE_BOXED); + +} diff --git a/gobject/pygboxed.h b/gobject/pygboxed.h new file mode 100644 index 0000000..e53bb8b --- /dev/null +++ b/gobject/pygboxed.h @@ -0,0 +1,27 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef __PYGOBJECT_BOXED_H__ +#define __PYGOBJECT_BOXED_H__ + +void pygobject_boxed_register_types(PyObject *d); + +#endif /* __PYGOBJECT_BOXED_H__ */ diff --git a/gobject/pygenum.c b/gobject/pygenum.c index 28bdf70..9280c87 100644 --- a/gobject/pygenum.c +++ b/gobject/pygenum.c @@ -28,6 +28,8 @@ #include <pyglib.h> #include "pygobject-private.h" +GQuark pygenum_class_key; + static PyObject * pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) { @@ -360,3 +362,12 @@ PyTypeObject PyGEnum_Type = { pyg_enum_new, /* tp_new */ }; +void +pygobject_enum_register_types(PyObject *d) +{ + pygenum_class_key = g_quark_from_static_string("PyGEnum::class"); + + PyGEnum_Type.tp_base = &PyInt_Type; + PYGOBJECT_REGISTER_GTYPE(d, PyGEnum_Type, "GEnum", G_TYPE_ENUM); + +} diff --git a/gobject/pygenum.h b/gobject/pygenum.h new file mode 100644 index 0000000..e03ff20 --- /dev/null +++ b/gobject/pygenum.h @@ -0,0 +1,27 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef __PYGOBJECT_ENUM_H__ +#define __PYGOBJECT_ENUM_H__ + +void pygobject_enum_register_types(PyObject *d); + +#endif /* __PYGOBJECT_ENUM_H__ */ diff --git a/gobject/pygflags.c b/gobject/pygflags.c index 2ce2174..57f1ccb 100644 --- a/gobject/pygflags.c +++ b/gobject/pygflags.c @@ -27,6 +27,9 @@ #include <pyglib.h> #include "pygobject-private.h" +#include "pygflags.h" + +GQuark pygflags_class_key; #define GET_INT_VALUE(x) (((PyIntObject*)x)->ob_ival) @@ -497,3 +500,12 @@ PyTypeObject PyGFlags_Type = { 0, /* tp_alloc */ pyg_flags_new, /* tp_new */ }; + +void +pygobject_flags_register_types(PyObject *d) +{ + pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); + + PyGFlags_Type.tp_base = &PyInt_Type; + PYGOBJECT_REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); +} diff --git a/gobject/pygflags.h b/gobject/pygflags.h new file mode 100644 index 0000000..10cdb8b --- /dev/null +++ b/gobject/pygflags.h @@ -0,0 +1,27 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef __PYGOBJECT_FLAGS_H__ +#define __PYGOBJECT_FLAGS_H__ + +void pygobject_flags_register_types(PyObject *d); + +#endif /* __PYGOBJECT_FLAGS_H__ */ diff --git a/gobject/pygpointer.c b/gobject/pygpointer.c index 6a7d9e2..1850d7b 100644 --- a/gobject/pygpointer.c +++ b/gobject/pygpointer.c @@ -26,6 +26,9 @@ #include <pyglib.h> #include "pygobject-private.h" +#include "pygpointer.h" + +GQuark pygpointer_class_key; static void pyg_pointer_dealloc(PyGPointer *self) @@ -209,3 +212,12 @@ pyg_pointer_new(GType pointer_type, gpointer pointer) return (PyObject *)self; } + +void +pygobject_pointer_register_types(PyObject *d) +{ + pygpointer_class_key = g_quark_from_static_string("PyGPointer::class"); + + PYGOBJECT_REGISTER_GTYPE(d, PyGPointer_Type, "GPointer", G_TYPE_POINTER); + +} diff --git a/gobject/pygpointer.h b/gobject/pygpointer.h new file mode 100644 index 0000000..5e16873 --- /dev/null +++ b/gobject/pygpointer.h @@ -0,0 +1,27 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifndef __PYGOBJECT_POINTER_H__ +#define __PYGOBJECT_POINTER_H__ + +void pygobject_pointer_register_types(PyObject *d); + +#endif /* __PYGOBJECT_POINTER_H__ */ |
