+static void update_times_online_cb(char *path, gboolean updated, gpointer _self)
+{
+ GList *times = NULL;
+ gchar *data;
+ gsize length;
+ g_file_get_contents(path, &data, &length, NULL);
+ gchar **lines = g_strsplit(data, "\n", -1);
+ for (int i = 0; lines[i] && lines[i][0]; i++) {
+ char **parts = g_strsplit(lines[i], " ", 2);
+ times = g_list_prepend(times, g_strdup(parts[1]));
+ g_strfreev(parts);
+ }
+ g_strfreev(lines);
+ g_free(data);
+
+ update_times_gtk(_self, times);
+}
+static void update_times(AWeatherRadar *self, AWeatherView *view, char *site)
+{
+ if (aweather_view_get_offline(view)) {
+ GList *times = NULL;
+ gchar *path = g_build_filename(g_get_user_cache_dir(), PACKAGE, "nexrd2", "raw", site, NULL);
+ GDir *dir = g_dir_open(path, 0, NULL);
+ if (dir) {
+ const gchar *name;
+ while ((name = g_dir_read_name(dir))) {
+ times = g_list_prepend(times, g_strdup(name));
+ }
+ g_dir_close(dir);
+ }
+ g_free(path);
+ update_times_gtk(self, times);
+ } else {
+ gchar *path = g_strdup_printf("nexrd2/raw/%s/dir.list", site);
+ cache_file(nexrad_base, path, AWEATHER_REFRESH, NULL, update_times_online_cb, self);
+ /* update_times_gtk from update_times_online_cb */
+ }
+}