diff options
author | Manish Singh <yosh@gimp.org> | 2005-08-01 22:50:42 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 2005-08-01 22:50:42 +0000 |
commit | 9ef8e1721cbf74cd758380ace340ca9f2f19928b (patch) | |
tree | b39ae020119bea8b57860cd79ce9d8f4fdf23da8 /gobject/pygsource.c | |
parent | ca9f9bd7c784486b1f712445d0659ea3ba19099c (diff) | |
download | pygobject-9ef8e1721cbf74cd758380ace340ca9f2f19928b.tar.gz pygobject-9ef8e1721cbf74cd758380ace340ca9f2f19928b.tar.xz pygobject-9ef8e1721cbf74cd758380ace340ca9f2f19928b.zip |
gobject/pygobject-private.h Add a convenience function
2005-08-01 Manish Singh <yosh@gimp.org>
* gobject/pygobject-private.h
* gobject/pygmaincontext.c: Add a convenience function
(pyg_main_context_new) to create a PyGMainContext from a
GMainContext. Takes care of refing the supplied GMainContext
as well.
* gobject/gobjectmodule.c (pyg_main_context_default)
* gobject/pygmainloop.c (_wrap_g_main_loop_get_context)
* gobject/pygsource.c (pyg_source_get_context): use the new
convenience function here. This fixes bug #312259.
Diffstat (limited to 'gobject/pygsource.c')
-rw-r--r-- | gobject/pygsource.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/gobject/pygsource.c b/gobject/pygsource.c index 08ca458..900bd4f 100644 --- a/gobject/pygsource.c +++ b/gobject/pygsource.c @@ -167,7 +167,6 @@ pyg_source_set_callback(PyGSource *self, PyObject *args) static PyObject * pyg_source_get_context(PyGSource *self) { - PyGMainContext *py_context; GMainContext *context; CHECK_DESTROYED(self, NULL); @@ -175,13 +174,7 @@ pyg_source_get_context(PyGSource *self) context = g_source_get_context(self->source); if (context) { - py_context = PyObject_NEW(PyGMainContext, &PyGMainContext_Type); - if (py_context == NULL) - return NULL; - - py_context->context = context; - - return (PyObject *)py_context; + return pyg_main_context_new(context); } else { Py_INCREF(Py_None); return Py_None; |