+ /* Clear existing items */
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN(config_body));
+ if (child)
+ gtk_widget_destroy(child);
+
+ GtkWidget *hbox = gtk_hbox_new(TRUE, 0);
+ GtkWidget *button = NULL;
+ int vi = 0, si = 0;
+ for (vi = 0; vi < radar->h.nvolumes; vi++) {
+ Volume *vol = radar->v[vi];
+ if (vol == NULL) continue;
+ GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+ for (si = vol->h.nsweeps-1; si >= 0; si--) {
+ Sweep *sweep = vol->sweep[si];
+ if (sweep == NULL) continue;
+ char *label = g_strdup_printf("Tilt: %.2f (%s)", sweep->h.elev, vol->h.type_str);
+ button = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(button), label);
+ g_object_set(button, "draw-indicator", FALSE, NULL);
+ g_signal_connect_swapped(button, "clicked", G_CALLBACK(load_color_table), vol->h.type_str);
+ g_signal_connect_swapped(button, "clicked", G_CALLBACK(load_sweep), sweep);
+ gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, TRUE, 0);
+ g_free(label);
+ }
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
+ }
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(config_body), hbox);
+ gtk_widget_show_all(hbox);
+}
+
+/* Load a radar from a file */
+static void load_radar_rsl(GPid pid, gint status, gpointer _path)
+{
+ gchar *path = _path;
+ if (status != 0) {
+ g_warning("wsr88ddec exited with status %d", status);
+ return;
+ }
+ char *site = g_path_get_basename(g_path_get_dirname(path));
+ RSL_read_these_sweeps("all", NULL);
+ if (radar) {
+ g_message("Freeing radar");
+ RSL_free_radar(radar);
+ }
+ g_message("Allocating radar");
+ radar = RSL_wsr88d_to_radar(path, site);
+ if (radar == NULL) {
+ g_warning("fail to load radar: path=%s, site=%s", path, site);
+ return;
+ }
+
+ /* Load the first sweep by default */
+ if (radar->h.nvolumes < 1 || radar->v[0]->h.nsweeps < 1) {
+ g_warning("No sweeps found\n");
+ } else {
+ /* load first available sweep */
+ for (int vi = 0; vi < radar->h.nvolumes; vi++) {
+ if (radar->v[vi]== NULL) continue;
+ for (int si = 0; si < radar->v[vi]->h.nsweeps; si++) {
+ if (radar->v[vi]->sweep[si]== NULL) continue;
+ load_color_table(radar->v[vi]->h.type_str);
+ load_sweep(radar->v[vi]->sweep[si]);
+ break;
+ }
+ break;
+ }
+ }
+
+ load_radar_gui(radar);