+;; From champlain-map-source-desc.h
+
+
+
;; From champlain-map-source-factory.h
(define-function map_source_factory_get_type
(define-method get_list
(of-object "ChamplainMapSourceFactory")
(c-name "champlain_map_source_factory_get_list")
- (return-type "gchar**")
+ (return-type "GSList*")
)
(define-method create
(c-name "champlain_map_source_factory_register")
(return-type "gboolean")
(parameters
- '("const-gchar*" "id")
- '("ChamplainMapSourceConstructor" "callback")
+ '("ChamplainMapSourceDesc*" "desc")
)
)
override champlain_map_source_factory_get_list kwargs
static PyObject *
_wrap_champlain_map_source_factory_get_list(PyGObject *self) {
- gchar **list;
- gchar *item;
+ GSList *iter, *list;
PyObject *ret;
- int i = 0;
list = champlain_map_source_factory_get_list(CHAMPLAIN_MAP_SOURCE_FACTORY(self->obj));
ret = PyList_New(0);
- item = list[i];
- while (item != NULL) {
- PyList_Append (ret, PyString_FromString(item));
- item = list[++i];
+ for(iter = list; iter != NULL; iter = iter->next) {
+ PyObject *item = PyDict_New();
+ ChamplainMapSourceDesc *desc = (ChamplainMapSourceDesc *) iter->data;
+ PyDict_SetItemString(item, "id", PyString_FromString(desc->id));
+ PyDict_SetItemString(item, "name", PyString_FromString(desc->name));
+ PyDict_SetItemString(item, "license", PyString_FromString(desc->license));
+ PyDict_SetItemString(item, "license_uri", PyString_FromString(desc->license_uri));
+ PyDict_SetItemString(item, "min_zoom_level", PyInt_FromLong(desc->min_zoom_level));
+ PyDict_SetItemString(item, "max_zoom_level", PyInt_FromLong(desc->max_zoom_level));
+ PyList_Append(ret, item);
+ Py_DECREF(item);
}
- if (!list) {
- Py_INCREF (Py_None);
- return Py_None;
- }
-
return ret;
}
%%
combo = gtk.combo_box_new_text()
self.map_source_factory = champlain.map_source_factory_get_default()
+ liststore = gtk.ListStore(str, str)
for source in self.map_source_factory.get_list():
- combo.append_text(source)
+ liststore.append([source["id"], source["name"]])
+ combo.append_text(source["name"])
+ combo.set_model(liststore)
+ combo.set_attributes(combo.get_cells()[0], text=1)
combo.set_active(0)
combo.connect("changed", self.map_source_changed)
bbox.add(combo)
self.view.set_property("zoom-level", self.spinbutton.get_value_as_int())
def map_source_changed(self, widget):
- selection = widget.get_active_text()
- source = self.map_source_factory.create(selection);
+ model = widget.get_model()
+ iter = widget.get_active_iter()
+ id = model.get_value(iter, 0)
+ source = self.map_source_factory.create(id);
self.view.set_property("map-source", source)
def map_zoom_changed(self, widget, value):
champlain-defines.h \
champlain-layer.h \
champlain-map-source.h \
+ champlain-map-source-desc.h \
champlain-map-source-factory.h \
champlain-network-map-source.h \
champlain-marker.h \