11 void show_dive_equipment(struct dive *dive)
15 void flush_dive_equipment_changes(struct dive *dive)
19 static struct tank_info {
21 int size; /* cuft or mliter depending on psi */
22 int psi; /* If zero, size is in mliter */
31 { "HP100", 100, 3442 },
32 { "HP119", 119, 3442 },
36 static void fill_tank_list(GtkListStore *store)
40 struct tank_info *info = tank_info;
43 int size = info->size;
45 int mbar = 0, ml = size;
47 /* Is it in cuft and psi? */
49 double bar = 0.0689475729 * psi;
50 double airvolume = 28316.8466 * size;
51 double atm = bar / 1.01325;
53 ml = airvolume / atm + 0.5;
54 mbar = bar*1000 + 0.5;
57 gtk_list_store_append(store, &iter);
58 gtk_list_store_set(store, &iter,
67 static void cylinder_widget(GtkWidget *box, int nr, GtkListStore *model)
69 GtkWidget *frame, *hbox, *size;
72 snprintf(buffer, sizeof(buffer), "Cylinder %d", nr);
73 frame = gtk_frame_new(buffer);
74 gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 0);
76 hbox = gtk_hbox_new(TRUE, 3);
77 gtk_container_add(GTK_CONTAINER(frame), hbox);
79 size = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
80 gtk_box_pack_start(GTK_BOX(hbox), size, FALSE, FALSE, 0);
83 static GtkListStore *create_tank_size_model(void)
87 model = gtk_list_store_new(3,
88 G_TYPE_STRING, /* Tank name */
89 G_TYPE_INT, /* Tank size in mliter */
90 G_TYPE_INT, /* Tank working pressure in mbar */
93 fill_tank_list(model);
97 GtkWidget *equipment_widget(void)
102 vbox = gtk_vbox_new(TRUE, 3);
104 model = create_tank_size_model();
105 cylinder_widget(vbox, 0, model);