-/*************************
- * Deprecated site stuff *
- *************************/
-/* TODO: These update times functions are getting ugly... */
-static void update_times_gtk(AWeatherGui *self, GList *times)
-{
- gchar *last_time = NULL;
- GRegex *regex = g_regex_new("^[A-Z]{4}_([0-9]{8}_[0-9]{4})$", 0, 0, NULL); // KLSX_20090622_2113
- GMatchInfo *info;
-
- GtkTreeView *tview = GTK_TREE_VIEW(aweather_gui_get_widget(self, "main_time"));
- GtkListStore *lstore = GTK_LIST_STORE(gtk_tree_view_get_model(tview));
- gtk_list_store_clear(lstore);
- GtkTreeIter iter;
- times = g_list_reverse(times);
- for (GList *cur = times; cur; cur = cur->next) {
- if (g_regex_match(regex, cur->data, 0, &info)) {
- gchar *time = g_match_info_fetch(info, 1);
- gtk_list_store_insert(lstore, &iter, 0);
- gtk_list_store_set(lstore, &iter, 0, time, -1);
- last_time = time;
- }
- }
-
- gis_viewer_set_time(self->viewer, last_time);
-
- 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, GisViewer *viewer, char *site)
-{
- g_debug("AWeatherGui: update_times - site=%s", site);
- if (gis_viewer_get_offline(self->viewer)) {
- GList *times = NULL;
- gchar *path = g_build_filename(g_get_user_cache_dir(),
- "libgis", "nexrad", "level2", 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 *base = gis_prefs_get_string(self->prefs, "aweather/nexrad_url", NULL);
- gchar *local = g_strdup_printf("%s/dir.list", site);
- gchar *uri = g_strconcat(base, "/", local, NULL);
- gchar *path = gis_http_fetch(self->http, uri, local, GIS_REFRESH, NULL, NULL);
- update_times_online_cb(path, TRUE, self);
- /* update_times_gtk from update_times_online_cb */
- }
-}
-/* FIXME: This is redundent with the radar plugin
- * Make a shared wsr88d file? */
-static void on_gis_location_changed(GisViewer *viewer,
- gdouble lat, gdouble lon, gdouble elev,
- gpointer _self)
-{
- AWeatherGui *self = AWEATHER_GUI(_self);
- gdouble min_dist = EARTH_R / 5;
- city_t *city, *min_city = NULL;
- for (city = cities; city->type; city++) {
- if (city->type != LOCATION_CITY)
- continue;
- gdouble city_loc[3] = {};
- gdouble eye_loc[3] = {lat, lon, elev};
- lle2xyz(city->lat, city->lon, city->elev,
- &city_loc[0], &city_loc[1], &city_loc[2]);
- lle2xyz(lat, lon, elev,
- &eye_loc[0], &eye_loc[1], &eye_loc[2]);
- gdouble dist = distd(city_loc, eye_loc);
- if (dist < min_dist) {
- min_dist = dist;
- min_city = city;
- }
- }
- static city_t *last_city = NULL;
- if (min_city && min_city != last_city) {
- update_site_widget(self->viewer, min_city->code, self);
- update_times(self, viewer, min_city->code);
- }
- last_city = min_city;
-}
-static void on_gis_refresh(GisViewer *viewer, gpointer _self)
-{
- AWeatherGui *self = AWEATHER_GUI(_self);
- gdouble lat, lon, elev;
- gis_viewer_get_location(self->viewer, &lat, &lon, &elev);
- /* Hack to update times */
- on_gis_location_changed(self->viewer, lat, lon, elev, self);
-}
-
-