static GtkWidget *info_frame;
static GtkWidget *divedate, *divetime, *depth, *duration, *temperature;
-static GtkEntry *location;
+static GtkEntry *location, *buddy, *divemaster;
static GtkTextBuffer *notes;
static int location_changed = 1, notes_changed = 1;
+static int divemaster_changed = 1, buddy_changed = 1;
static const char *weekday(int wday)
{
dive->location = gtk_editable_get_chars(GTK_EDITABLE(location), 0, -1);
}
+ if (divemaster_changed) {
+ g_free(dive->divemaster);
+ dive->divemaster = gtk_editable_get_chars(GTK_EDITABLE(divemaster), 0, -1);
+ }
+
+ if (buddy_changed) {
+ g_free(dive->buddy);
+ dive->buddy = gtk_editable_get_chars(GTK_EDITABLE(buddy), 0, -1);
+ }
+
if (notes_changed) {
g_free(dive->notes);
dive->notes = get_text(notes);
text = dive->location ? : "";
gtk_entry_set_text(location, text);
+ text = dive->divemaster ? : "";
+ gtk_entry_set_text(divemaster, text);
+
+ text = dive->buddy ? : "";
+ gtk_entry_set_text(buddy, text);
+
text = "Dive Info";
if (dive->location && *dive->location)
text = dive->location;
GtkWidget *extended_dive_info_widget(void)
{
- GtkWidget *vbox;
+ GtkWidget *vbox, *hbox;
vbox = gtk_vbox_new(FALSE, 6);
- location = text_entry(vbox, "Location");
gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
+ location = text_entry(vbox, "Location");
+
+ hbox = gtk_hbox_new(FALSE, 3);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
+
+ divemaster = text_entry(hbox, "Divemaster");
+ buddy = text_entry(hbox, "Buddy");
+
notes = text_view(vbox, "Notes");
/* Add extended info here: name, description, yadda yadda */
MATCH(".tanksize", cylindersize, &dive->cylinder[0].type.size) ||
MATCH(".presw", pressure, &dive->cylinder[0].type.workingpressure) ||
MATCH(".comments", utf8_string, &dive->notes) ||
+ MATCH(".buddy.names", utf8_string, &dive->buddy) ||
MATCH(".country.name", utf8_string, &country) ||
MATCH(".city.name", utf8_string, &city) ||
MATCH(".place.name", divinglog_place, &dive->location) ||
return;
if (MATCH(".notes", utf8_string, &dive->notes))
return;
+ if (MATCH(".divemaster", utf8_string, &dive->divemaster))
+ return;
+ if (MATCH(".buddy", utf8_string, &dive->buddy))
+ return;
if (MATCH(".cylinder.size", cylindersize, &dive->cylinder[cylinder_index].type.size))
return;
save_temperatures(f, dive);
show_duration(f, dive->surfacetime, " <surfacetime>", "</surfacetime>\n");
show_utf8(f, dive->location, " <location>","</location>\n");
+ show_utf8(f, dive->divemaster, " <divemaster>","</divemaster>\n");
+ show_utf8(f, dive->buddy, " <buddy>","</buddy>\n");
show_utf8(f, dive->notes, " <notes>","</notes>\n");
}