diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-11 17:07:22 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-11 17:46:00 -0800 |
commit | 6a10700ca59e546c7a05688bdf5bffa388286bff (patch) | |
tree | 1cef21cc47580f1f64b0f186ebb712bca5b0cc24 /main.c | |
parent | 954290c70ba525cab4fefe83a3e82384ef01ba8c (diff) | |
download | subsurface-6a10700ca59e546c7a05688bdf5bffa388286bff.tar.gz |
Add default filename and divelist font to prefs structure
.. and add the usual logic to not save the default values.
This also simplifies the initial system-specific setup of both of these:
since we have defaults for all the preferences that get set up at
startup, we can just initialize those defaults to the system-specific
fonts then and there.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -268,8 +268,12 @@ void renumber_dives(int nr) */ static void setup_system_prefs(void) { - const char *env = getenv("LC_MEASUREMENT"); + const char *env; + default_prefs.divelist_font = strdup(system_divelist_default_font); + default_prefs.default_filename = strdup(system_default_filename()); + + env = getenv("LC_MEASUREMENT"); if (!env) env = getenv("LC_ALL"); if (!env) @@ -307,7 +311,7 @@ int main(int argc, char **argv) #if DEBUGFILE > 1 debugfile = stderr; #elif defined(DEBUGFILE) - debugfilename = (char *)subsurface_default_filename(); + debugfilename = strdup(prefs.default_filename); strncpy(debugfilename + strlen(debugfilename) - 3, "log", 3); if (g_mkdir_with_parents(g_path_get_dirname(debugfilename), 0664) != 0 || (debugfile = g_fopen(debugfilename, "w")) == NULL) @@ -339,12 +343,11 @@ int main(int argc, char **argv) } if (no_filenames) { GError *error = NULL; - const char *filename = subsurface_default_filename(); + const char *filename = prefs.default_filename; parse_file(filename, &error, TRUE); /* don't report errors - this file may not exist, but make sure we remember this as the filename in use */ set_filename(filename, FALSE); - free((void *)filename); } report_dives(imported, FALSE); if (dive_table.nr == 0) |