]> err.no Git - libchamplain/commitdiff
Fix tile's update on screen when no new data to show
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sun, 29 Mar 2009 21:20:22 +0000 (00:20 +0300)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Fri, 1 May 2009 16:23:48 +0000 (12:23 -0400)
champlain/champlain-network-map-source.c
champlain/champlain-view.c
champlain/champlain-view.h

index 179340837e2cb890575ab2243a0256a27d806881..3c55adf41f2f03122f700902081cba5486acea04 100644 (file)
@@ -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,
index ca4a7667c68c85dc5fb5ad9db895b3777f8ad41e..33fbc15cea4d67ec40135883654b0c76cfc1855a 100644 (file)
@@ -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);
 }
 
index ab679c5b46f634e8c7bb42ccebc3df6d20334ef4..2a896ae4b1cb6042585ca4954caba37421c663b6 100644 (file)
@@ -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