+static void maps_layer_redownload_new ( VikMapsLayer *vml )
+{
+ start_download_thread ( vml, vml->redownload_vvp, &(vml->redownload_ul), &(vml->redownload_br), REDOWNLOAD_NEW );
+}
+
+/**
+ * Display a simple dialog with information about this particular map tile
+ */
+static void maps_layer_tile_info ( VikMapsLayer *vml )
+{
+ VikMapSource *map = MAPS_LAYER_NTH_TYPE(vml->maptype);
+
+ gdouble xzoom = vml->xmapzoom ? vml->xmapzoom : vik_viewport_get_xmpp ( vml->redownload_vvp );
+ gdouble yzoom = vml->ymapzoom ? vml->ymapzoom : vik_viewport_get_ympp ( vml->redownload_vvp );
+ MapCoord ulm;
+
+ if ( !vik_map_source_coord_to_mapcoord ( map, &(vml->redownload_ul), xzoom, yzoom, &ulm ) )
+ return;
+
+ gchar *filename = NULL;
+ gchar *message = NULL;
+ gchar *source = NULL;
+
+ if ( vik_map_source_is_direct_file_access ( map ) ) {
+ filename = g_strdup_printf ( DIRECTDIRACCESS, vml->cache_dir, ulm.scale, ulm.x, ulm.y, ".png" );
+ source = g_strconcat ( "file://", filename, NULL );
+ }
+ else {
+ filename = g_strdup_printf ( DIRSTRUCTURE, vml->cache_dir, vik_map_source_get_uniq_id(map), ulm.scale, ulm.z, ulm.x, ulm.y );
+ source = g_strdup_printf ( "http://%s%s",
+ vik_map_source_default_get_hostname ( VIK_MAP_SOURCE_DEFAULT(map) ),
+ vik_map_source_default_get_uri ( VIK_MAP_SOURCE_DEFAULT(map), &ulm ) );
+ }
+
+ if ( g_file_test ( filename, G_FILE_TEST_EXISTS ) ) {
+
+ // Get some timestamp information of the tile
+ struct stat stat_buf;
+ if ( g_stat ( filename, &stat_buf ) == 0 ) {
+ time_t file_time = stat_buf.st_mtime;
+#if GLIB_CHECK_VERSION(2,26,0)
+ GDateTime* gdt = g_date_time_new_from_unix_utc ( file_time );
+ gchar *time = g_date_time_format ( gdt, "%c" );
+#else
+ GDate* gdate = g_date_new ();
+ g_date_set_time_t ( gdate, file_time );
+ char time[32];
+ g_date_strftime ( time, sizeof(time), "%c", gdate );
+ g_date_free ( gdate );
+#endif
+ message = g_strdup_printf ( _("\nSource: %s\n\nTile File: %s\nTile File Timestamp: %s"), source, filename, time );
+
+#if GLIB_CHECK_VERSION(2,26,0)
+ g_free ( time );
+ g_date_time_unref ( gdt);
+#endif
+ }
+ }
+ else
+ message = g_strdup_printf ( _("Source: %s\n\nNo Tile File!"), source );
+
+ // Show the info
+ a_dialog_info_msg ( VIK_GTK_WINDOW_FROM_LAYER(vml), message );
+
+ g_free ( message );
+ g_free ( source );
+ g_free ( filename );
+}
+