]> err.no Git - libchamplain/commitdiff
Pass an extra argument ($data) through $factory->register($desc, $sub, $data).
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Mon, 15 Jun 2009 21:43:48 +0000 (23:43 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 15 Jun 2009 21:57:29 +0000 (17:57 -0400)
The method register canl now handle an extra data parameter that will be
passed to the constructor.

bindings/perl/Champlain/xs/ChamplainMapSourceFactory.xs

index 84d1ba5d1de03fb129b81eead949d29bf7a5f724..d920945ca62d51d2bae1a0118a151c0aac9f75af 100644 (file)
@@ -4,7 +4,6 @@ static GPerlCallback*
 champlainperl_constructor_create (SV *func, SV *data) {
        GType param_types [] = {
                CHAMPLAIN_TYPE_MAP_SOURCE_DESC,
-               G_TYPE_POINTER,
        };
        return gperl_callback_new(
                func, data,
@@ -26,7 +25,7 @@ champlainperl_constructor (ChamplainMapSourceDesc *desc, gpointer data) {
        
        g_value_init(&return_value, callback->return_type);
        /* FIXME desc is not passed as a Champlain::MapSourceDesc to the perl callback */
-       gperl_callback_invoke(callback, &return_value, desc);
+       gperl_callback_invoke(callback, &return_value, desc, callback->data);
        
        retval = g_value_get_object(&return_value);
        g_value_unset(&return_value);
@@ -137,7 +136,7 @@ champlain_map_source_factory_register (ChamplainMapSourceFactory *factory, SV *s
        
        CODE:
                desc = champlainperl_SvChamplainMapSourceDesc(sv_desc);
-               callback = champlainperl_constructor_create(sv_constructor, NULL);
+               callback = champlainperl_constructor_create(sv_constructor, sv_data);
                RETVAL = champlain_map_source_factory_register(factory, desc, champlainperl_constructor, callback);
 
        OUTPUT: