pygobject r878 - in trunk: . gobject



Author: johan
Date: Sat Jul 26 22:37:39 2008
New Revision: 878
URL: http://svn.gnome.org/viewvc/pygobject?rev=878&view=rev

Log:
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.



Added:
   trunk/gobject/pygparamspec.h
Modified:
   trunk/ChangeLog
   trunk/gobject/Makefile.am
   trunk/gobject/gobjectmodule.c
   trunk/gobject/pygobject-private.h
   trunk/gobject/pygobject.c
   trunk/gobject/pygparamspec.c
   trunk/gobject/pygtype.c

Modified: trunk/gobject/Makefile.am
==============================================================================
--- trunk/gobject/Makefile.am	(original)
+++ trunk/gobject/Makefile.am	Sat Jul 26 22:37:39 2008
@@ -53,6 +53,7 @@
 	pygobject.h \
 	pygobject-private.h \
 	pygparamspec.c \
+	pygparamspec.h \
 	pygpointer.c \
 	pygtype.c
 _gobject_la_DEPENDENCIES = constants.py

Modified: trunk/gobject/gobjectmodule.c
==============================================================================
--- trunk/gobject/gobjectmodule.c	(original)
+++ trunk/gobject/gobjectmodule.c	Sat Jul 26 22:37:39 2008
@@ -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 @@
     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 @@
     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); 

Modified: trunk/gobject/pygobject-private.h
==============================================================================
--- trunk/gobject/pygobject-private.h	(original)
+++ trunk/gobject/pygobject-private.h	Sat Jul 26 22:37:39 2008
@@ -224,11 +224,6 @@
 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,

Modified: trunk/gobject/pygobject.c
==============================================================================
--- trunk/gobject/pygobject.c	(original)
+++ trunk/gobject/pygobject.c	Sat Jul 26 22:37:39 2008
@@ -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);

Modified: trunk/gobject/pygparamspec.c
==============================================================================
--- trunk/gobject/pygparamspec.c	(original)
+++ trunk/gobject/pygparamspec.c	Sat Jul 26 22:37:39 2008
@@ -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 @@
     return pyclass;
 }    
 
-PyObject *
+static PyObject *
 pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr)
 {
     GParamSpec *pspec;
@@ -397,3 +398,12 @@
     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);
+}

Added: trunk/gobject/pygparamspec.h
==============================================================================
--- (empty file)
+++ trunk/gobject/pygparamspec.h	Sat Jul 26 22:37:39 2008
@@ -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__ */

Modified: trunk/gobject/pygtype.c
==============================================================================
--- trunk/gobject/pygtype.c	(original)
+++ trunk/gobject/pygtype.c	Sat Jul 26 22:37:39 2008
@@ -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 ---------------------------- */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]