summaryrefslogtreecommitdiffstats
path: root/gobject/pygmaincontext.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-20 14:17:04 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-20 14:17:04 +0000
commit45ccf5f6ff1a1805ed326b397c70cf55bba28124 (patch)
tree59b30668a1b28efced9f417b1e6bc2f4bc9709ec /gobject/pygmaincontext.c
parent9cd866c9066eaa933b54e77225ada672fcfacad3 (diff)
downloadpygobject-45ccf5f6ff1a1805ed326b397c70cf55bba28124.tar.gz
pygobject-45ccf5f6ff1a1805ed326b397c70cf55bba28124.tar.xz
pygobject-45ccf5f6ff1a1805ed326b397c70cf55bba28124.zip
Move maincontext and mainloop over to glib. Update the threadstate api to
2008-07-20 Johan Dahlin <johan@gnome.org> * glib/Makefile.am: * glib/glibmodule.c (pyglib_main_context_default), (init_glib): * glib/pyglib.c (pyglib_init), (pyglib_threads_enabled), (pyglib_main_context_new): * glib/pyglib.h: * glib/pygmaincontext.c (_wrap_g_main_context_iteration), (pyglib_maincontext_register_types): * glib/pygmaincontext.h: * glib/pygmainloop.c (pyg_signal_watch_prepare), (pyg_signal_watch_check), (pyg_main_loop_new), (_wrap_g_main_loop_get_context), (_wrap_g_main_loop_run), (pyglib_mainloop_register_types): * glib/pygmainloop.h: * gobject/Makefile.am: * gobject/__init__.py: * gobject/gobjectmodule.c (pyg_destroy_notify), (pyobject_free), (pyg_object_set_property), (pyg_object_get_property), (_pyg_signal_accumulator), (pygobject__g_instance_init), (pyg_handler_marshal), (pygobject_gil_state_ensure), (pygobject_gil_state_release), (marshal_emission_hook), (_log_func), (init_gobject): * gobject/pygboxed.c (pyg_boxed_dealloc), (pyg_boxed_new): * gobject/pygenum.c (pyg_enum_add): * gobject/pygflags.c (pyg_flags_add): * gobject/pygiochannel.c (pyg_iowatch_marshal): * gobject/pygmaincontext.c: * gobject/pygmainloop.c: * gobject/pygobject-private.h: * gobject/pygobject.c (pygobject_data_free), (pyg_toggle_notify), (pygobject_new_with_interfaces), (pygobject_weak_ref_notify): * gobject/pygobject.h: * gobject/pygoptiongroup.c (destroy_g_group), (arg_func): * gobject/pygpointer.c (pyg_pointer_new): * gobject/pygsource.c (pyg_source_get_context), (pyg_source_prepare), (pyg_source_check), (pyg_source_dispatch), (pyg_source_finalize): * gobject/pygtype.c (pyg_closure_invalidate), (pyg_closure_marshal), (pyg_signal_class_closure_marshal): * tests/common.py: Move maincontext and mainloop over to glib. Update the threadstate api to use the variant in glib. svn path=/trunk/; revision=843
Diffstat (limited to 'gobject/pygmaincontext.c')
-rw-r--r--gobject/pygmaincontext.c144
1 files changed, 0 insertions, 144 deletions
diff --git a/gobject/pygmaincontext.c b/gobject/pygmaincontext.c
deleted file mode 100644
index b320eea..0000000
--- a/gobject/pygmaincontext.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * pygtk- Python bindings for the GTK toolkit.
- * Copyright (C) 1998-2003 James Henstridge
- *
- * pygmaincontext.c: GMainContext wrapper
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "pygobject-private.h"
-
-static int
-pyg_main_context_init(PyGMainContext *self)
-{
- self->context = g_main_context_new();
- return 0;
-}
-
-static void
-pyg_main_context_dealloc(PyGMainContext *self)
-{
- if (self->context != NULL) {
- g_main_context_unref(self->context);
- self->context = NULL;
- }
-
- PyObject_Del(self);
-}
-
-static int
-pyg_main_context_compare(PyGMainContext *self, PyGMainContext *v)
-{
- if (self->context == v->context) return 0;
- if (self->context > v->context) return -1;
- return 1;
-}
-
-static PyObject *
-_wrap_g_main_context_iteration (PyGMainContext *self, PyObject *args)
-{
- gboolean ret, may_block = TRUE;
-
- if (!PyArg_ParseTuple(args, "|i:GMainContext.iteration",
- &may_block))
- return NULL;
-
- pyg_begin_allow_threads;
- ret = g_main_context_iteration(self->context, may_block);
- pyg_end_allow_threads;
-
- return PyBool_FromLong(ret);
-}
-
-static PyObject *
-_wrap_g_main_context_pending (PyGMainContext *self)
-{
- return PyBool_FromLong(g_main_context_pending(self->context));
-}
-
-static PyMethodDef _PyGMainContext_methods[] = {
- { "iteration", (PyCFunction)_wrap_g_main_context_iteration, METH_VARARGS },
- { "pending", (PyCFunction)_wrap_g_main_context_pending, METH_NOARGS },
- { NULL, NULL, 0 }
-};
-
-PyTypeObject PyGMainContext_Type = {
- PyObject_HEAD_INIT(NULL)
- 0,
- "gobject.MainContext",
- sizeof(PyGMainContext),
- 0,
- /* methods */
- (destructor)pyg_main_context_dealloc,
- (printfunc)0,
- (getattrfunc)0,
- (setattrfunc)0,
- (cmpfunc)pyg_main_context_compare,
- (reprfunc)0,
- 0,
- 0,
- 0,
- (hashfunc)0,
- (ternaryfunc)0,
- (reprfunc)0,
- (getattrofunc)0,
- (setattrofunc)0,
- 0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- NULL,
- (traverseproc)0,
- (inquiry)0,
- (richcmpfunc)0,
- 0,
- (getiterfunc)0,
- (iternextfunc)0,
- _PyGMainContext_methods,
- 0,
- 0,
- NULL,
- NULL,
- (descrgetfunc)0,
- (descrsetfunc)0,
- 0,
- (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;
-}