From 4546c77fce18cb7c2a6724f71125a21985bc0091 Mon Sep 17 00:00:00 2001 From: Emmanuel Rodriguez Date: Mon, 4 May 2009 16:32:43 +0200 Subject: [PATCH] Bindings for champlain_map_source_factory_get_list --- .../Champlain/t/ChamplainMapSourceFactory.t | 3 +++ .../Champlain/xs/ChamplainMapSourceFactory.xs | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) 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* -- 2.39.5