X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=gtk-gui.c;h=98c0111eab530ef11de4027f54217f45eed45a27;hb=e7a70b6ae821e6a178957e2814406ac387b990ea;hp=402e91a6e5f2f1f29c15e9ea07129f1e9a2df019;hpb=9933ccd7cf3a84ca60330a810e7763668ad882fb;p=ext%2Fsubsurface.git
diff --git a/gtk-gui.c b/gtk-gui.c
index 402e91a..98c0111 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -31,6 +31,23 @@ static GtkWidget *dive_profile;
visible_cols_t visible_cols = {TRUE, FALSE};
+static const char *default_dive_computer;
+
+static int is_default_dive_computer(const char *name)
+{
+ return default_dive_computer && !strcmp(name, default_dive_computer);
+}
+
+static void set_default_dive_computer(const char *name)
+{
+ if (!name || !*name)
+ return;
+ if (is_default_dive_computer(name))
+ return;
+ default_dive_computer = name;
+ subsurface_set_conf("dive_computer", PREF_STRING, name);
+}
+
void repaint_dive(void)
{
update_dive(current_dive);
@@ -296,6 +313,8 @@ UNITCALLBACK(set_liter, volume, LITER)
UNITCALLBACK(set_cuft, volume, CUFT)
UNITCALLBACK(set_celsius, temperature, CELSIUS)
UNITCALLBACK(set_fahrenheit, temperature, FAHRENHEIT)
+UNITCALLBACK(set_kg, weight, KG)
+UNITCALLBACK(set_lbs, weight, LBS)
#define OPTIONCALLBACK(name, option) \
static void name(GtkWidget *w, gpointer data) \
@@ -357,6 +376,11 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
"Fahrenheit", set_fahrenheit, (output_units.temperature == FAHRENHEIT),
NULL);
+ create_radio(box, "Weight:",
+ "kg", set_kg, (output_units.weight == KG),
+ "lbs", set_lbs, (output_units.weight == LBS),
+ NULL);
+
frame = gtk_frame_new("Columns");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
@@ -409,13 +433,16 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
subsurface_set_conf("psi", PREF_BOOL, BOOL_TO_PTR(output_units.pressure == PSI));
subsurface_set_conf("cuft", PREF_BOOL, BOOL_TO_PTR(output_units.volume == CUFT));
subsurface_set_conf("fahrenheit", PREF_BOOL, BOOL_TO_PTR(output_units.temperature == FAHRENHEIT));
+ subsurface_set_conf("lbs", PREF_BOOL, BOOL_TO_PTR(output_units.weight == LBS));
subsurface_set_conf("TEMPERATURE", PREF_BOOL, BOOL_TO_PTR(visible_cols.temperature));
subsurface_set_conf("CYLINDER", PREF_BOOL, BOOL_TO_PTR(visible_cols.cylinder));
subsurface_set_conf("NITROX", PREF_BOOL, BOOL_TO_PTR(visible_cols.nitrox));
subsurface_set_conf("SAC", PREF_BOOL, BOOL_TO_PTR(visible_cols.sac));
subsurface_set_conf("OTU", PREF_BOOL, BOOL_TO_PTR(visible_cols.otu));
subsurface_set_conf("divelist_font", PREF_STRING, divelist_font);
- subsurface_close_conf();
+
+ /* Flush the changes out to the system */
+ subsurface_flush_conf();
}
gtk_widget_destroy(dialog);
}
@@ -597,13 +624,13 @@ static const gchar* ui_string = " \
\
\
\
- \
- \
\
- \
+ \
\
\