summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-10 10:46:46 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-10 10:52:25 -0800
commit7cf1960336011b8ef702c3bc2458b27db0fc1a4e (patch)
tree7784c16e97c6a4cb3aad010d83601c2de12e104f
parent92c0d8c5160232642571b52b66176594c796f21d (diff)
downloadsubsurface-7cf1960336011b8ef702c3bc2458b27db0fc1a4e.tar.gz
Apply preference changes right away
This allows you to open the preference dialog, play with settings and see their effect right away. Press OK and you keep them, press Cancel and you are back to the previous state. As it should be. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--gtk-gui.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 799613214..842a28740 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -451,11 +451,19 @@ static void create_radio(GtkWidget *vbox, const char *w_name, ...)
va_end(args);
}
+static void update_screen()
+{
+ update_dive_list_units();
+ repaint_dive();
+ update_dive_list_col_visibility();
+}
+
#define UNITCALLBACK(name, type, value) \
static void name(GtkWidget *w, gpointer data) \
{ \
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) \
prefs.output_units.type = value; \
+ update_screen(); \
}
UNITCALLBACK(set_meter, length, METERS)
@@ -474,6 +482,7 @@ static void name(GtkWidget *w, gpointer data) \
{ \
GtkWidget **entry = data; \
option = GTK_TOGGLE_BUTTON(w)->active; \
+ update_screen(); \
if (entry) \
gtk_widget_set_sensitive(*entry, option);\
}
@@ -765,9 +774,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
sscanf(pn2_threshold_text, "%lf", &prefs.pp_graphs.pn2_threshold);
phe_threshold_text = gtk_entry_get_text(GTK_ENTRY(entry_phe));
sscanf(phe_threshold_text, "%lf", &prefs.pp_graphs.phe_threshold);
- update_dive_list_units();
- repaint_dive();
- update_dive_list_col_visibility();
+ update_screen();
subsurface_set_conf("feet", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.length == FEET));
subsurface_set_conf("psi", PREF_BOOL, BOOL_TO_PTR(prefs.output_units.pressure == PSI));