2 /* creates the UI for the equipment page -
3 * controlled through the following interfaces:
5 * void show_dive_equipment(struct dive *dive)
6 * void flush_dive_equipment_changes(struct dive *dive)
9 * GtkWidget *equipment_widget(void)
19 #include "display-gtk.h"
22 static GtkListStore *cylinder_model;
39 GtkWidget *edit, *add, *del;
40 GtkTreeViewColumn *desc, *size, *workp, *startp, *endp, *o2, *he;
43 struct cylinder_widget {
47 GtkComboBox *description;
48 GtkSpinButton *size, *pressure, *start, *end;
49 GtkWidget *o2, *gasmix_button;
52 static int convert_pressure(int mbar, double *p)
57 pressure = mbar / 1000.0;
59 if (output_units.pressure == PSI) {
60 pressure *= 14.5037738; /* Bar to PSI */
68 static int convert_volume_pressure(int ml, int mbar, double *v, double *p)
71 double volume, pressure;
74 pressure = mbar / 1000.0;
76 if (output_units.volume == CUFT) {
77 volume /= 28.3168466; /* Liters to cuft */
78 volume *= pressure / 1.01325;
80 if (output_units.pressure == PSI) {
81 pressure *= 14.5037738; /* Bar to PSI */
90 static void set_cylinder_type_spinbuttons(struct cylinder_widget *cylinder, int ml, int mbar)
92 double volume, pressure;
94 convert_volume_pressure(ml, mbar, &volume, &pressure);
95 gtk_spin_button_set_value(cylinder->size, volume);
96 gtk_spin_button_set_value(cylinder->pressure, pressure);
99 static void set_cylinder_pressure_spinbuttons(struct cylinder_widget *cylinder, int start, int end)
103 convert_pressure(start, &pressure);
104 gtk_spin_button_set_value(cylinder->start, pressure);
105 convert_pressure(end, &pressure);
106 gtk_spin_button_set_value(cylinder->end, pressure);
109 static void cylinder_cb(GtkComboBox *combo_box, gpointer data)
112 GtkTreeModel *model = gtk_combo_box_get_model(combo_box);
114 struct cylinder_widget *cylinder = data;
115 cylinder_t *cyl = current_dive->cylinder + cylinder->index;
117 /* Did the user set it to some non-standard value? */
118 if (!gtk_combo_box_get_active_iter(combo_box, &iter)) {
119 cylinder->changed = 1;
124 * We get "change" signal callbacks just because we set
125 * the description by hand. Whatever. So ignore them if
128 if (!cylinder->changed && cyl->type.description) {
130 char *desc = gtk_combo_box_get_active_text(combo_box);
132 same = !strcmp(desc, cyl->type.description);
137 cylinder->changed = 1;
139 gtk_tree_model_get(model, &iter,
144 set_cylinder_type_spinbuttons(cylinder, ml, mbar);
148 * The gtk_tree_model_foreach() interface is bad. It could have
149 * returned whether the callback ever returned true
151 static GtkTreeIter *found_match = NULL;
152 static GtkTreeIter match_iter;
154 static gboolean match_cylinder(GtkTreeModel *model,
160 const char *desc = data;
161 GValue value = {0, };
163 gtk_tree_model_get_value(model, iter, 0, &value);
164 name = g_value_get_string(&value);
165 if (strcmp(desc, name))
168 found_match = &match_iter;
172 static GtkTreeIter *add_cylinder_type(const char *desc, int ml, int mbar, GtkTreeIter *iter)
176 /* Don't even bother adding stuff without a size */
181 model = GTK_TREE_MODEL(cylinder_model);
182 gtk_tree_model_foreach(model, match_cylinder, (void *)desc);
185 GtkListStore *store = GTK_LIST_STORE(model);
187 gtk_list_store_append(store, iter);
188 gtk_list_store_set(store, iter,
199 * When adding a dive, we'll add all the pre-existing cylinder
200 * information from that dive to our cylinder model.
202 void add_cylinder_description(cylinder_type_t *type)
206 unsigned int size, workp;
208 desc = type->description;
211 size = type->size.mliter;
212 workp = type->workingpressure.mbar;
213 add_cylinder_type(desc, size, workp, &iter);
216 static void add_cylinder(struct cylinder_widget *cylinder, const char *desc, int ml, int mbar)
218 GtkTreeIter iter, *match;
220 cylinder->name = desc;
221 match = add_cylinder_type(desc, ml, mbar, &iter);
223 gtk_combo_box_set_active_iter(cylinder->description, match);
226 static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder)
232 /* Don't show uninitialized cylinder widgets */
233 if (!cylinder->description)
236 desc = cyl->type.description;
239 ml = cyl->type.size.mliter;
240 mbar = cyl->type.workingpressure.mbar;
241 add_cylinder(cylinder, desc, ml, mbar);
243 set_cylinder_type_spinbuttons(cylinder,
244 cyl->type.size.mliter, cyl->type.workingpressure.mbar);
245 set_cylinder_pressure_spinbuttons(cylinder,
246 cyl->start.mbar, cyl->end.mbar);
247 o2 = cyl->gasmix.o2.permille / 10.0;
248 gtk_widget_set_sensitive(cylinder->o2, !!o2);
249 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button), !!o2);
252 gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2);
255 static int cyl_nothing(cylinder_t *cyl)
257 return !cyl->type.size.mliter &&
258 !cyl->type.workingpressure.mbar &&
259 !cyl->type.description &&
260 !cyl->gasmix.o2.permille &&
261 !cyl->gasmix.he.permille &&
266 static void set_one_cylinder(int index, cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter)
268 gtk_list_store_set(model, iter,
269 CYL_DESC, cyl->type.description ? : "",
270 CYL_SIZE, cyl->type.size.mliter,
271 CYL_WORKP, cyl->type.workingpressure.mbar,
272 CYL_STARTP, cyl->start.mbar,
273 CYL_ENDP, cyl->end.mbar,
274 CYL_O2, cyl->gasmix.o2.permille,
275 CYL_HE, cyl->gasmix.he.permille,
279 void show_dive_equipment(struct dive *dive)
285 model = cylinder_list.model;
286 gtk_list_store_clear(model);
289 cylinder_t *cyl = &dive->cylinder[max-1];
291 if (!cyl_nothing(cyl))
295 cylinder_list.max_index = max;
297 gtk_widget_set_sensitive(cylinder_list.edit, 0);
298 gtk_widget_set_sensitive(cylinder_list.del, 0);
299 gtk_widget_set_sensitive(cylinder_list.add, max < MAX_CYLINDERS);
301 for (i = 0; i < max; i++) {
302 cylinder_t *cyl = dive->cylinder+i;
304 gtk_list_store_append(model, &iter);
305 set_one_cylinder(i, cyl, model, &iter);
309 static GtkWidget *create_spinbutton(GtkWidget *vbox, const char *name, double min, double max, double incr)
311 GtkWidget *frame, *hbox, *button;
313 frame = gtk_frame_new(name);
314 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, FALSE, 0);
316 hbox = gtk_hbox_new(FALSE, 3);
317 gtk_container_add(GTK_CONTAINER(frame), hbox);
319 button = gtk_spin_button_new_with_range(min, max, incr);
320 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
322 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
327 static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl, const char *desc,
328 double volume, double pressure, double start, double end, int o2)
332 if (output_units.pressure == PSI) {
333 pressure /= 14.5037738;
338 if (pressure && output_units.volume == CUFT) {
339 volume *= 28.3168466; /* CUFT to liter */
340 volume /= pressure / 1.01325;
343 ml = volume * 1000 + 0.5;
344 mbar = pressure * 1000 + 0.5;
348 cyl->type.description = desc;
349 cyl->type.size.mliter = ml;
350 cyl->type.workingpressure.mbar = mbar;
351 cyl->start.mbar = start * 1000 + 0.5;
352 cyl->end.mbar = end * 1000 + 0.5;
353 cyl->gasmix.o2.permille = o2;
356 * Also, insert it into the model if it doesn't already exist
358 add_cylinder(cylinder, desc, ml, mbar);
361 static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cylinder)
365 double volume, pressure, start, end;
368 /* Ignore uninitialized cylinder widgets */
369 box = cylinder->description;
373 desc = gtk_combo_box_get_active_text(box);
374 volume = gtk_spin_button_get_value(cylinder->size);
375 pressure = gtk_spin_button_get_value(cylinder->pressure);
376 start = gtk_spin_button_get_value(cylinder->start);
377 end = gtk_spin_button_get_value(cylinder->end);
378 o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
379 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
381 fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
384 void flush_dive_equipment_changes(struct dive *dive)
386 /* We do nothing: we require the "Ok" button press */
390 * We hardcode the most common standard cylinders,
391 * we should pick up any other names from the dive
394 static struct tank_info {
396 int size; /* cuft if < 1000, otherwise mliter */
397 int psi; /* If zero, size is in mliter */
399 /* Need an empty entry for the no-cylinder case */
402 /* Size-only metric cylinders */
406 /* Most common AL cylinders */
407 { "AL50", 50, 3000 },
408 { "AL63", 63, 3000 },
409 { "AL72", 72, 3000 },
410 { "AL80", 80, 3000 },
411 { "AL100", 100, 3300 },
413 /* Somewhat common LP steel cylinders */
414 { "LP85", 85, 2640 },
415 { "LP95", 95, 2640 },
416 { "LP108", 108, 2640 },
417 { "LP121", 121, 2640 },
419 /* Somewhat common HP steel cylinders */
420 { "HP65", 65, 3442 },
421 { "HP80", 80, 3442 },
422 { "HP100", 100, 3442 },
423 { "HP119", 119, 3442 },
424 { "HP130", 130, 3442 },
426 /* We'll fill in more from the dive log dynamically */
430 static void fill_tank_list(GtkListStore *store)
433 struct tank_info *info = tank_info;
436 int size = info->size;
438 int mbar = 0, ml = size;
440 /* Is it in cuft and psi? */
442 double bar = 0.0689475729 * psi;
443 double airvolume = 28316.8466 * size;
444 double atm = bar / 1.01325;
446 ml = airvolume / atm + 0.5;
447 mbar = bar*1000 + 0.5;
450 gtk_list_store_append(store, &iter);
451 gtk_list_store_set(store, &iter,
460 static void nitrox_cb(GtkToggleButton *button, gpointer data)
462 struct cylinder_widget *cylinder = data;
465 state = gtk_toggle_button_get_active(button);
466 gtk_widget_set_sensitive(cylinder->o2, state);
469 static gboolean completion_cb(GtkEntryCompletion *widget, GtkTreeModel *model, GtkTreeIter *iter, struct cylinder_widget *cylinder)
472 unsigned int ml, mbar;
474 gtk_tree_model_get(model, iter, CYL_DESC, &desc, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
475 add_cylinder(cylinder, desc, ml, mbar);
479 static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, GtkListStore *model)
481 GtkWidget *frame, *hbox;
483 GtkEntryCompletion *completion;
487 * Cylinder type: description, size and
490 frame = gtk_frame_new("Cylinder");
492 hbox = gtk_hbox_new(FALSE, 3);
493 gtk_container_add(GTK_CONTAINER(frame), hbox);
495 widget = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
496 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
498 cylinder->description = GTK_COMBO_BOX(widget);
499 g_signal_connect(widget, "changed", G_CALLBACK(cylinder_cb), cylinder);
501 entry = GTK_ENTRY(GTK_BIN(widget)->child);
502 completion = gtk_entry_completion_new();
503 gtk_entry_completion_set_text_column(completion, 0);
504 gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(model));
505 g_signal_connect(completion, "match-selected", G_CALLBACK(completion_cb), cylinder);
506 gtk_entry_set_completion(entry, completion);
508 hbox = gtk_hbox_new(FALSE, 3);
509 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
510 gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);
512 widget = create_spinbutton(hbox, "Size", 0, 300, 0.1);
513 cylinder->size = GTK_SPIN_BUTTON(widget);
515 widget = create_spinbutton(hbox, "Pressure", 0, 5000, 1);
516 cylinder->pressure = GTK_SPIN_BUTTON(widget);
519 * Cylinder start/end pressures
521 hbox = gtk_hbox_new(FALSE, 3);
522 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
524 widget = create_spinbutton(hbox, "Start Pressure", 0, 5000, 1);
525 cylinder->start = GTK_SPIN_BUTTON(widget);
527 widget = create_spinbutton(hbox, "End Pressure", 0, 5000, 1);
528 cylinder->end = GTK_SPIN_BUTTON(widget);
531 * Cylinder gas mix: Air, Nitrox or Trimix
533 hbox = gtk_hbox_new(FALSE, 3);
534 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
536 widget = create_spinbutton(hbox, "Nitrox", 21, 100, 0.1);
537 cylinder->o2 = widget;
538 cylinder->gasmix_button = gtk_check_button_new();
539 gtk_box_pack_start(GTK_BOX(gtk_widget_get_parent(cylinder->o2)),
540 cylinder->gasmix_button, FALSE, FALSE, 3);
541 g_signal_connect(cylinder->gasmix_button, "toggled", G_CALLBACK(nitrox_cb), cylinder);
543 gtk_spin_button_set_range(GTK_SPIN_BUTTON(cylinder->o2), 21.0, 100.0);
546 static int edit_cylinder_dialog(int index, cylinder_t *cyl)
549 GtkWidget *dialog, *vbox;
550 struct cylinder_widget cylinder;
553 cylinder.index = index;
554 cylinder.changed = 0;
559 *cyl = dive->cylinder[index];
561 dialog = gtk_dialog_new_with_buttons("Cylinder",
562 GTK_WINDOW(main_window),
563 GTK_DIALOG_DESTROY_WITH_PARENT,
564 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
565 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
568 vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
569 cylinder_widget(vbox, &cylinder, cylinder_model);
571 show_cylinder(cyl, &cylinder);
573 gtk_widget_show_all(dialog);
574 success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
576 record_cylinder_changes(cyl, &cylinder);
577 dive->cylinder[index] = *cyl;
578 mark_divelist_changed(TRUE);
579 flush_divelist(dive);
582 gtk_widget_destroy(dialog);
587 static int get_model_index(GtkListStore *model, GtkTreeIter *iter)
592 path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
593 p = gtk_tree_path_get_indices(path);
595 gtk_tree_path_free(path);
599 static void edit_cb(GtkButton *button, gpointer data)
603 GtkListStore *model = cylinder_list.model;
604 GtkTreeSelection *selection;
607 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
609 /* Nothing selected? This shouldn't happen, since the button should be inactive */
610 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
613 index = get_model_index(model, &iter);
614 if (!edit_cylinder_dialog(index, &cyl))
617 set_one_cylinder(index, &cyl, model, &iter);
621 static void add_cb(GtkButton *button, gpointer data)
623 int index = cylinder_list.max_index;
625 GtkListStore *model = cylinder_list.model;
626 GtkTreeSelection *selection;
629 if (!edit_cylinder_dialog(index, &cyl))
632 gtk_list_store_append(model, &iter);
633 set_one_cylinder(index, &cyl, model, &iter);
635 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
636 gtk_tree_selection_select_iter(selection, &iter);
638 cylinder_list.max_index++;
639 gtk_widget_set_sensitive(cylinder_list.add, cylinder_list.max_index < MAX_CYLINDERS);
642 static void del_cb(GtkButton *button, gpointer data)
646 GtkListStore *model = cylinder_list.model;
647 GtkTreeSelection *selection;
651 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
653 /* Nothing selected? This shouldn't happen, since the button should be inactive */
654 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
657 index = get_model_index(model, &iter);
662 cyl = dive->cylinder + index;
663 nr = cylinder_list.max_index - index - 1;
665 gtk_list_store_remove(model, &iter);
667 cylinder_list.max_index--;
668 memmove(cyl, cyl+1, nr*sizeof(*cyl));
669 memset(cyl+nr, 0, sizeof(*cyl));
671 mark_divelist_changed(TRUE);
672 flush_divelist(dive);
674 gtk_widget_set_sensitive(cylinder_list.edit, 0);
675 gtk_widget_set_sensitive(cylinder_list.del, 0);
676 gtk_widget_set_sensitive(cylinder_list.add, 1);
679 static GtkListStore *create_tank_size_model(void)
683 model = gtk_list_store_new(3,
684 G_TYPE_STRING, /* Tank name */
685 G_TYPE_INT, /* Tank size in mliter */
686 G_TYPE_INT, /* Tank working pressure in mbar */
689 fill_tank_list(model);
693 static void size_data_func(GtkTreeViewColumn *col,
694 GtkCellRenderer *renderer,
700 double size, pressure;
703 gtk_tree_model_get(model, iter, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
704 convert_volume_pressure(ml, mbar, &size, &pressure);
706 snprintf(buffer, sizeof(buffer), "%.1f", size);
708 strcpy(buffer, "unkn");
709 g_object_set(renderer, "text", buffer, NULL);
712 static void pressure_data_func(GtkTreeViewColumn *col,
713 GtkCellRenderer *renderer,
718 int index = (long)data;
723 gtk_tree_model_get(model, iter, index, &mbar, -1);
724 decimals = convert_pressure(mbar, &pressure);
726 snprintf(buffer, sizeof(buffer), "%.*f", decimals, pressure);
729 g_object_set(renderer, "text", buffer, NULL);
732 static void percentage_data_func(GtkTreeViewColumn *col,
733 GtkCellRenderer *renderer,
738 int index = (long)data;
742 gtk_tree_model_get(model, iter, index, &permille, -1);
744 snprintf(buffer, sizeof(buffer), "%.1f%%", permille / 10.0);
747 g_object_set(renderer, "text", buffer, NULL);
750 static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model)
755 selected = gtk_tree_selection_get_selected(selection, NULL, &iter);
756 gtk_widget_set_sensitive(cylinder_list.edit, selected);
757 gtk_widget_set_sensitive(cylinder_list.del, selected);
760 static void row_activated_cb(GtkTreeView *tree_view,
762 GtkTreeViewColumn *column,
768 static GtkWidget *cylinder_list_create(void)
770 GtkWidget *tree_view;
771 GtkTreeSelection *selection;
774 model = gtk_list_store_new(CYL_COLUMNS,
775 G_TYPE_STRING, /* CYL_DESC: utf8 */
776 G_TYPE_INT, /* CYL_SIZE: mliter */
777 G_TYPE_INT, /* CYL_WORKP: mbar */
778 G_TYPE_INT, /* CYL_STARTP: mbar */
779 G_TYPE_INT, /* CYL_ENDP: mbar */
780 G_TYPE_INT, /* CYL_O2: permille */
781 G_TYPE_INT /* CYL_HE: permille */
783 cylinder_list.model = model;
784 tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
785 g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), model);
787 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
788 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_BROWSE);
789 g_signal_connect(selection, "changed", G_CALLBACK(selection_cb), model);
791 g_object_set(G_OBJECT(tree_view), "headers-visible", TRUE,
792 "enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH,
795 cylinder_list.desc = tree_view_column(tree_view, CYL_DESC, "Type", NULL, PANGO_ALIGN_LEFT, TRUE);
796 cylinder_list.size = tree_view_column(tree_view, CYL_SIZE, "Size", size_data_func, PANGO_ALIGN_RIGHT, TRUE);
797 cylinder_list.workp = tree_view_column(tree_view, CYL_WORKP, "MaxPress", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
798 cylinder_list.startp = tree_view_column(tree_view, CYL_STARTP, "Start", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
799 cylinder_list.endp = tree_view_column(tree_view, CYL_ENDP, "End", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
800 cylinder_list.o2 = tree_view_column(tree_view, CYL_O2, "O" UTF8_SUBSCRIPT_2 "%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
801 cylinder_list.he = tree_view_column(tree_view, CYL_HE, "He%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
805 GtkWidget *equipment_widget(void)
807 GtkWidget *vbox, *hbox, *frame, *framebox;
808 GtkWidget *add, *del, *edit;
810 vbox = gtk_vbox_new(FALSE, 3);
813 * We create the cylinder size model at startup, since
814 * we're going to share it across all cylinders and all
815 * dives. So if you add a new cylinder type in one dive,
816 * it will show up when you edit the cylinder types for
819 cylinder_model = create_tank_size_model();
821 cylinder_list.tree_view = cylinder_list_create();
823 hbox = gtk_hbox_new(FALSE, 3);
824 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
826 frame = gtk_frame_new("Cylinders");
827 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, FALSE, 3);
829 framebox = gtk_vbox_new(FALSE, 3);
830 gtk_container_add(GTK_CONTAINER(frame), framebox);
832 hbox = gtk_hbox_new(FALSE, 3);
833 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
835 gtk_box_pack_start(GTK_BOX(hbox), cylinder_list.tree_view, TRUE, FALSE, 3);
837 hbox = gtk_hbox_new(TRUE, 3);
838 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
840 edit = gtk_button_new_from_stock(GTK_STOCK_EDIT);
841 add = gtk_button_new_from_stock(GTK_STOCK_ADD);
842 del = gtk_button_new_from_stock(GTK_STOCK_DELETE);
843 gtk_box_pack_start(GTK_BOX(hbox), edit, FALSE, FALSE, 0);
844 gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0);
845 gtk_box_pack_start(GTK_BOX(hbox), del, FALSE, FALSE, 0);
847 cylinder_list.edit = edit;
848 cylinder_list.add = add;
849 cylinder_list.del = del;
851 g_signal_connect(edit, "clicked", G_CALLBACK(edit_cb), NULL);
852 g_signal_connect(add, "clicked", G_CALLBACK(add_cb), NULL);
853 g_signal_connect(del, "clicked", G_CALLBACK(del_cb), NULL);