X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fdata.h;h=f08f9365c335125abfa773eb29df70a1217cfbe4;hb=1ac2b7c2d9465293d168c33555a43862320b5c04;hp=994384bf76aa8d136360e3f6985d2fcf3b62e4db;hpb=721c55f22af98cf2fcc247169836e9b355a47104;p=aweather diff --git a/src/data.h b/src/data.h index 994384b..f08f936 100644 --- a/src/data.h +++ b/src/data.h @@ -18,8 +18,23 @@ #ifndef __DATA_H__ #define __DATA_H__ -typedef void (*AWeatherCacheDoneCallback)(gchar *file, gpointer user_data); +#include -void cache_file(char *base, char *path, AWeatherCacheDoneCallback callback, gpointer user_data); +typedef enum { + AWEATHER_ONCE, // Cache the file if it does not exist + AWEATHER_UPDATE, // Append additional data to cached copy (resume) + AWEATHER_REFRESH, // Delete existing file and cache a new copy +} AWeatherCacheType; + +typedef void (*AWeatherCacheDoneCallback)(gchar *file, gboolean updated, + gpointer user_data); + +typedef void (*AWeatherCacheChunkCallback)(gchar *file, goffset cur, + goffset total, gpointer user_data); + +SoupSession *cache_file(char *base, char *path, AWeatherCacheType update, + AWeatherCacheChunkCallback user_chunk_cb, + AWeatherCacheDoneCallback user_done_cb, + gpointer user_data); #endif