]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikmapsource.c
Add copyright to srtm_continent.c
[andy/viking.git] / src / vikmapsource.c
index de756992f5d122124a3e14876c0c71d14e23d98c..9015f5b484130881f23d5d6ada462eb34b62205c 100644 (file)
@@ -30,7 +30,7 @@ static void vik_map_source_init (VikMapSource *object);
 static void vik_map_source_finalize (GObject *object);
 static void vik_map_source_class_init (VikMapSourceClass *klass);
 
-static void _supports_if_modified_since (VikMapSource *object);
+static gboolean _supports_download_only_new (VikMapSource *object);
 
 G_DEFINE_TYPE_EXTENDED (VikMapSource, vik_map_source, G_TYPE_OBJECT, (GTypeFlags)G_TYPE_FLAG_ABSTRACT,);
 
@@ -58,16 +58,18 @@ vik_map_source_class_init (VikMapSourceClass *klass)
        klass->get_tilesize_x = NULL;
        klass->get_tilesize_y = NULL;
        klass->get_drawmode = NULL;
-       klass->supports_if_modified_since = _supports_if_modified_since;
+       klass->supports_download_only_new = _supports_download_only_new;
        klass->coord_to_mapcoord = NULL;
        klass->mapcoord_to_center_coord = NULL;
        klass->download = NULL;
+       klass->download_handle_init = NULL;
+       klass->download_handle_cleanup = NULL;
        
        object_class->finalize = vik_map_source_finalize;
 }
 
-void
-_supports_if_modified_since (VikMapSource *self)
+gboolean
+_supports_download_only_new (VikMapSource *self)
 {
        // Default feature: does not support
        return FALSE;
@@ -139,16 +141,16 @@ vik_map_source_get_drawmode (VikMapSource *self)
 }
 
 gboolean
-vik_map_source_supports_if_modified_since (VikMapSource * self)
+vik_map_source_supports_download_only_new (VikMapSource * self)
 {
        VikMapSourceClass *klass;
        g_return_val_if_fail (self != NULL, 0);
        g_return_val_if_fail (VIK_IS_MAP_SOURCE (self), 0);
        klass = VIK_MAP_SOURCE_GET_CLASS(self);
 
-       g_return_val_if_fail (klass->supports_if_modified_since != NULL, 0);
+       g_return_val_if_fail (klass->supports_download_only_new != NULL, 0);
 
-       return (*klass->supports_if_modified_since)(self);
+       return (*klass->supports_download_only_new)(self);
 }
 
 gboolean
@@ -178,7 +180,7 @@ vik_map_source_mapcoord_to_center_coord (VikMapSource *self, MapCoord *src, VikC
 }
 
 int
-vik_map_source_download (VikMapSource * self, MapCoord * src, const gchar * dest_fn)
+vik_map_source_download (VikMapSource * self, MapCoord * src, const gchar * dest_fn, void *handle)
 {
        VikMapSourceClass *klass;
        g_return_val_if_fail (self != NULL, 0);
@@ -187,5 +189,31 @@ vik_map_source_download (VikMapSource * self, MapCoord * src, const gchar * dest
 
        g_return_val_if_fail (klass->download != NULL, 0);
 
-       return (*klass->download)(self, src, dest_fn);
+       return (*klass->download)(self, src, dest_fn, handle);
+}
+
+void *
+vik_map_source_download_handle_init (VikMapSource *self)
+{
+       VikMapSourceClass *klass;
+       g_return_val_if_fail (self != NULL, 0);
+       g_return_val_if_fail (VIK_IS_MAP_SOURCE (self), 0);
+       klass = VIK_MAP_SOURCE_GET_CLASS(self);
+
+       g_return_val_if_fail (klass->download_handle_init != NULL, 0);
+
+       return (*klass->download_handle_init)(self);
+}
+
+void
+vik_map_source_download_handle_cleanup (VikMapSource * self, void * handle)
+{
+       VikMapSourceClass *klass;
+       g_return_if_fail (self != NULL);
+       g_return_if_fail (VIK_IS_MAP_SOURCE (self));
+       klass = VIK_MAP_SOURCE_GET_CLASS(self);
+
+       g_return_if_fail (klass->download_handle_cleanup != NULL);
+
+       (*klass->download_handle_cleanup)(self, handle);
 }