GSList *registered_sources;
};
-static ChamplainMapSource * champlain_map_source_new_osm_mapnik (void);
-static ChamplainMapSource * champlain_map_source_new_osm_cyclemap (void);
-static ChamplainMapSource * champlain_map_source_new_osm_osmarender (void);
-static ChamplainMapSource * champlain_map_source_new_oam (void);
-static ChamplainMapSource * champlain_map_source_new_mff_relief (void);
+static ChamplainMapSource * champlain_map_source_new_osm_mapnik (
+ ChamplainMapSourceDesc *desc, gpointer *data);
+static ChamplainMapSource * champlain_map_source_new_osm_cyclemap (
+ ChamplainMapSourceDesc *desc, gpointer *data);
+static ChamplainMapSource * champlain_map_source_new_osm_osmarender (
+ ChamplainMapSourceDesc *desc, gpointer *data);
+static ChamplainMapSource * champlain_map_source_new_oam (
+ ChamplainMapSourceDesc *desc, gpointer *data);
+static ChamplainMapSource * champlain_map_source_new_mff_relief (
+ ChamplainMapSourceDesc *desc, gpointer *data);
static void
0,
18,
CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_osm_mapnik
+ champlain_map_source_new_osm_mapnik,
+ NULL
};
static
0,
18,
CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_osm_osmarender
+ champlain_map_source_new_osm_osmarender,
+ NULL
};
static
0,
18,
CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_osm_cyclemap
+ champlain_map_source_new_osm_cyclemap,
+ NULL
};
static
0,
17,
CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_oam
+ champlain_map_source_new_oam,
+ NULL
};
static
0,
11,
CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_mff_relief
+ champlain_map_source_new_mff_relief,
+ NULL
};
static void
priv->registered_sources = NULL;
- champlain_map_source_factory_register (factory, &OSM_MAPNIK_DESC);
- champlain_map_source_factory_register (factory, &OSM_CYCLEMAP_DESC);
- champlain_map_source_factory_register (factory, &OSM_OSMARENDER_DESC);
- champlain_map_source_factory_register (factory, &OAM_DESC);
- champlain_map_source_factory_register (factory, &MFF_RELIEF_DESC);
+ champlain_map_source_factory_register (factory, &OSM_MAPNIK_DESC,
+ OSM_MAPNIK_DESC.constructor, OSM_MAPNIK_DESC.data);
+ champlain_map_source_factory_register (factory, &OSM_CYCLEMAP_DESC,
+ OSM_CYCLEMAP_DESC.constructor, OSM_CYCLEMAP_DESC.data);
+ champlain_map_source_factory_register (factory, &OSM_OSMARENDER_DESC,
+ OSM_OSMARENDER_DESC.constructor, OSM_OSMARENDER_DESC.data);
+ champlain_map_source_factory_register (factory, &OAM_DESC,
+ OAM_DESC.constructor, OAM_DESC.data);
+ champlain_map_source_factory_register (factory, &MFF_RELIEF_DESC,
+ MFF_RELIEF_DESC.constructor, MFF_RELIEF_DESC.data);
}
/**
while (item != NULL)
{
- ChamplainMapSourceDesc *desc = (ChamplainMapSourceDesc*) item->data;
+ ChamplainMapSourceDesc *desc = CHAMPLAIN_MAP_SOURCE_DESC (item->data);
if (strcmp (desc->id, id) == 0)
- return desc->constructor ();
+ return desc->constructor (desc, desc->data);
item = g_slist_next (item);
}
return NULL;
/**
* champlain_map_source_factory_register:
- * @factory: the Factory
- * @name: the new map source name
+ * @desc: the description of the map source
* @constructor: the new map source constructor function
+ * @data: data to be passed to the constructor function, or NULL
*
* Registers the new map source with the given constructor. When this map
* source is requested, the given constructor will be used to build the
*/
gboolean
champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
- ChamplainMapSourceDesc *desc)
+ ChamplainMapSourceDesc *desc, ChamplainMapSourceConstructor constructor,
+ gpointer data)
{
/* FIXME: check for existing factory with that name? */
+ desc->constructor = constructor;
+ desc->data = data;
factory->priv->registered_sources = g_slist_append (factory->priv->registered_sources, desc);
return TRUE;
}
static ChamplainMapSource *
-champlain_map_source_new_osm_cyclemap (void)
+champlain_map_source_new_osm_cyclemap (
+ ChamplainMapSourceDesc *desc, gpointer *data)
{
return CHAMPLAIN_MAP_SOURCE (champlain_network_map_source_new_full (CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP,
"OpenStreetMap Cycle Map",
}
static ChamplainMapSource *
-champlain_map_source_new_osm_osmarender (void)
+champlain_map_source_new_osm_osmarender (
+ ChamplainMapSourceDesc *desc, gpointer *data)
{
return CHAMPLAIN_MAP_SOURCE (champlain_network_map_source_new_full (CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER,
"OpenStreetMap Osmarender",
}
static ChamplainMapSource *
-champlain_map_source_new_osm_mapnik (void)
+champlain_map_source_new_osm_mapnik (
+ ChamplainMapSourceDesc *desc, gpointer *data)
{
return CHAMPLAIN_MAP_SOURCE (champlain_network_map_source_new_full (CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK,
"OpenStreetMap Mapnik",
}
static ChamplainMapSource *
-champlain_map_source_new_oam (void)
+champlain_map_source_new_oam (
+ ChamplainMapSourceDesc *desc, gpointer *data)
{
return CHAMPLAIN_MAP_SOURCE (champlain_network_map_source_new_full (CHAMPLAIN_MAP_SOURCE_OAM,
"OpenAerialMap",
}
static ChamplainMapSource *
-champlain_map_source_new_mff_relief (void)
+champlain_map_source_new_mff_relief (
+ ChamplainMapSourceDesc *desc, gpointer *data)
{
return CHAMPLAIN_MAP_SOURCE (champlain_network_map_source_new_full (CHAMPLAIN_MAP_SOURCE_MFF_RELIEF,
"Maps for Free Relief",