From: Victor Godoy Poluceno Date: Mon, 20 Jul 2009 18:38:32 +0000 (-0300) Subject: champlain_view_ensure_markers_visible are now covered by python binding X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb597b9b32556bf86bf9d3909f6a757311f06041;p=libchamplain champlain_view_ensure_markers_visible are now covered by python binding --- diff --git a/bindings/python/champlain/pychamplain.override b/bindings/python/champlain/pychamplain.override index 824821f..1e1165c 100644 --- a/bindings/python/champlain/pychamplain.override +++ b/bindings/python/champlain/pychamplain.override @@ -188,3 +188,40 @@ _wrap_champlain_view_get_coords_at(PyGObject *self, PyObject *args) return Py_BuildValue("(dd)", lat, lon); } %% +override champlain_view_ensure_markers_visible kwargs +static PyObject * +_wrap_champlain_view_ensure_markers_visible(PyGObject *self, PyObject *args) +{ + PyObject *pymarkers, *pyanimate=0; + gboolean animate = 1; + long i = 0; + ChamplainBaseMarker **markers = NULL; + + if (!PyArg_ParseTuple(args, "O|O:ChamplainView.ensure_markers_visible", + &pymarkers, &pyanimate)){ + return NULL; + } + + if (!PySequence_Check(pymarkers)){ + PyErr_SetString(PyExc_TypeError, "must be called with a list of markers as first argument"); + return NULL; + } + + if (pyanimate){ + if (!PyObject_IsTrue(pyanimate)) + animate = 0; + } + + markers = g_new0(ChamplainBaseMarker*, PyList_Size(pymarkers)+2); + for (i=0; i < PyList_Size(pymarkers); i++){ + ChamplainBaseMarker *marker = pyg_boxed_get(PyList_GetItem(pymarkers, i), ChamplainBaseMarker); + markers[i] = marker; + } + + champlain_view_ensure_markers_visible(CHAMPLAIN_VIEW(self->obj), markers, animate); + g_free(markers); + + Py_INCREF(Py_None); + return Py_None; +} +%%