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);
110 * The gtk_tree_model_foreach() interface is bad. It could have
111 * returned whether the callback ever returned true
113 static GtkTreeIter *found_match = NULL;
114 static GtkTreeIter match_iter;
116 static gboolean match_cylinder(GtkTreeModel *model,
123 const char *desc = data;
125 gtk_tree_model_get(model, iter, 0, &name, -1);
126 match = !strcmp(desc, name);
130 found_match = &match_iter;
135 static int get_active_cylinder(GtkComboBox *combo_box, GtkTreeIter *iter)
139 if (gtk_combo_box_get_active_iter(combo_box, iter))
142 desc = gtk_combo_box_get_active_text(combo_box);
145 gtk_tree_model_foreach(GTK_TREE_MODEL(cylinder_model), match_cylinder, (void *)desc);
151 *iter = *found_match;
152 gtk_combo_box_set_active_iter(combo_box, iter);
156 static void cylinder_cb(GtkComboBox *combo_box, gpointer data)
159 GtkTreeModel *model = gtk_combo_box_get_model(combo_box);
161 struct cylinder_widget *cylinder = data;
162 cylinder_t *cyl = current_dive->cylinder + cylinder->index;
164 /* Did the user set it to some non-standard value? */
165 if (!get_active_cylinder(combo_box, &iter)) {
166 cylinder->changed = 1;
171 * We get "change" signal callbacks just because we set
172 * the description by hand. Whatever. So ignore them if
175 if (!cylinder->changed && cyl->type.description) {
177 char *desc = gtk_combo_box_get_active_text(combo_box);
179 same = !strcmp(desc, cyl->type.description);
184 cylinder->changed = 1;
186 gtk_tree_model_get(model, &iter,
191 set_cylinder_type_spinbuttons(cylinder, ml, mbar);
194 static GtkTreeIter *add_cylinder_type(const char *desc, int ml, int mbar, GtkTreeIter *iter)
198 /* Don't even bother adding stuff without a size */
203 model = GTK_TREE_MODEL(cylinder_model);
204 gtk_tree_model_foreach(model, match_cylinder, (void *)desc);
207 GtkListStore *store = GTK_LIST_STORE(model);
209 gtk_list_store_append(store, iter);
210 gtk_list_store_set(store, iter,
221 * When adding a dive, we'll add all the pre-existing cylinder
222 * information from that dive to our cylinder model.
224 void add_cylinder_description(cylinder_type_t *type)
228 unsigned int size, workp;
230 desc = type->description;
233 size = type->size.mliter;
234 workp = type->workingpressure.mbar;
235 add_cylinder_type(desc, size, workp, &iter);
238 static void add_cylinder(struct cylinder_widget *cylinder, const char *desc, int ml, int mbar)
240 GtkTreeIter iter, *match;
242 cylinder->name = desc;
243 match = add_cylinder_type(desc, ml, mbar, &iter);
245 gtk_combo_box_set_active_iter(cylinder->description, match);
248 static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder)
254 /* Don't show uninitialized cylinder widgets */
255 if (!cylinder->description)
258 desc = cyl->type.description;
261 ml = cyl->type.size.mliter;
262 mbar = cyl->type.workingpressure.mbar;
263 add_cylinder(cylinder, desc, ml, mbar);
265 set_cylinder_type_spinbuttons(cylinder,
266 cyl->type.size.mliter, cyl->type.workingpressure.mbar);
267 set_cylinder_pressure_spinbuttons(cylinder,
268 cyl->start.mbar, cyl->end.mbar);
269 o2 = cyl->gasmix.o2.permille / 10.0;
270 gtk_widget_set_sensitive(cylinder->o2, !!o2);
271 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button), !!o2);
274 gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2);
277 static int cyl_nothing(cylinder_t *cyl)
279 return !cyl->type.size.mliter &&
280 !cyl->type.workingpressure.mbar &&
281 !cyl->type.description &&
282 !cyl->gasmix.o2.permille &&
283 !cyl->gasmix.he.permille &&
288 static void set_one_cylinder(int index, cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter)
290 gtk_list_store_set(model, iter,
291 CYL_DESC, cyl->type.description ? : "",
292 CYL_SIZE, cyl->type.size.mliter,
293 CYL_WORKP, cyl->type.workingpressure.mbar,
294 CYL_STARTP, cyl->start.mbar,
295 CYL_ENDP, cyl->end.mbar,
296 CYL_O2, cyl->gasmix.o2.permille,
297 CYL_HE, cyl->gasmix.he.permille,
301 void show_dive_equipment(struct dive *dive)
307 model = cylinder_list.model;
308 gtk_list_store_clear(model);
311 cylinder_t *cyl = &dive->cylinder[max-1];
313 if (!cyl_nothing(cyl))
317 cylinder_list.max_index = max;
319 gtk_widget_set_sensitive(cylinder_list.edit, 0);
320 gtk_widget_set_sensitive(cylinder_list.del, 0);
321 gtk_widget_set_sensitive(cylinder_list.add, max < MAX_CYLINDERS);
323 for (i = 0; i < max; i++) {
324 cylinder_t *cyl = dive->cylinder+i;
326 gtk_list_store_append(model, &iter);
327 set_one_cylinder(i, cyl, model, &iter);
331 static GtkWidget *create_spinbutton(GtkWidget *vbox, const char *name, double min, double max, double incr)
333 GtkWidget *frame, *hbox, *button;
335 frame = gtk_frame_new(name);
336 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, FALSE, 0);
338 hbox = gtk_hbox_new(FALSE, 3);
339 gtk_container_add(GTK_CONTAINER(frame), hbox);
341 button = gtk_spin_button_new_with_range(min, max, incr);
342 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
344 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
349 static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl, const char *desc,
350 double volume, double pressure, double start, double end, int o2)
354 if (output_units.pressure == PSI) {
355 pressure /= 14.5037738;
360 if (pressure && output_units.volume == CUFT) {
361 volume *= 28.3168466; /* CUFT to liter */
362 volume /= pressure / 1.01325;
365 ml = volume * 1000 + 0.5;
366 mbar = pressure * 1000 + 0.5;
370 cyl->type.description = desc;
371 cyl->type.size.mliter = ml;
372 cyl->type.workingpressure.mbar = mbar;
373 cyl->start.mbar = start * 1000 + 0.5;
374 cyl->end.mbar = end * 1000 + 0.5;
375 cyl->gasmix.o2.permille = o2;
378 * Also, insert it into the model if it doesn't already exist
380 add_cylinder(cylinder, desc, ml, mbar);
383 static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cylinder)
387 double volume, pressure, start, end;
390 /* Ignore uninitialized cylinder widgets */
391 box = cylinder->description;
395 desc = gtk_combo_box_get_active_text(box);
396 volume = gtk_spin_button_get_value(cylinder->size);
397 pressure = gtk_spin_button_get_value(cylinder->pressure);
398 start = gtk_spin_button_get_value(cylinder->start);
399 end = gtk_spin_button_get_value(cylinder->end);
400 o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
401 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
403 fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
406 void flush_dive_equipment_changes(struct dive *dive)
408 /* We do nothing: we require the "Ok" button press */
412 * We hardcode the most common standard cylinders,
413 * we should pick up any other names from the dive
416 static struct tank_info {
418 int size; /* cuft if < 1000, otherwise mliter */
419 int psi; /* If zero, size is in mliter */
421 /* Need an empty entry for the no-cylinder case */
424 /* Size-only metric cylinders */
428 /* Most common AL cylinders */
429 { "AL50", 50, 3000 },
430 { "AL63", 63, 3000 },
431 { "AL72", 72, 3000 },
432 { "AL80", 80, 3000 },
433 { "AL100", 100, 3300 },
435 /* Somewhat common LP steel cylinders */
436 { "LP85", 85, 2640 },
437 { "LP95", 95, 2640 },
438 { "LP108", 108, 2640 },
439 { "LP121", 121, 2640 },
441 /* Somewhat common HP steel cylinders */
442 { "HP65", 65, 3442 },
443 { "HP80", 80, 3442 },
444 { "HP100", 100, 3442 },
445 { "HP119", 119, 3442 },
446 { "HP130", 130, 3442 },
448 /* We'll fill in more from the dive log dynamically */
452 static void fill_tank_list(GtkListStore *store)
455 struct tank_info *info = tank_info;
458 int size = info->size;
460 int mbar = 0, ml = size;
462 /* Is it in cuft and psi? */
464 double bar = 0.0689475729 * psi;
465 double airvolume = 28316.8466 * size;
466 double atm = bar / 1.01325;
468 ml = airvolume / atm + 0.5;
469 mbar = bar*1000 + 0.5;
472 gtk_list_store_append(store, &iter);
473 gtk_list_store_set(store, &iter,
482 static void nitrox_cb(GtkToggleButton *button, gpointer data)
484 struct cylinder_widget *cylinder = data;
487 state = gtk_toggle_button_get_active(button);
488 gtk_widget_set_sensitive(cylinder->o2, state);
491 static gboolean completion_cb(GtkEntryCompletion *widget, GtkTreeModel *model, GtkTreeIter *iter, struct cylinder_widget *cylinder)
494 unsigned int ml, mbar;
496 gtk_tree_model_get(model, iter, CYL_DESC, &desc, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
497 add_cylinder(cylinder, desc, ml, mbar);
501 static void cylinder_activate_cb(GtkComboBox *combo_box, gpointer data)
503 struct cylinder_widget *cylinder = data;
504 cylinder_cb(cylinder->description, data);
507 static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, GtkListStore *model)
509 GtkWidget *frame, *hbox;
511 GtkEntryCompletion *completion;
515 * Cylinder type: description, size and
518 frame = gtk_frame_new("Cylinder");
520 hbox = gtk_hbox_new(FALSE, 3);
521 gtk_container_add(GTK_CONTAINER(frame), hbox);
523 widget = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
524 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
526 cylinder->description = GTK_COMBO_BOX(widget);
527 g_signal_connect(widget, "changed", G_CALLBACK(cylinder_cb), cylinder);
529 entry = GTK_ENTRY(GTK_BIN(widget)->child);
530 g_signal_connect(entry, "activate", G_CALLBACK(cylinder_activate_cb), cylinder);
532 completion = gtk_entry_completion_new();
533 gtk_entry_completion_set_text_column(completion, 0);
534 gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(model));
535 g_signal_connect(completion, "match-selected", G_CALLBACK(completion_cb), cylinder);
536 gtk_entry_set_completion(entry, completion);
538 hbox = gtk_hbox_new(FALSE, 3);
539 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
540 gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);
542 widget = create_spinbutton(hbox, "Size", 0, 300, 0.1);
543 cylinder->size = GTK_SPIN_BUTTON(widget);
545 widget = create_spinbutton(hbox, "Pressure", 0, 5000, 1);
546 cylinder->pressure = GTK_SPIN_BUTTON(widget);
549 * Cylinder start/end pressures
551 hbox = gtk_hbox_new(FALSE, 3);
552 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
554 widget = create_spinbutton(hbox, "Start Pressure", 0, 5000, 1);
555 cylinder->start = GTK_SPIN_BUTTON(widget);
557 widget = create_spinbutton(hbox, "End Pressure", 0, 5000, 1);
558 cylinder->end = GTK_SPIN_BUTTON(widget);
561 * Cylinder gas mix: Air, Nitrox or Trimix
563 hbox = gtk_hbox_new(FALSE, 3);
564 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
566 widget = create_spinbutton(hbox, "Nitrox", 21, 100, 0.1);
567 cylinder->o2 = widget;
568 cylinder->gasmix_button = gtk_check_button_new();
569 gtk_box_pack_start(GTK_BOX(gtk_widget_get_parent(cylinder->o2)),
570 cylinder->gasmix_button, FALSE, FALSE, 3);
571 g_signal_connect(cylinder->gasmix_button, "toggled", G_CALLBACK(nitrox_cb), cylinder);
573 gtk_spin_button_set_range(GTK_SPIN_BUTTON(cylinder->o2), 21.0, 100.0);
576 static int edit_cylinder_dialog(int index, cylinder_t *cyl)
579 GtkWidget *dialog, *vbox;
580 struct cylinder_widget cylinder;
583 cylinder.index = index;
584 cylinder.changed = 0;
589 *cyl = dive->cylinder[index];
591 dialog = gtk_dialog_new_with_buttons("Cylinder",
592 GTK_WINDOW(main_window),
593 GTK_DIALOG_DESTROY_WITH_PARENT,
594 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
595 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
598 vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
599 cylinder_widget(vbox, &cylinder, cylinder_model);
601 show_cylinder(cyl, &cylinder);
603 gtk_widget_show_all(dialog);
604 success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
606 record_cylinder_changes(cyl, &cylinder);
607 dive->cylinder[index] = *cyl;
608 mark_divelist_changed(TRUE);
609 flush_divelist(dive);
612 gtk_widget_destroy(dialog);
617 static int get_model_index(GtkListStore *model, GtkTreeIter *iter)
622 path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
623 p = gtk_tree_path_get_indices(path);
625 gtk_tree_path_free(path);
629 static void edit_cb(GtkButton *button, gpointer data)
633 GtkListStore *model = cylinder_list.model;
634 GtkTreeSelection *selection;
637 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
639 /* Nothing selected? This shouldn't happen, since the button should be inactive */
640 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
643 index = get_model_index(model, &iter);
644 if (!edit_cylinder_dialog(index, &cyl))
647 set_one_cylinder(index, &cyl, model, &iter);
651 static void add_cb(GtkButton *button, gpointer data)
653 int index = cylinder_list.max_index;
655 GtkListStore *model = cylinder_list.model;
656 GtkTreeSelection *selection;
659 if (!edit_cylinder_dialog(index, &cyl))
662 gtk_list_store_append(model, &iter);
663 set_one_cylinder(index, &cyl, model, &iter);
665 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
666 gtk_tree_selection_select_iter(selection, &iter);
668 cylinder_list.max_index++;
669 gtk_widget_set_sensitive(cylinder_list.add, cylinder_list.max_index < MAX_CYLINDERS);
672 static void del_cb(GtkButton *button, gpointer data)
676 GtkListStore *model = cylinder_list.model;
677 GtkTreeSelection *selection;
681 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
683 /* Nothing selected? This shouldn't happen, since the button should be inactive */
684 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
687 index = get_model_index(model, &iter);
692 cyl = dive->cylinder + index;
693 nr = cylinder_list.max_index - index - 1;
695 gtk_list_store_remove(model, &iter);
697 cylinder_list.max_index--;
698 memmove(cyl, cyl+1, nr*sizeof(*cyl));
699 memset(cyl+nr, 0, sizeof(*cyl));
701 mark_divelist_changed(TRUE);
702 flush_divelist(dive);
704 gtk_widget_set_sensitive(cylinder_list.edit, 0);
705 gtk_widget_set_sensitive(cylinder_list.del, 0);
706 gtk_widget_set_sensitive(cylinder_list.add, 1);
709 static GtkListStore *create_tank_size_model(void)
713 model = gtk_list_store_new(3,
714 G_TYPE_STRING, /* Tank name */
715 G_TYPE_INT, /* Tank size in mliter */
716 G_TYPE_INT, /* Tank working pressure in mbar */
719 fill_tank_list(model);
723 static void size_data_func(GtkTreeViewColumn *col,
724 GtkCellRenderer *renderer,
730 double size, pressure;
733 gtk_tree_model_get(model, iter, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
734 convert_volume_pressure(ml, mbar, &size, &pressure);
736 snprintf(buffer, sizeof(buffer), "%.1f", size);
738 strcpy(buffer, "unkn");
739 g_object_set(renderer, "text", buffer, NULL);
742 static void pressure_data_func(GtkTreeViewColumn *col,
743 GtkCellRenderer *renderer,
748 int index = (long)data;
753 gtk_tree_model_get(model, iter, index, &mbar, -1);
754 decimals = convert_pressure(mbar, &pressure);
756 snprintf(buffer, sizeof(buffer), "%.*f", decimals, pressure);
759 g_object_set(renderer, "text", buffer, NULL);
762 static void percentage_data_func(GtkTreeViewColumn *col,
763 GtkCellRenderer *renderer,
768 int index = (long)data;
772 gtk_tree_model_get(model, iter, index, &permille, -1);
774 snprintf(buffer, sizeof(buffer), "%.1f%%", permille / 10.0);
777 g_object_set(renderer, "text", buffer, NULL);
780 static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model)
785 selected = gtk_tree_selection_get_selected(selection, NULL, &iter);
786 gtk_widget_set_sensitive(cylinder_list.edit, selected);
787 gtk_widget_set_sensitive(cylinder_list.del, selected);
790 static void row_activated_cb(GtkTreeView *tree_view,
792 GtkTreeViewColumn *column,
798 static GtkWidget *cylinder_list_create(void)
800 GtkWidget *tree_view;
801 GtkTreeSelection *selection;
804 model = gtk_list_store_new(CYL_COLUMNS,
805 G_TYPE_STRING, /* CYL_DESC: utf8 */
806 G_TYPE_INT, /* CYL_SIZE: mliter */
807 G_TYPE_INT, /* CYL_WORKP: mbar */
808 G_TYPE_INT, /* CYL_STARTP: mbar */
809 G_TYPE_INT, /* CYL_ENDP: mbar */
810 G_TYPE_INT, /* CYL_O2: permille */
811 G_TYPE_INT /* CYL_HE: permille */
813 cylinder_list.model = model;
814 tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
815 g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), model);
817 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
818 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_BROWSE);
819 g_signal_connect(selection, "changed", G_CALLBACK(selection_cb), model);
821 g_object_set(G_OBJECT(tree_view), "headers-visible", TRUE,
822 "enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH,
825 cylinder_list.desc = tree_view_column(tree_view, CYL_DESC, "Type", NULL, PANGO_ALIGN_LEFT, TRUE);
826 cylinder_list.size = tree_view_column(tree_view, CYL_SIZE, "Size", size_data_func, PANGO_ALIGN_RIGHT, TRUE);
827 cylinder_list.workp = tree_view_column(tree_view, CYL_WORKP, "MaxPress", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
828 cylinder_list.startp = tree_view_column(tree_view, CYL_STARTP, "Start", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
829 cylinder_list.endp = tree_view_column(tree_view, CYL_ENDP, "End", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
830 cylinder_list.o2 = tree_view_column(tree_view, CYL_O2, "O" UTF8_SUBSCRIPT_2 "%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
831 cylinder_list.he = tree_view_column(tree_view, CYL_HE, "He%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
835 GtkWidget *equipment_widget(void)
837 GtkWidget *vbox, *hbox, *frame, *framebox;
838 GtkWidget *add, *del, *edit;
840 vbox = gtk_vbox_new(FALSE, 3);
843 * We create the cylinder size model at startup, since
844 * we're going to share it across all cylinders and all
845 * dives. So if you add a new cylinder type in one dive,
846 * it will show up when you edit the cylinder types for
849 cylinder_model = create_tank_size_model();
851 cylinder_list.tree_view = cylinder_list_create();
853 hbox = gtk_hbox_new(FALSE, 3);
854 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
856 frame = gtk_frame_new("Cylinders");
857 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, FALSE, 3);
859 framebox = gtk_vbox_new(FALSE, 3);
860 gtk_container_add(GTK_CONTAINER(frame), framebox);
862 hbox = gtk_hbox_new(FALSE, 3);
863 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
865 gtk_box_pack_start(GTK_BOX(hbox), cylinder_list.tree_view, TRUE, FALSE, 3);
867 hbox = gtk_hbox_new(TRUE, 3);
868 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
870 edit = gtk_button_new_from_stock(GTK_STOCK_EDIT);
871 add = gtk_button_new_from_stock(GTK_STOCK_ADD);
872 del = gtk_button_new_from_stock(GTK_STOCK_DELETE);
873 gtk_box_pack_start(GTK_BOX(hbox), edit, FALSE, FALSE, 0);
874 gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0);
875 gtk_box_pack_start(GTK_BOX(hbox), del, FALSE, FALSE, 0);
877 cylinder_list.edit = edit;
878 cylinder_list.add = add;
879 cylinder_list.del = del;
881 g_signal_connect(edit, "clicked", G_CALLBACK(edit_cb), NULL);
882 g_signal_connect(add, "clicked", G_CALLBACK(add_cb), NULL);
883 g_signal_connect(del, "clicked", G_CALLBACK(del_cb), NULL);