From 9ef8e1721cbf74cd758380ace340ca9f2f19928b Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Mon, 1 Aug 2005 22:50:42 +0000 Subject: gobject/pygobject-private.h Add a convenience function 2005-08-01 Manish Singh * 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. --- gobject/gobjectmodule.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'gobject/gobjectmodule.c') diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 0aa7dbd..3eff89c 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1892,18 +1892,9 @@ pyg_source_remove(PyObject *self, PyObject *args) } static PyObject * -pyg_main_context_default (PyObject *unused) +pyg_main_context_default(PyObject *unused) { - PyGMainContext *self; - - self = (PyGMainContext *)PyObject_NEW(PyGMainContext, - &PyGMainContext_Type); - if (self == NULL) - return NULL; - - self->context = g_main_context_default(); - return (PyObject *)self; - + return pyg_main_context_new(g_main_context_default()); } static int pyg_thread_state_tls_key = -1; -- cgit