diff options
Diffstat (limited to 'gobject/pygmaincontext.c')
-rw-r--r-- | gobject/pygmaincontext.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gobject/pygmaincontext.c b/gobject/pygmaincontext.c index 7286a86..b320eea 100644 --- a/gobject/pygmaincontext.c +++ b/gobject/pygmaincontext.c @@ -27,7 +27,7 @@ #include "pygobject-private.h" static int -pyg_main_context_new(PyGMainContext *self) +pyg_main_context_init(PyGMainContext *self) { self->context = g_main_context_new(); return 0; @@ -118,5 +118,27 @@ PyTypeObject PyGMainContext_Type = { (descrgetfunc)0, (descrsetfunc)0, 0, - (initproc)pyg_main_context_new, + (initproc)pyg_main_context_init, }; + +/** + * pyg_main_context_new: + * @context: a GMainContext. + * + * Creates a wrapper for a GMainContext. + * + * Returns: the GMainContext wrapper. + */ +PyObject * +pyg_main_context_new(GMainContext *context) +{ + PyGMainContext *self; + + self = (PyGMainContext *)PyObject_NEW(PyGMainContext, + &PyGMainContext_Type); + if (self == NULL) + return NULL; + + self->context = g_main_context_ref(context); + return (PyObject *)self; +} |