#include <glib/gi18n.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include "globals.h"
-#include "curl_download.h"
#include "bingmapsource.h"
+#include "maputils.h"
#include "bbox.h"
#include "background.h"
#include "icons/icons.h"
#define URL_ATTR_FMT "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial/0,0?zl=1&mapVersion=v1&key=%s&include=ImageryProviders&output=xml"
static gchar *_get_uri ( VikMapSourceDefault *self, MapCoord *src );
-static void _get_copyright (VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(void*,const gchar*), void *data);
+static void _get_copyright (VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data);
static const GdkPixbuf *_get_logo ( VikMapSource *self );
static int _load_attributions ( BingMapSource *self );
static void _async_load_attributions ( BingMapSource *self );
}
static void
-_get_copyright(VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(void*,const gchar*), void *data)
+_get_copyright(VikMapSource * self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data)
{
g_return_if_fail (BING_IS_MAP_SOURCE(self));
g_debug("%s: looking for %g %g %g %g at %g", __FUNCTION__, bbox.south, bbox.north, bbox.east, bbox.west, zoom);
BingMapSourcePrivate *priv = BING_MAP_SOURCE_GET_PRIVATE(self);
- int level = vik_slippy_map_source_zoom_to_scale (zoom);
+ int level = map_utils_mpp_to_scale (zoom);
/* Loop over all known attributions */
GList *attribution = priv->attributions;
static int
_load_attributions ( BingMapSource *self )
{
- FILE *tmp_file;
- int tmp_fd;
- gchar *tmpname;
- gchar *uri;
int ret = 0; /* OK */
BingMapSourcePrivate *priv = BING_MAP_SOURCE_GET_PRIVATE (self);
+ gchar *uri = g_strdup_printf(URL_ATTR_FMT, priv->api_key);
- if ((tmp_fd = g_file_open_tmp ("vik-bing.XXXXXX", &tmpname, NULL)) == -1) {
- g_critical(_("couldn't open temp file"));
- return -1;
- }
-
- tmp_file = fdopen(tmp_fd, "r+");
- uri = g_strdup_printf(URL_ATTR_FMT, priv->api_key);
-
- /* TODO: curl may not be available */
- if (curl_download_uri(uri, tmp_file, vik_map_source_default_get_download_options(VIK_MAP_SOURCE_DEFAULT(self)), 0, NULL)) { /* error */
- fclose(tmp_file);
- tmp_file = NULL;
- ret = -1;
- goto done;
- }
-
- fclose(tmp_file);
- tmp_file = NULL;
+ gchar *tmpname = a_download_uri_to_tmp_file ( uri, vik_map_source_default_get_download_options(VIK_MAP_SOURCE_DEFAULT(self)) );
g_debug("%s: %s", __FUNCTION__, tmpname);
if (!_parse_file_for_attributions(self, tmpname)) {
vik_layers_panel_emit_update ( VIK_LAYERS_PANEL (data) );
*/
gdk_threads_leave();
+ return 0;
}
static int