From: Pierre-Luc Beaudoin Date: Sun, 29 Mar 2009 21:20:22 +0000 (+0300) Subject: Fix tile's update on screen when no new data to show X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac9a9b7dd8adcab3346790ae453d7099b5107137;p=libchamplain Fix tile's update on screen when no new data to show --- diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c index 1793408..3c55adf 100644 --- a/champlain/champlain-network-map-source.c +++ b/champlain/champlain-network-map-source.c @@ -437,7 +437,13 @@ file_loaded_cb (SoupSession *session, 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)) { @@ -613,14 +619,11 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, 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) { @@ -628,6 +631,17 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, 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, diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index ca4a766..33fbc15 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -1484,8 +1484,16 @@ champlain_view_tile_ready (ChamplainView *view, 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); } diff --git a/champlain/champlain-view.h b/champlain/champlain-view.h index ab679c5..2a896ae 100644 --- a/champlain/champlain-view.h +++ b/champlain/champlain-view.h @@ -136,6 +136,9 @@ void champlain_view_tile_updated (ChamplainView *view, ChamplainZoomLevel *level, ChamplainTile *tile, ClutterActor *actor); +void champlain_view_tile_uptodate (ChamplainView *view, + ChamplainZoomLevel *level, + ChamplainTile *tile); G_END_DECLS