+ const char *desc = dive->cylinder[0].type.description;
+ GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(cylinder_description));
+
+ if (!desc)
+ return;
+ gtk_tree_model_foreach(model, match_cylinder, (gpointer)desc);
+}
+
+static GtkWidget *create_spinbutton(GtkWidget *vbox, const char *name)
+{
+ GtkWidget *frame, *button;
+
+ frame = gtk_frame_new(name);
+ gtk_container_add(GTK_CONTAINER(vbox), frame);
+
+ button = gtk_spin_button_new_with_range( 1.0, 3000, 0.1);
+ gtk_container_add(GTK_CONTAINER(frame), button);
+
+ return button;
+}
+
+static int get_cylinder_details(const char *name, int *volume, int *pressure)
+{
+ int result;
+ GtkWidget *dialog, *frame, *vbox;
+
+ dialog = gtk_dialog_new_with_buttons("New Cylinder Type",
+ GTK_WINDOW(main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ frame = gtk_frame_new(name);
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), frame);
+ vbox = gtk_vbox_new(TRUE, 6);
+ gtk_container_add(GTK_CONTAINER(frame), vbox);
+
+ create_spinbutton(vbox, "Size:");
+ create_spinbutton(vbox, "Working pressure:");
+
+ gtk_widget_show_all(dialog);
+ result = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+
+ *volume = 0;
+ *pressure = 0;
+ return result == GTK_RESPONSE_ACCEPT;
+}
+
+static void fill_cylinder_info(cylinder_t *cyl, const char *desc, int mliter, int mbar)
+{
+ /*
+ * The code is currently too broken to actually set anything,
+ * so just print what we would set
+ */
+ printf("Set cylinder to '%s': %.1f liter at %.1f bar working pressure\n",
+ desc, mliter / 1000.0, mbar / 1000.);
+#if 0
+ cyl->type.description = desc;
+ cyl->type.size.mliter = mliter;
+ cyl->type.workingpressure.mbar = mbar;
+#endif