X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=1e053e52b22837b3ed9df9554b337e25bf9da749;hb=e5692a77c3f99fe485f6490f567f6cc9cea2adff;hp=7d0e95c43ecdf5b8885ff44dd4a1693b75b744c6;hpb=81fddfa67e779c8d378eee4c57fd9f201e15f96f;p=ext%2Fsubsurface.git
diff --git a/gtk-gui.c b/gtk-gui.c
index 7d0e95c..1e053e5 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -31,6 +31,39 @@ static GtkWidget *dive_profile;
visible_cols_t visible_cols = {TRUE, FALSE};
+static const char *default_dive_computer;
+static const char *default_dive_computer_device;
+
+static int is_default_dive_computer(const char *name)
+{
+ return default_dive_computer && !strcmp(name, default_dive_computer);
+}
+
+static int is_default_dive_computer_device(const char *name)
+{
+ return default_dive_computer_device && !strcmp(name, default_dive_computer_device);
+}
+
+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);
+}
+
+static void set_default_dive_computer_device(const char *name)
+{
+ if (!name || !*name)
+ return;
+ if (is_default_dive_computer_device(name))
+ return;
+ default_dive_computer_device = name;
+ subsurface_set_conf("dive_computer_device", PREF_STRING, name);
+}
+
void repaint_dive(void)
{
update_dive(current_dive);
@@ -423,7 +456,9 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
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);
}
@@ -605,13 +640,13 @@ static const gchar* ui_string = " \
\
\
\
- \
- \
\
- \
+ \
\
\