-static int cylinder_changed;
-static GtkComboBox *cylinder_description;
-static GtkSpinButton *cylinder_size, *cylinder_pressure, *nitrox_value;
+struct cylinder_widget {
+ int index, changed;
+ const char *name;
+ GtkWidget *hbox;
+ GtkComboBox *description;
+ GtkSpinButton *size, *pressure;
+ GtkWidget *o2, *gasmix_button;
+};
+
+static struct cylinder_widget gtk_cylinder[MAX_CYLINDERS];
+
+static void set_cylinder_spinbuttons(struct cylinder_widget *cylinder, int ml, int mbar)
+{
+ double volume, pressure;
+
+ volume = ml / 1000.0;
+ pressure = mbar / 1000.0;
+ if (mbar) {
+ if (output_units.volume == CUFT) {
+ volume /= 28.3168466; /* Liters to cuft */
+ volume *= pressure / 1.01325;
+ }
+ if (output_units.pressure == PSI) {
+ pressure *= 14.5037738; /* Bar to PSI */
+ }
+ }
+
+ gtk_spin_button_set_value(cylinder->size, volume);
+ gtk_spin_button_set_value(cylinder->pressure, pressure);
+}