]> git.street.me.uk Git - andy/viking.git/blobdiff - src/download.c
Add Refresh to consider reloading a Mapnik Rendering configuration.
[andy/viking.git] / src / download.c
index d640d2221f1cd37d0bbbdc62df8d3b7b1c8b3f17..ef75b02f3b4d4bf9c5d18c246567e26f0977a055 100644 (file)
@@ -50,6 +50,7 @@
 #include "curl_download.h"
 #include "preferences.h"
 #include "globals.h"
 #include "curl_download.h"
 #include "preferences.h"
 #include "globals.h"
+#include "vik_compat.h"
 
 static gboolean check_file_first_line(FILE* f, gchar *patterns[])
 {
 
 static gboolean check_file_first_line(FILE* f, gchar *patterns[])
 {
@@ -135,8 +136,12 @@ void a_download_init (void)
        VikLayerParamData tmp;
        tmp.u = VIK_CONFIG_DEFAULT_TILE_AGE / 86400; // Now in days
        a_preferences_register(prefs, tmp, VIKING_PREFERENCES_GROUP_KEY);
        VikLayerParamData tmp;
        tmp.u = VIK_CONFIG_DEFAULT_TILE_AGE / 86400; // Now in days
        a_preferences_register(prefs, tmp, VIKING_PREFERENCES_GROUP_KEY);
+       file_list_mutex = vik_mutex_new();
+}
 
 
-       file_list_mutex = g_mutex_new();
+void a_download_uninit (void)
+{
+       vik_mutex_free(file_list_mutex);
 }
 
 static gboolean lock_file(const char *fn)
 }
 
 static gboolean lock_file(const char *fn)
@@ -361,7 +366,9 @@ static DownloadResult_t download( const char *hostname, const char *uri, const c
     utimes ( fn, NULL ); /* update mtime of local copy */
 #endif
   } else {
     utimes ( fn, NULL ); /* update mtime of local copy */
 #endif
   } else {
-    g_rename ( tmpfilename, fn ); /* move completely-downloaded file to permanent location */
+     /* move completely-downloaded file to permanent location */
+     if ( g_rename ( tmpfilename, fn ) )
+        g_warning ("%s: file rename failed [%s] to [%s]", __FUNCTION__, tmpfilename, fn );
   }
   unlock_file ( tmpfilename );
   g_free ( tmpfilename );
   }
   unlock_file ( tmpfilename );
   g_free ( tmpfilename );