]> err.no Git - libchamplain/commitdiff
champlain_view_ensure_markers_visible are now covered by python binding
authorVictor Godoy Poluceno <victorpoluceno@gmail.com>
Mon, 20 Jul 2009 18:38:32 +0000 (15:38 -0300)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 25 Jul 2009 00:18:18 +0000 (20:18 -0400)
bindings/python/champlain/pychamplain.override

index 824821f43184a63cb05ede4a234ba0991572739d..1e1165ca3707e25d0f31432b8efca0623ce2246e 100644 (file)
@@ -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;
+}
+%%