- gtk_label_set_text(GTK_LABEL(depth), buffer);
-
- snprintf(buffer, sizeof(buffer),
- "%d min",
- dive->duration.seconds / 60);
- gtk_label_set_text(GTK_LABEL(duration), buffer);
-
- *buffer = 0;
- if (dive->watertemp.mkelvin) {
- switch (output_units.temperature) {
- case CELSIUS:
- snprintf(buffer, sizeof(buffer),
- "%d C",
- to_C(dive->watertemp));
- break;
- case FAHRENHEIT:
- snprintf(buffer, sizeof(buffer),
- "%d F",
- to_F(dive->watertemp));
- break;
- case KELVIN:
- snprintf(buffer, sizeof(buffer),
- "%d K",
- to_K(dive->watertemp));
- break;
- }
- }
- gtk_label_set_text(GTK_LABEL(temperature), buffer);
-
- text = dive->location ? : "";
- gtk_entry_set_text(location, text);
-
- text = "Dive Info";
- if (dive->location && *dive->location)
- text = dive->location;
- len = 0;
- if (dive->number)
- len = snprintf(buffer, sizeof(buffer), "%d. ", dive->number);
- snprintf(buffer+len, sizeof(buffer)-len, "%s", text);
- gtk_frame_set_label(GTK_FRAME(info_frame), buffer);
-
- text = dive->notes ? : "";
- gtk_text_buffer_set_text(notes, text, -1);
-}
-
-static GtkWidget *info_label(GtkWidget *box, const char *str, GtkJustification jtype)
-{
- GtkWidget *label = gtk_label_new(str);
- gtk_label_set_justify(GTK_LABEL(label), jtype);
- gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
- return label;
-}
-
-GtkWidget *dive_info_frame(void)
-{
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *vbox;
-
- frame = gtk_frame_new("Dive info");
- info_frame = frame;
- gtk_widget_show(frame);
-
- vbox = gtk_vbox_new(FALSE, 6);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 3);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- hbox = gtk_hbox_new(FALSE, 16);
- gtk_container_set_border_width(GTK_CONTAINER(hbox), 3);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
-
- divedate = info_label(hbox, "date", GTK_JUSTIFY_RIGHT);
- divetime = info_label(hbox, "time", GTK_JUSTIFY_RIGHT);
- depth = info_label(hbox, "depth", GTK_JUSTIFY_RIGHT);
- duration = info_label(hbox, "duration", GTK_JUSTIFY_RIGHT);
- temperature = info_label(hbox, "temperature", GTK_JUSTIFY_RIGHT);
-
- return frame;