From: Emmanuel Rodriguez Date: Mon, 4 May 2009 14:32:43 +0000 (+0200) Subject: Bindings for champlain_map_source_factory_get_list X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4546c77fce18cb7c2a6724f71125a21985bc0091;p=libchamplain Bindings for champlain_map_source_factory_get_list --- diff --git a/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t b/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t index f727c58..1dbbe2b 100644 --- a/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t +++ b/bindings/perl/Champlain/t/ChamplainMapSourceFactory.t @@ -38,6 +38,9 @@ sub test_map_factory { generic_create($factory, Champlain::MapSourceFactory->OSM_CYCLEMAP); generic_create($factory, Champlain::MapSourceFactory->OAM); generic_create($factory, Champlain::MapSourceFactory->MFF_RELIEF); + + my @maps = $factory->get_list(); + ok(@maps >= 5, "Maps factory has the default maps"); } diff --git a/bindings/perl/Champlain/xs/ChamplainMapSourceFactory.xs b/bindings/perl/Champlain/xs/ChamplainMapSourceFactory.xs index 40901e3..4e02ac9 100644 --- a/bindings/perl/Champlain/xs/ChamplainMapSourceFactory.xs +++ b/bindings/perl/Champlain/xs/ChamplainMapSourceFactory.xs @@ -9,8 +9,23 @@ champlain_map_source_factory_get_default (class) C_ARGS: /* No args */ -#gchar** -#champlain_map_source_factory_get_list (ChamplainMapSourceFactory *factory) +void +champlain_map_source_factory_get_list (ChamplainMapSourceFactory *factory) + PREINIT: + gchar **list = NULL; + gchar *item = NULL; + gint i = 0; + + PPCODE: + list = champlain_map_source_factory_get_list(factory); + + item = list[0]; + while (item != NULL) { + XPUSHs(sv_2mortal(newSVGChar(item))); + item = list[++i]; + } + + g_strfreev(list); ChamplainMapSource*