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 /* we want bar - so let's not use our unit functions */
53 static int convert_pressure(int mbar, double *p)
58 if (output_units.pressure == PSI) {
59 pressure = mbar_to_PSI(mbar);
62 pressure = mbar / 1000.0;
69 static int convert_volume_pressure(int ml, int mbar, double *v, double *p)
72 double volume, pressure;
75 if (output_units.volume == CUFT) {
76 volume = ml_to_cuft(ml);
77 volume *= bar_to_atm(mbar / 1000.0);
81 if (output_units.pressure == PSI) {
82 pressure = mbar_to_PSI(mbar);
85 pressure = mbar / 1000.0;
92 static void set_cylinder_type_spinbuttons(struct cylinder_widget *cylinder, int ml, int mbar)
94 double volume, pressure;
96 convert_volume_pressure(ml, mbar, &volume, &pressure);
97 gtk_spin_button_set_value(cylinder->size, volume);
98 gtk_spin_button_set_value(cylinder->pressure, pressure);
101 static void set_cylinder_pressure_spinbuttons(struct cylinder_widget *cylinder, int start, int end)
105 convert_pressure(start, &pressure);
106 gtk_spin_button_set_value(cylinder->start, pressure);
107 convert_pressure(end, &pressure);
108 gtk_spin_button_set_value(cylinder->end, pressure);
112 * The gtk_tree_model_foreach() interface is bad. It could have
113 * returned whether the callback ever returned true
115 static GtkTreeIter *found_match = NULL;
116 static GtkTreeIter match_iter;
118 static gboolean match_cylinder(GtkTreeModel *model,
125 const char *desc = data;
127 gtk_tree_model_get(model, iter, 0, &name, -1);
128 match = !strcmp(desc, name);
132 found_match = &match_iter;
137 static int get_active_cylinder(GtkComboBox *combo_box, GtkTreeIter *iter)
141 if (gtk_combo_box_get_active_iter(combo_box, iter))
144 desc = gtk_combo_box_get_active_text(combo_box);
147 gtk_tree_model_foreach(GTK_TREE_MODEL(cylinder_model), match_cylinder, (void *)desc);
153 *iter = *found_match;
154 gtk_combo_box_set_active_iter(combo_box, iter);
158 static void cylinder_cb(GtkComboBox *combo_box, gpointer data)
161 GtkTreeModel *model = gtk_combo_box_get_model(combo_box);
163 struct cylinder_widget *cylinder = data;
164 cylinder_t *cyl = current_dive->cylinder + cylinder->index;
166 /* Did the user set it to some non-standard value? */
167 if (!get_active_cylinder(combo_box, &iter)) {
168 cylinder->changed = 1;
173 * We get "change" signal callbacks just because we set
174 * the description by hand. Whatever. So ignore them if
177 if (!cylinder->changed && cyl->type.description) {
179 char *desc = gtk_combo_box_get_active_text(combo_box);
181 same = !strcmp(desc, cyl->type.description);
186 cylinder->changed = 1;
188 gtk_tree_model_get(model, &iter,
193 set_cylinder_type_spinbuttons(cylinder, ml, mbar);
196 static GtkTreeIter *add_cylinder_type(const char *desc, int ml, int mbar, GtkTreeIter *iter)
200 /* Don't even bother adding stuff without a size */
205 model = GTK_TREE_MODEL(cylinder_model);
206 gtk_tree_model_foreach(model, match_cylinder, (void *)desc);
209 GtkListStore *store = GTK_LIST_STORE(model);
211 gtk_list_store_append(store, iter);
212 gtk_list_store_set(store, iter,
223 * When adding a dive, we'll add all the pre-existing cylinder
224 * information from that dive to our cylinder model.
226 void add_cylinder_description(cylinder_type_t *type)
230 unsigned int size, workp;
232 desc = type->description;
235 size = type->size.mliter;
236 workp = type->workingpressure.mbar;
237 add_cylinder_type(desc, size, workp, &iter);
240 static void add_cylinder(struct cylinder_widget *cylinder, const char *desc, int ml, int mbar)
242 GtkTreeIter iter, *match;
244 cylinder->name = desc;
245 match = add_cylinder_type(desc, ml, mbar, &iter);
247 gtk_combo_box_set_active_iter(cylinder->description, match);
250 static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder)
256 /* Don't show uninitialized cylinder widgets */
257 if (!cylinder->description)
260 desc = cyl->type.description;
263 ml = cyl->type.size.mliter;
264 mbar = cyl->type.workingpressure.mbar;
265 add_cylinder(cylinder, desc, ml, mbar);
267 set_cylinder_type_spinbuttons(cylinder,
268 cyl->type.size.mliter, cyl->type.workingpressure.mbar);
269 set_cylinder_pressure_spinbuttons(cylinder,
270 cyl->start.mbar, cyl->end.mbar);
271 o2 = cyl->gasmix.o2.permille / 10.0;
272 gtk_widget_set_sensitive(cylinder->o2, !!o2);
273 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button), !!o2);
276 gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2);
279 static int cyl_nothing(cylinder_t *cyl)
281 return !cyl->type.size.mliter &&
282 !cyl->type.workingpressure.mbar &&
283 !cyl->type.description &&
284 !cyl->gasmix.o2.permille &&
285 !cyl->gasmix.he.permille &&
290 static void set_one_cylinder(int index, cylinder_t *cyl, GtkListStore *model, GtkTreeIter *iter)
292 gtk_list_store_set(model, iter,
293 CYL_DESC, cyl->type.description ? : "",
294 CYL_SIZE, cyl->type.size.mliter,
295 CYL_WORKP, cyl->type.workingpressure.mbar,
296 CYL_STARTP, cyl->start.mbar,
297 CYL_ENDP, cyl->end.mbar,
298 CYL_O2, cyl->gasmix.o2.permille,
299 CYL_HE, cyl->gasmix.he.permille,
303 void show_dive_equipment(struct dive *dive)
309 model = cylinder_list.model;
310 gtk_list_store_clear(model);
313 cylinder_t *cyl = &dive->cylinder[max-1];
315 if (!cyl_nothing(cyl))
319 cylinder_list.max_index = max;
321 gtk_widget_set_sensitive(cylinder_list.edit, 0);
322 gtk_widget_set_sensitive(cylinder_list.del, 0);
323 gtk_widget_set_sensitive(cylinder_list.add, max < MAX_CYLINDERS);
325 for (i = 0; i < max; i++) {
326 cylinder_t *cyl = dive->cylinder+i;
328 gtk_list_store_append(model, &iter);
329 set_one_cylinder(i, cyl, model, &iter);
333 static GtkWidget *create_spinbutton(GtkWidget *vbox, const char *name, double min, double max, double incr)
335 GtkWidget *frame, *hbox, *button;
337 frame = gtk_frame_new(name);
338 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, FALSE, 0);
340 hbox = gtk_hbox_new(FALSE, 3);
341 gtk_container_add(GTK_CONTAINER(frame), hbox);
343 button = gtk_spin_button_new_with_range(min, max, incr);
344 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
346 gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(button), GTK_UPDATE_IF_VALID);
351 static void fill_cylinder_info(struct cylinder_widget *cylinder, cylinder_t *cyl, const char *desc,
352 double volume, double pressure, double start, double end, int o2)
356 if (output_units.pressure == PSI) {
357 pressure = psi_to_bar(pressure);
358 start = psi_to_bar(start);
359 end = psi_to_bar(end);
362 if (pressure && output_units.volume == CUFT) {
363 volume = cuft_to_l(volume);
364 volume /= bar_to_atm(pressure);
367 ml = volume * 1000 + 0.5;
368 mbar = pressure * 1000 + 0.5;
372 cyl->type.description = desc;
373 cyl->type.size.mliter = ml;
374 cyl->type.workingpressure.mbar = mbar;
375 cyl->start.mbar = start * 1000 + 0.5;
376 cyl->end.mbar = end * 1000 + 0.5;
377 cyl->gasmix.o2.permille = o2;
380 * Also, insert it into the model if it doesn't already exist
382 add_cylinder(cylinder, desc, ml, mbar);
385 static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cylinder)
389 double volume, pressure, start, end;
392 /* Ignore uninitialized cylinder widgets */
393 box = cylinder->description;
397 desc = gtk_combo_box_get_active_text(box);
398 volume = gtk_spin_button_get_value(cylinder->size);
399 pressure = gtk_spin_button_get_value(cylinder->pressure);
400 start = gtk_spin_button_get_value(cylinder->start);
401 end = gtk_spin_button_get_value(cylinder->end);
402 o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
403 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
405 fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
408 void flush_dive_equipment_changes(struct dive *dive)
410 /* We do nothing: we require the "Ok" button press */
414 * We hardcode the most common standard cylinders,
415 * we should pick up any other names from the dive
418 static struct tank_info {
420 int size; /* cuft if < 1000, otherwise mliter */
421 int psi; /* If zero, size is in mliter */
423 /* Need an empty entry for the no-cylinder case */
426 /* Size-only metric cylinders */
430 /* Most common AL cylinders */
431 { "AL50", 50, 3000 },
432 { "AL63", 63, 3000 },
433 { "AL72", 72, 3000 },
434 { "AL80", 80, 3000 },
435 { "AL100", 100, 3300 },
437 /* Somewhat common LP steel cylinders */
438 { "LP85", 85, 2640 },
439 { "LP95", 95, 2640 },
440 { "LP108", 108, 2640 },
441 { "LP121", 121, 2640 },
443 /* Somewhat common HP steel cylinders */
444 { "HP65", 65, 3442 },
445 { "HP80", 80, 3442 },
446 { "HP100", 100, 3442 },
447 { "HP119", 119, 3442 },
448 { "HP130", 130, 3442 },
450 /* We'll fill in more from the dive log dynamically */
454 static void fill_tank_list(GtkListStore *store)
457 struct tank_info *info = tank_info;
460 int size = info->size;
462 int mbar = 0, ml = size;
464 /* Is it in cuft and psi? */
466 double bar = psi_to_bar(psi);
467 double airvolume = cuft_to_l(size) * 1000.0;
468 double atm = bar_to_atm(bar);
470 ml = airvolume / atm + 0.5;
471 mbar = bar*1000 + 0.5;
474 gtk_list_store_append(store, &iter);
475 gtk_list_store_set(store, &iter,
484 static void nitrox_cb(GtkToggleButton *button, gpointer data)
486 struct cylinder_widget *cylinder = data;
489 state = gtk_toggle_button_get_active(button);
490 gtk_widget_set_sensitive(cylinder->o2, state);
493 static gboolean completion_cb(GtkEntryCompletion *widget, GtkTreeModel *model, GtkTreeIter *iter, struct cylinder_widget *cylinder)
496 unsigned int ml, mbar;
498 gtk_tree_model_get(model, iter, CYL_DESC, &desc, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
499 add_cylinder(cylinder, desc, ml, mbar);
503 static void cylinder_activate_cb(GtkComboBox *combo_box, gpointer data)
505 struct cylinder_widget *cylinder = data;
506 cylinder_cb(cylinder->description, data);
509 static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, GtkListStore *model)
511 GtkWidget *frame, *hbox;
513 GtkEntryCompletion *completion;
517 * Cylinder type: description, size and
520 frame = gtk_frame_new("Cylinder");
522 hbox = gtk_hbox_new(FALSE, 3);
523 gtk_container_add(GTK_CONTAINER(frame), hbox);
525 widget = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(model), 0);
526 gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, TRUE, 0);
528 cylinder->description = GTK_COMBO_BOX(widget);
529 g_signal_connect(widget, "changed", G_CALLBACK(cylinder_cb), cylinder);
531 entry = GTK_ENTRY(GTK_BIN(widget)->child);
532 g_signal_connect(entry, "activate", G_CALLBACK(cylinder_activate_cb), cylinder);
534 completion = gtk_entry_completion_new();
535 gtk_entry_completion_set_text_column(completion, 0);
536 gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(model));
537 g_signal_connect(completion, "match-selected", G_CALLBACK(completion_cb), cylinder);
538 gtk_entry_set_completion(entry, completion);
540 hbox = gtk_hbox_new(FALSE, 3);
541 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
542 gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);
544 widget = create_spinbutton(hbox, "Size", 0, 300, 0.1);
545 cylinder->size = GTK_SPIN_BUTTON(widget);
547 widget = create_spinbutton(hbox, "Pressure", 0, 5000, 1);
548 cylinder->pressure = GTK_SPIN_BUTTON(widget);
551 * Cylinder start/end pressures
553 hbox = gtk_hbox_new(FALSE, 3);
554 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
556 widget = create_spinbutton(hbox, "Start Pressure", 0, 5000, 1);
557 cylinder->start = GTK_SPIN_BUTTON(widget);
559 widget = create_spinbutton(hbox, "End Pressure", 0, 5000, 1);
560 cylinder->end = GTK_SPIN_BUTTON(widget);
563 * Cylinder gas mix: Air, Nitrox or Trimix
565 hbox = gtk_hbox_new(FALSE, 3);
566 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
568 widget = create_spinbutton(hbox, "Nitrox", 21, 100, 0.1);
569 cylinder->o2 = widget;
570 cylinder->gasmix_button = gtk_check_button_new();
571 gtk_box_pack_start(GTK_BOX(gtk_widget_get_parent(cylinder->o2)),
572 cylinder->gasmix_button, FALSE, FALSE, 3);
573 g_signal_connect(cylinder->gasmix_button, "toggled", G_CALLBACK(nitrox_cb), cylinder);
575 gtk_spin_button_set_range(GTK_SPIN_BUTTON(cylinder->o2), 21.0, 100.0);
578 static int edit_cylinder_dialog(int index, cylinder_t *cyl)
581 GtkWidget *dialog, *vbox;
582 struct cylinder_widget cylinder;
585 cylinder.index = index;
586 cylinder.changed = 0;
591 *cyl = dive->cylinder[index];
593 dialog = gtk_dialog_new_with_buttons("Cylinder",
594 GTK_WINDOW(main_window),
595 GTK_DIALOG_DESTROY_WITH_PARENT,
596 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
597 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
600 vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
601 cylinder_widget(vbox, &cylinder, cylinder_model);
603 show_cylinder(cyl, &cylinder);
605 gtk_widget_show_all(dialog);
606 success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
608 record_cylinder_changes(cyl, &cylinder);
609 dive->cylinder[index] = *cyl;
610 mark_divelist_changed(TRUE);
611 flush_divelist(dive);
614 gtk_widget_destroy(dialog);
619 static int get_model_index(GtkListStore *model, GtkTreeIter *iter)
624 path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
625 p = gtk_tree_path_get_indices(path);
627 gtk_tree_path_free(path);
631 static void edit_cb(GtkButton *button, gpointer data)
635 GtkListStore *model = cylinder_list.model;
636 GtkTreeSelection *selection;
639 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
641 /* Nothing selected? This shouldn't happen, since the button should be inactive */
642 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
645 index = get_model_index(model, &iter);
646 if (!edit_cylinder_dialog(index, &cyl))
649 set_one_cylinder(index, &cyl, model, &iter);
653 static void add_cb(GtkButton *button, gpointer data)
655 int index = cylinder_list.max_index;
657 GtkListStore *model = cylinder_list.model;
658 GtkTreeSelection *selection;
661 if (!edit_cylinder_dialog(index, &cyl))
664 gtk_list_store_append(model, &iter);
665 set_one_cylinder(index, &cyl, model, &iter);
667 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
668 gtk_tree_selection_select_iter(selection, &iter);
670 cylinder_list.max_index++;
671 gtk_widget_set_sensitive(cylinder_list.add, cylinder_list.max_index < MAX_CYLINDERS);
674 static void del_cb(GtkButton *button, gpointer data)
678 GtkListStore *model = cylinder_list.model;
679 GtkTreeSelection *selection;
683 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cylinder_list.tree_view));
685 /* Nothing selected? This shouldn't happen, since the button should be inactive */
686 if (!gtk_tree_selection_get_selected(selection, NULL, &iter))
689 index = get_model_index(model, &iter);
694 cyl = dive->cylinder + index;
695 nr = cylinder_list.max_index - index - 1;
697 gtk_list_store_remove(model, &iter);
699 cylinder_list.max_index--;
700 memmove(cyl, cyl+1, nr*sizeof(*cyl));
701 memset(cyl+nr, 0, sizeof(*cyl));
703 mark_divelist_changed(TRUE);
704 flush_divelist(dive);
706 gtk_widget_set_sensitive(cylinder_list.edit, 0);
707 gtk_widget_set_sensitive(cylinder_list.del, 0);
708 gtk_widget_set_sensitive(cylinder_list.add, 1);
711 static GtkListStore *create_tank_size_model(void)
715 model = gtk_list_store_new(3,
716 G_TYPE_STRING, /* Tank name */
717 G_TYPE_INT, /* Tank size in mliter */
718 G_TYPE_INT, /* Tank working pressure in mbar */
721 fill_tank_list(model);
725 static void size_data_func(GtkTreeViewColumn *col,
726 GtkCellRenderer *renderer,
732 double size, pressure;
735 gtk_tree_model_get(model, iter, CYL_SIZE, &ml, CYL_WORKP, &mbar, -1);
736 convert_volume_pressure(ml, mbar, &size, &pressure);
738 snprintf(buffer, sizeof(buffer), "%.1f", size);
740 strcpy(buffer, "unkn");
741 g_object_set(renderer, "text", buffer, NULL);
744 static void pressure_data_func(GtkTreeViewColumn *col,
745 GtkCellRenderer *renderer,
750 int index = (long)data;
755 gtk_tree_model_get(model, iter, index, &mbar, -1);
756 decimals = convert_pressure(mbar, &pressure);
758 snprintf(buffer, sizeof(buffer), "%.*f", decimals, pressure);
761 g_object_set(renderer, "text", buffer, NULL);
764 static void percentage_data_func(GtkTreeViewColumn *col,
765 GtkCellRenderer *renderer,
770 int index = (long)data;
774 gtk_tree_model_get(model, iter, index, &permille, -1);
776 snprintf(buffer, sizeof(buffer), "%.1f%%", permille / 10.0);
779 g_object_set(renderer, "text", buffer, NULL);
782 static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model)
787 selected = gtk_tree_selection_get_selected(selection, NULL, &iter);
788 gtk_widget_set_sensitive(cylinder_list.edit, selected);
789 gtk_widget_set_sensitive(cylinder_list.del, selected);
792 static void row_activated_cb(GtkTreeView *tree_view,
794 GtkTreeViewColumn *column,
800 static GtkWidget *cylinder_list_create(void)
802 GtkWidget *tree_view;
803 GtkTreeSelection *selection;
806 model = gtk_list_store_new(CYL_COLUMNS,
807 G_TYPE_STRING, /* CYL_DESC: utf8 */
808 G_TYPE_INT, /* CYL_SIZE: mliter */
809 G_TYPE_INT, /* CYL_WORKP: mbar */
810 G_TYPE_INT, /* CYL_STARTP: mbar */
811 G_TYPE_INT, /* CYL_ENDP: mbar */
812 G_TYPE_INT, /* CYL_O2: permille */
813 G_TYPE_INT /* CYL_HE: permille */
815 cylinder_list.model = model;
816 tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
817 g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), model);
819 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
820 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_BROWSE);
821 g_signal_connect(selection, "changed", G_CALLBACK(selection_cb), model);
823 g_object_set(G_OBJECT(tree_view), "headers-visible", TRUE,
824 "enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH,
827 cylinder_list.desc = tree_view_column(tree_view, CYL_DESC, "Type", NULL, PANGO_ALIGN_LEFT, TRUE);
828 cylinder_list.size = tree_view_column(tree_view, CYL_SIZE, "Size", size_data_func, PANGO_ALIGN_RIGHT, TRUE);
829 cylinder_list.workp = tree_view_column(tree_view, CYL_WORKP, "MaxPress", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
830 cylinder_list.startp = tree_view_column(tree_view, CYL_STARTP, "Start", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
831 cylinder_list.endp = tree_view_column(tree_view, CYL_ENDP, "End", pressure_data_func, PANGO_ALIGN_RIGHT, TRUE);
832 cylinder_list.o2 = tree_view_column(tree_view, CYL_O2, "O" UTF8_SUBSCRIPT_2 "%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
833 cylinder_list.he = tree_view_column(tree_view, CYL_HE, "He%", percentage_data_func, PANGO_ALIGN_RIGHT, TRUE);
837 GtkWidget *equipment_widget(void)
839 GtkWidget *vbox, *hbox, *frame, *framebox;
840 GtkWidget *add, *del, *edit;
842 vbox = gtk_vbox_new(FALSE, 3);
845 * We create the cylinder size model at startup, since
846 * we're going to share it across all cylinders and all
847 * dives. So if you add a new cylinder type in one dive,
848 * it will show up when you edit the cylinder types for
851 cylinder_model = create_tank_size_model();
853 cylinder_list.tree_view = cylinder_list_create();
855 hbox = gtk_hbox_new(FALSE, 3);
856 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
858 frame = gtk_frame_new("Cylinders");
859 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, FALSE, 3);
861 framebox = gtk_vbox_new(FALSE, 3);
862 gtk_container_add(GTK_CONTAINER(frame), framebox);
864 hbox = gtk_hbox_new(FALSE, 3);
865 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
867 gtk_box_pack_start(GTK_BOX(hbox), cylinder_list.tree_view, TRUE, FALSE, 3);
869 hbox = gtk_hbox_new(TRUE, 3);
870 gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
872 edit = gtk_button_new_from_stock(GTK_STOCK_EDIT);
873 add = gtk_button_new_from_stock(GTK_STOCK_ADD);
874 del = gtk_button_new_from_stock(GTK_STOCK_DELETE);
875 gtk_box_pack_start(GTK_BOX(hbox), edit, FALSE, FALSE, 0);
876 gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0);
877 gtk_box_pack_start(GTK_BOX(hbox), del, FALSE, FALSE, 0);
879 cylinder_list.edit = edit;
880 cylinder_list.add = add;
881 cylinder_list.del = del;
883 g_signal_connect(edit, "clicked", G_CALLBACK(edit_cb), NULL);
884 g_signal_connect(add, "clicked", G_CALLBACK(add_cb), NULL);
885 g_signal_connect(del, "clicked", G_CALLBACK(del_cb), NULL);