]> git.tdb.fi Git - ext/subsurface.git/blobdiff - equipment.c
Make double-clicking on the dive list bring up the dive editor
[ext/subsurface.git] / equipment.c
index 19abbe67294c7c6fea26f9b708c7bf3a95a761fe..4ac8e3e99dc14dd8140586f0ff07e9e892c50e7f 100644 (file)
@@ -3,7 +3,6 @@
  * controlled through the following interfaces:
  *
  * void show_dive_equipment(struct dive *dive)
- * void flush_dive_equipment_changes(struct dive *dive)
  *
  * called from gtk-ui:
  * GtkWidget *equipment_widget(void)
@@ -416,21 +415,19 @@ static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cyl
        desc = gtk_combo_box_get_active_text(box);
        volume = gtk_spin_button_get_value(cylinder->size);
        pressure = gtk_spin_button_get_value(cylinder->pressure);
-       start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
-       end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
-       if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button)))
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button))) {
+               start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
+               end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
+       } else {
                start = end = 0;
-       o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
-       if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
+       }
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button)))
+               o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
+       else
                o2 = 0;
        fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2);
 }
 
-void flush_dive_equipment_changes(struct dive *dive)
-{
-       /* We do nothing: we require the "Ok" button press */
-}
-
 /*
  * We hardcode the most common standard cylinders,
  * we should pick up any other names from the dive
@@ -643,6 +640,7 @@ static int edit_cylinder_dialog(int index, cylinder_t *cyl)
                record_cylinder_changes(cyl, &cylinder);
                dive->cylinder[index] = *cyl;
                mark_divelist_changed(TRUE);
+               update_cylinder_related_info(dive);
                flush_divelist(dive);
        }
 
@@ -849,6 +847,7 @@ static GtkWidget *cylinder_list_create(void)
                );
        cylinder_list.model = model;
        tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
+       gtk_widget_set_can_focus(tree_view, FALSE);
        g_signal_connect(tree_view, "row-activated", G_CALLBACK(row_activated_cb), model);
 
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));