]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Keep the start/end spinbuttons as GtkWidget
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Nov 2011 16:37:49 +0000 (08:37 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Nov 2011 16:37:49 +0000 (08:37 -0800)
For graying things out, we want a widget, not a spinbutton.  Although
I'm sure we could just cast things back and forth.  But let's be
consistent with what we do, and only ever cast from GtkWidget to
GtkSpinButton, and have the same logic as for the "o2" widget that also
needs to be explicitly enabled.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
equipment.c

index c2d05d2ba4d2304595acd175d487a8a913e999d0..2e0e71a68466c2806203d5e85f0fa77a3a33d363 100644 (file)
@@ -45,7 +45,8 @@ struct cylinder_widget {
        const char *name;
        GtkWidget *hbox;
        GtkComboBox *description;
-       GtkSpinButton *size, *pressure, *start, *end;
+       GtkSpinButton *size, *pressure;
+       GtkWidget *start, *end;
        GtkWidget *o2, *gasmix_button;
 };
 
@@ -103,9 +104,9 @@ static void set_cylinder_pressure_spinbuttons(struct cylinder_widget *cylinder,
        double pressure;
 
        convert_pressure(cyl->start.mbar, &pressure);
-       gtk_spin_button_set_value(cylinder->start, pressure);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->start), pressure);
        convert_pressure(cyl->end.mbar, &pressure);
-       gtk_spin_button_set_value(cylinder->end, pressure);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->end), pressure);
 }
 
 /*
@@ -402,8 +403,8 @@ 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(cylinder->start);
-       end = gtk_spin_button_get_value(cylinder->end);
+       start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
+       end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
        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)))
                o2 = 0;
@@ -559,10 +560,10 @@ static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, G
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
 
        widget = create_spinbutton(hbox, "Start Pressure", 0, 5000, 1);
-       cylinder->start = GTK_SPIN_BUTTON(widget);
+       cylinder->start = widget;
 
        widget = create_spinbutton(hbox, "End Pressure", 0, 5000, 1);
-       cylinder->end = GTK_SPIN_BUTTON(widget);
+       cylinder->end = widget;
 
        /*
         * Cylinder gas mix: Air, Nitrox or Trimix