+ g_regex_unref(regex);
+ g_list_foreach(times, (GFunc)g_free, NULL);
+ g_list_free(times);
+}
+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(AWeatherGui *self, GisView *view, char *site)
+{
+ g_debug("AWeatherGui: update_times - site=%s", site);
+ if (gis_world_get_offline(self->world)) {
+ 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);
+ char *base = gis_prefs_get_string(self->prefs, "aweather/nexrad_url");
+ cache_file(base, path, GIS_REFRESH, NULL, update_times_online_cb, self);
+ /* update_times_gtk from update_times_online_cb */
+ }
+}
+static void on_gis_site_changed(GisView *view, char *site, gpointer _self)
+{
+ AWeatherGui *self = AWEATHER_GUI(_self);
+ g_debug("AWeatherGui: on_site_changed - Loading wsr88d list for %s", site);
+ update_times(self, view, site);
+}
+static void on_gis_refresh(GisWorld *world, gpointer _self)
+{
+ AWeatherGui *self = AWEATHER_GUI(_self);
+ char *site = gis_view_get_site(self->view);
+ update_times(self, self->view, site);
+}