diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2011-09-27 10:46:59 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2011-09-27 10:47:28 -0700 |
commit | f3134cbb8995267e6a18b9564f3022e7fe7314a9 (patch) | |
tree | ff45589788ae5aee7684c06d222462264b6c4304 | |
parent | 0aad4d6094173fd3c10e435be05bde541062232d (diff) | |
download | subsurface-f3134cbb8995267e6a18b9564f3022e7fe7314a9.tar.gz |
Store options in gconf
While it's not the most elegant way to do this I opted to store the
options with "inverted polarity" - i.e., the options that are supposed to
default to "True" are stored inverted since gconf reports an unset option
(first time the user runs the program) as "False".
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | gtk-gui.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -330,7 +330,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data) gconf_client_set_bool(gconf, GCONF_NAME(psi), output_units.pressure == PSI, NULL); gconf_client_set_bool(gconf, GCONF_NAME(cuft), output_units.volume == CUFT, NULL); gconf_client_set_bool(gconf, GCONF_NAME(fahrenheit), output_units.temperature == FAHRENHEIT, NULL); - gconf_client_set_bool(gconf, GCONF_NAME(SAC), visible_cols.sac, NULL); + gconf_client_set_bool(gconf, GCONF_NAME(SAC), ! visible_cols.sac, NULL); /* inverted to get the correct default */ gconf_client_set_bool(gconf, GCONF_NAME(OTU), visible_cols.otu, NULL); gconf_client_set_string(gconf, GCONF_NAME(divelist_font), divelist_font, NULL); } @@ -445,7 +445,11 @@ void init_ui(int argc, char **argv) output_units.volume = CUFT; if (gconf_client_get_bool(gconf, GCONF_NAME(fahrenheit), NULL)) output_units.temperature = FAHRENHEIT; - + /* an unset key is FALSE - so in order to get the default behavior right we + invert the meaning of the SAC key */ + visible_cols.otu = gconf_client_get_bool(gconf, GCONF_NAME(OTU), NULL); + visible_cols.sac = ! gconf_client_get_bool(gconf, GCONF_NAME(SAC), NULL); + divelist_font = gconf_client_get_string(gconf, GCONF_NAME(divelist_font), NULL); if (!divelist_font) divelist_font = DIVELIST_DEFAULT_FONT; |