From 1fef73f90a320955b604ba038e03713626d5be60 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 11 Nov 2008 19:17:21 +0000 Subject: Imported Upstream version 0.4.7~dfsg --- (limited to 'python') diff --git a/python/config.py b/python/config.py index 3187eac..52b362e 100644 --- a/python/config.py +++ b/python/config.py @@ -1 +1 @@ -libxul_dir = '/home/erikos/sugar-jhbuild/install/lib64/xulrunner-1.9b5' +libxul_dir = '/home/erikos/sugar-jhbuild/install/lib64/xulrunner-1.9.0.2' diff --git a/python/hulahop.c b/python/hulahop.c index 81caddd..9a31345 100644 --- a/python/hulahop.c +++ b/python/hulahop.c @@ -28,16 +28,6 @@ PyTypeObject G_GNUC_INTERNAL PyHulahopWebView_Type; /* ----------- HulahopWebView ----------- */ static PyObject * -_wrap_hulahop_web_view_create_window(PyGObject *self) -{ - - hulahop_web_view_create_window(HULAHOP_WEB_VIEW(self->obj)); - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * _wrap_hulahop_web_view_grab_focus(PyGObject *self) { @@ -53,7 +43,7 @@ _wrap_hulahop_web_view_get_browser(PyGObject *self) { return hulahop_web_view_get_browser(HULAHOP_WEB_VIEW(self->obj)); } -#line 57 "hulahop.c" +#line 47 "hulahop.c" #line 26 "hulahop.override" @@ -62,7 +52,7 @@ _wrap_hulahop_web_view_get_window_root(PyGObject *self) { return hulahop_web_view_get_window_root(HULAHOP_WEB_VIEW(self->obj)); } -#line 66 "hulahop.c" +#line 56 "hulahop.c" static PyObject * @@ -100,9 +90,29 @@ _wrap_hulahop_web_view_evaluate_script(PyGObject *self, PyObject *args, PyObject return Py_None; } +static PyObject * +_wrap_HulahopWebView__do_setup(PyObject *cls, PyObject *args, PyObject *kwargs) +{ + gpointer klass; + static char *kwlist[] = { "self", NULL }; + PyGObject *self; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:HulahopWebView.setup", kwlist, &PyHulahopWebView_Type, &self)) + return NULL; + klass = g_type_class_ref(pyg_type_from_object(cls)); + if (HULAHOP_WEB_VIEW_CLASS(klass)->setup) + HULAHOP_WEB_VIEW_CLASS(klass)->setup(HULAHOP_WEB_VIEW(self->obj)); + else { + PyErr_SetString(PyExc_NotImplementedError, "virtual method HulahopWebView.setup not implemented"); + g_type_class_unref(klass); + return NULL; + } + g_type_class_unref(klass); + Py_INCREF(Py_None); + return Py_None; +} + static const PyMethodDef _PyHulahopWebView_methods[] = { - { "create_window", (PyCFunction)_wrap_hulahop_web_view_create_window, METH_NOARGS, - NULL }, { "grab_focus", (PyCFunction)_wrap_hulahop_web_view_grab_focus, METH_NOARGS, NULL }, { "get_browser", (PyCFunction)_wrap_hulahop_web_view_get_browser, METH_NOARGS, @@ -115,6 +125,8 @@ static const PyMethodDef _PyHulahopWebView_methods[] = { NULL }, { "evaluate_script", (PyCFunction)_wrap_hulahop_web_view_evaluate_script, METH_VARARGS|METH_KEYWORDS, NULL }, + { "do_setup", (PyCFunction)_wrap_HulahopWebView__do_setup, METH_VARARGS|METH_KEYWORDS|METH_CLASS, + NULL }, { NULL, NULL, 0, NULL } }; @@ -163,6 +175,77 @@ PyTypeObject G_GNUC_INTERNAL PyHulahopWebView_Type = { (inquiry)0 /* tp_is_gc */ }; +static void +_wrap_HulahopWebView__proxy_do_setup(HulahopWebView *self) +{ + PyGILState_STATE __py_state; + PyObject *py_self; + PyObject *py_retval; + PyObject *py_method; + + __py_state = pyg_gil_state_ensure(); + py_self = pygobject_new((GObject *) self); + if (!py_self) { + if (PyErr_Occurred()) + PyErr_Print(); + pyg_gil_state_release(__py_state); + return; + } + + + py_method = PyObject_GetAttrString(py_self, "do_setup"); + if (!py_method) { + if (PyErr_Occurred()) + PyErr_Print(); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + py_retval = PyObject_CallObject(py_method, NULL); + if (!py_retval) { + if (PyErr_Occurred()) + PyErr_Print(); + Py_XDECREF(py_retval); + Py_DECREF(py_method); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + if (py_retval != Py_None) { + PyErr_SetString(PyExc_TypeError, "virtual method should return None"); + PyErr_Print(); + Py_XDECREF(py_retval); + Py_DECREF(py_method); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + + + Py_XDECREF(py_retval); + Py_DECREF(py_method); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); +} + +static int +__HulahopWebView_class_init(gpointer gclass, PyTypeObject *pyclass) +{ + PyObject *o; + HulahopWebViewClass *klass = HULAHOP_WEB_VIEW_CLASS(gclass); + PyObject *gsignals = PyDict_GetItemString(pyclass->tp_dict, "__gsignals__"); + + o = PyObject_GetAttrString((PyObject *) pyclass, "do_setup"); + if (o == NULL) + PyErr_Clear(); + else { + if (!PyObject_TypeCheck(o, &PyCFunction_Type) + && !(gsignals && PyDict_GetItemString(gsignals, "setup"))) + klass->setup = _wrap_HulahopWebView__proxy_do_setup; + Py_DECREF(o); + } + return 0; +} /* ----------- functions ----------- */ @@ -219,6 +302,22 @@ _wrap_hulahop_add_components_path(PyObject *self, PyObject *args, PyObject *kwar return Py_None; } +static PyObject * +_wrap_hulahop_get_view_for_window(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "dom_window", NULL }; + PyObject *dom_window; + HulahopWebView *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:get_view_for_window", kwlist, &dom_window)) + return NULL; + + ret = hulahop_get_view_for_window(dom_window); + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} + const PyMethodDef pyhulahop_functions[] = { { "startup", (PyCFunction)_wrap_hulahop_startup, METH_NOARGS, NULL }, @@ -228,6 +327,8 @@ const PyMethodDef pyhulahop_functions[] = { NULL }, { "add_components_path", (PyCFunction)_wrap_hulahop_add_components_path, METH_VARARGS|METH_KEYWORDS, NULL }, + { "get_view_for_window", (PyCFunction)_wrap_hulahop_get_view_for_window, METH_VARARGS|METH_KEYWORDS, + NULL }, { NULL, NULL, 0, NULL } }; @@ -251,6 +352,7 @@ pyhulahop_register_classes(PyObject *d) } -#line 255 "hulahop.c" +#line 356 "hulahop.c" pygobject_register_class(d, "HulahopWebView", HULAHOP_TYPE_WEB_VIEW, &PyHulahopWebView_Type, Py_BuildValue("(O)", &PyGtkBin_Type)); + pyg_register_class_init(HULAHOP_TYPE_WEB_VIEW, __HulahopWebView_class_init); } -- cgit v0.9.1