]> git.street.me.uk Git - andy/viking.git/blobdiff - src/googlemaps.c
Add referer to DownloadOptions
[andy/viking.git] / src / googlemaps.c
index ce5e4bc8171af1beb6468603e87f1f205d6026bc..87795fdf9d1aacc0afd526a900d3896294ce6899 100644 (file)
 
 #include <gtk/gtk.h>
 #include <math.h>
+#include "viking.h"
 #include "coords.h"
 #include "vikcoord.h"
 #include "mapcoord.h"
-#include "http.h"
+#include "download.h"
+#include "vikmapslayer.h"
 
 #include "googlemaps.h"
 
+static DownloadOptions googlemaps_options = { 1, "http://maps.google.com/" };
+
+/* initialisation */
+void googlemaps_init () {
+  VikMapsLayer_MapType map_type = { 9, 128, 128, VIK_VIEWPORT_DRAWMODE_GOOGLE, googlemaps_coord_to_mapcoord, googlemaps_mapcoord_to_center_coord, googlemaps_download };
+  maps_layer_register_type("Old Google Maps", 9, &map_type);
+}
+
 /* 1 << (x-1) is like a 2**(x-1) */
 #define GZ(x) ((1<<(x-1))*GOOGLEMAPS_ZOOM_ONE_MPP)
 
@@ -73,6 +83,6 @@ void googlemaps_mapcoord_to_center_coord ( MapCoord *src, VikCoord *dest )
 void googlemaps_download ( MapCoord *src, const gchar *dest_fn )
 {
    gchar *uri = g_strdup_printf ( "/mt?&x=%d&y=%d&zoom=%d", src->x, src->y, src->scale );
-   a_http_download_get_url ( "mt.google.com", uri, dest_fn );
+   a_http_download_get_url ( "mt.google.com", uri, dest_fn, &googlemaps_options );
    g_free ( uri );
 }