summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-21 17:55:40 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-21 17:55:40 +0000
commitd23d14addd53f7457684146aaade44cec2cf4643 (patch)
tree86eb4820b1b3a896958d636ea04abcd39bbce061
parent6594b6f890693c19dfeed20889b0db4c6217c31f (diff)
downloadpygobject-d23d14addd53f7457684146aaade44cec2cf4643.tar.gz
pygobject-d23d14addd53f7457684146aaade44cec2cf4643.tar.xz
pygobject-d23d14addd53f7457684146aaade44cec2cf4643.zip
Make pyglib_destroy_notify and pyglib_handler_marshal private. Add a few
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. svn path=/trunk/; revision=848
-rw-r--r--ChangeLog11
-rw-r--r--glib/glibmodule.c15
-rw-r--r--glib/pyglib-private.h3
-rw-r--r--glib/pyglib.c43
-rw-r--r--glib/pyglib.h4
-rw-r--r--glib/pygsource.c5
6 files changed, 49 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index cd03916..f4522ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
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.
+
+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),
(pyglib_source_remove), (pyglib_child_watch_add),
(pyglib_markup_escape_text), (pyglib_get_current_time),
diff --git a/glib/glibmodule.c b/glib/glibmodule.c
index 42de215..830da13 100644
--- a/glib/glibmodule.c
+++ b/glib/glibmodule.c
@@ -120,8 +120,9 @@ pyglib_idle_add(PyObject *self, PyObject *args, PyObject *kwargs)
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 @@ pyglib_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs)
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 @@ pyglib_timeout_add_seconds(PyObject *self, PyObject *args, PyObject *kwargs)
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 @@ pyglib_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs)
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);
diff --git a/glib/pyglib-private.h b/glib/pyglib-private.h
index 4609e90..be38be4 100644
--- a/glib/pyglib-private.h
+++ b/glib/pyglib-private.h
@@ -44,6 +44,9 @@ struct _PyGLib_Functions {
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__ */
diff --git a/glib/pyglib.c b/glib/pyglib.c
index a6d3c26..ee163b8 100644
--- a/glib/pyglib.c
+++ b/glib/pyglib.c
@@ -339,8 +339,30 @@ pyglib_main_context_new(GMainContext *context)
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 @@ pyglib_handler_marshal(gpointer user_data)
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);
-}
diff --git a/glib/pyglib.h b/glib/pyglib.h
index 21da4d8..4b28089 100644
--- a/glib/pyglib.h
+++ b/glib/pyglib.h
@@ -39,10 +39,10 @@ gboolean pyglib_error_check(GError **error);
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 { \
diff --git a/glib/pygsource.c b/glib/pygsource.c
index 1374c5d..a7df221 100644
--- a/glib/pygsource.c
+++ b/glib/pygsource.c
@@ -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 @@ pyg_source_set_callback(PyGSource *self, PyObject *args)
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;