pygobject r848 - in trunk: . glib



Author: johan
Date: Mon Jul 21 17:55:40 2008
New Revision: 848
URL: http://svn.gnome.org/viewvc/pygobject?rev=848&view=rev

Log:
2008-07-21  Johan Dahlin  <johan gnome org>

        * glib/glibmodule.c (pyglib_idle_add), (pyglib_timeout_add),
        (pyglib_timeout_add_seconds), (pyglib_io_add_watch):
        * glib/pyglib-private.h:
        * glib/pyglib.c (pyglib_destroy_notify), (_pyglib_handler_marshal):
        * glib/pyglib.h:
        * glib/pygsource.c (pyg_source_set_callback):
        Make pyglib_destroy_notify and pyglib_handler_marshal private.
        Add a few public prototypes.



Modified:
   trunk/ChangeLog
   trunk/glib/glibmodule.c
   trunk/glib/pyglib-private.h
   trunk/glib/pyglib.c
   trunk/glib/pyglib.h
   trunk/glib/pygsource.c

Modified: trunk/glib/glibmodule.c
==============================================================================
--- trunk/glib/glibmodule.c	(original)
+++ trunk/glib/glibmodule.c	Mon Jul 21 17:55:40 2008
@@ -120,8 +120,9 @@
     data = Py_BuildValue("(ON)", callback, cbargs);
     if (data == NULL)
 	return NULL;
-    handler_id = g_idle_add_full(priority, pyglib_handler_marshal, data,
-				 pyglib_destroy_notify);
+    handler_id = g_idle_add_full(priority,
+				 _pyglib_handler_marshal, data,
+				 _pyglib_destroy_notify);
     return PyInt_FromLong(handler_id);
 }
 
@@ -160,8 +161,8 @@
     if (data == NULL)
 	return NULL;
     handler_id = g_timeout_add_full(priority, interval,
-				    pyglib_handler_marshal, data,
-				    pyglib_destroy_notify);
+				    _pyglib_handler_marshal, data,
+				    _pyglib_destroy_notify);
     return PyInt_FromLong(handler_id);
 }
 
@@ -199,8 +200,8 @@
     if (data == NULL)
 	return NULL;
     handler_id = g_timeout_add_seconds_full(priority, interval,
-                                            pyglib_handler_marshal, data,
-                                            pyglib_destroy_notify);
+                                            _pyglib_handler_marshal, data,
+                                            _pyglib_destroy_notify);
     return PyInt_FromLong(handler_id);
 }
 
@@ -288,7 +289,7 @@
     iochannel = g_io_channel_unix_new(fd);
     handler_id = g_io_add_watch_full(iochannel, priority, condition,
 				     iowatch_marshal, data,
-				     (GDestroyNotify)pyglib_destroy_notify);
+				     (GDestroyNotify)_pyglib_destroy_notify);
     g_io_channel_unref(iochannel);
     
     return PyInt_FromLong(handler_id);

Modified: trunk/glib/pyglib-private.h
==============================================================================
--- trunk/glib/pyglib-private.h	(original)
+++ trunk/glib/pyglib-private.h	Mon Jul 21 17:55:40 2008
@@ -44,6 +44,9 @@
 	return; \
     PyDict_SetItemString(d, name, (PyObject *)&type);
 
+gboolean _pyglib_handler_marshal(gpointer user_data);
+void _pyglib_destroy_notify(gpointer user_data);
+
 G_END_DECLS
 
 #endif /* __PYGLIB_PRIVATE_H__ */

Modified: trunk/glib/pyglib.c
==============================================================================
--- trunk/glib/pyglib.c	(original)
+++ trunk/glib/pyglib.c	Mon Jul 21 17:55:40 2008
@@ -339,8 +339,30 @@
     return (PyObject *)self;
 }
 
+/**
+ * pyglib_destroy_notify:
+ * @user_data: a PyObject pointer.
+ *
+ * A function that can be used as a GDestroyNotify callback that will
+ * call Py_DECREF on the data.
+ */
+void
+pyglib_destroy_notify(gpointer user_data)
+{
+    PyObject *obj = (PyObject *)user_data;
+    PyGILState_STATE state;
+
+    g_return_if_fail (_PyGLib_API != NULL);
+    
+    state = pyglib_gil_state_ensure();
+    Py_DECREF(obj);
+    pyglib_gil_state_release(state);
+}
+
+/****** Private *****/
+
 gboolean
-pyglib_handler_marshal(gpointer user_data)
+_pyglib_handler_marshal(gpointer user_data)
 {
     PyObject *tuple, *ret;
     gboolean res;
@@ -366,22 +388,3 @@
     return res;
 }
 
-/**
- * pyglib_destroy_notify:
- * @user_data: a PyObject pointer.
- *
- * A function that can be used as a GDestroyNotify callback that will
- * call Py_DECREF on the data.
- */
-void
-pyglib_destroy_notify(gpointer user_data)
-{
-    PyObject *obj = (PyObject *)user_data;
-    PyGILState_STATE state;
-
-    g_return_if_fail (_PyGLib_API != NULL);
-    
-    state = pyglib_gil_state_ensure();
-    Py_DECREF(obj);
-    pyglib_gil_state_release(state);
-}

Modified: trunk/glib/pyglib.h
==============================================================================
--- trunk/glib/pyglib.h	(original)
+++ trunk/glib/pyglib.h	Mon Jul 21 17:55:40 2008
@@ -39,10 +39,10 @@
 gboolean pyglib_gerror_exception_check(GError **error);
 gboolean pyglib_threads_enabled(void);
 PyObject *pyglib_main_context_new(GMainContext *context);
-gboolean pyglib_handler_marshal(gpointer user_data);
-void pyglib_destroy_notify(gpointer user_data);
 void pyglib_set_thread_block_funcs(PyGLibThreadBlockFunc block_threads_func,
 				   PyGLibThreadBlockFunc unblock_threads_func);
+void pyglib_block_threads(void);
+void pyglib_unblock_threads(void);
 
 #define pyglib_begin_allow_threads		\
     G_STMT_START {                              \

Modified: trunk/glib/pygsource.c
==============================================================================
--- trunk/glib/pygsource.c	(original)
+++ trunk/glib/pygsource.c	Mon Jul 21 17:55:40 2008
@@ -30,7 +30,6 @@
 #include <Python.h>
 #include <pythread.h>
 #include <structmember.h> /* for PyMemberDef */
-
 #include "pyglib.h"
 #include "pyglib-private.h"
 #include "pygmaincontext.h"
@@ -162,8 +161,8 @@
 	return NULL;
 
     g_source_set_callback(self->source,
-			  pyglib_handler_marshal, data,
-			  pyglib_destroy_notify);
+			  _pyglib_handler_marshal, data,
+			  _pyglib_destroy_notify);
 
     Py_INCREF(Py_None);
     return Py_None;



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