g_object_unref (file);
g_object_unref (info);
g_free (now);
- goto finish;
+
+ champlain_tile_set_state (ctx->tile, CHAMPLAIN_STATE_DONE);
+ champlain_view_tile_uptodate (ctx->view, ctx->zoom_level, ctx->tile);
+ g_object_unref (ctx->tile);
+ g_object_unref (ctx->zoom_level);
+ g_free (ctx);
+ return;
}
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
{
if (in_cache == TRUE)
{
const gchar *etag;
- gchar *date;
-
- date = champlain_tile_get_modified_time_string (tile);
- DEBUG("If-Modified-Since %s", date);
- soup_message_headers_append (msg->request_headers,
- "If-Modified-Since", date);
- g_free (date);
+ /* If an etag is available, only use it.
+ * OSM servers seems to send now as the modified time for all tiles
+ * Omarender servers set the modified time correctly
+ */
etag = champlain_tile_get_etag (tile);
if (etag != NULL)
{
soup_message_headers_append (msg->request_headers,
"If-None-Match", etag);
}
+ else
+ {
+ gchar *date;
+
+ date = champlain_tile_get_modified_time_string (tile);
+ DEBUG("If-Modified-Since %s", date);
+ soup_message_headers_append (msg->request_headers,
+ "If-Modified-Since", date);
+
+ g_free (date);
+ }
}
soup_session_queue_message (soup_session, msg,
clutter_container_add (CLUTTER_CONTAINER (champlain_zoom_level_get_actor (level)), actor, NULL);
clutter_actor_show (actor);
-
view_position_tile (view, tile);
+
+ view_update_state (view);
+}
+
+void
+champlain_view_tile_uptodate (ChamplainView *view,
+ ChamplainZoomLevel *level,
+ ChamplainTile *tile)
+{
view_update_state (view);
}