# HG changeset patch # User zas_ # Date 1211496187 0 # Node ID ff8b802eac58005b9c7983894cff2fb06305dfa5 # Parent 8a8873e7a5523ecc5bc0dca90dde0e39a7f586fa Separate path building code from options loading code. Most code of load_options() is moved to new load_options_from(). ExifUIList initialization is moved to setup_default_options(). diff -r 8a8873e7a552 -r ff8b802eac58 src/main.c --- a/src/main.c Thu May 22 20:22:13 2008 +0000 +++ b/src/main.c Thu May 22 22:43:07 2008 +0000 @@ -13,6 +13,7 @@ #include "main.h" +#include "bar_exif.h" #include "cache.h" #include "collect.h" #include "collect-io.h" @@ -583,6 +584,9 @@ options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH); options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS); + + for (i = 0; ExifUIList[i].key; i++) + ExifUIList[i].current = ExifUIList[i].default_value; } static void exit_program_final(void) diff -r 8a8873e7a552 -r ff8b802eac58 src/rcfile.c --- a/src/rcfile.c Thu May 22 20:22:13 2008 +0000 +++ b/src/rcfile.c Thu May 22 22:43:07 2008 +0000 @@ -618,10 +618,11 @@ return TRUE; } -void load_options(void) + + +static gboolean load_options_from(const gchar *utf8_path) { FILE *f; - gchar *rc_path; gchar *rc_pathl; gchar s_buf[1024]; gchar option[1024]; @@ -629,19 +630,10 @@ gchar value_all[1024]; gint i; - for (i = 0; ExifUIList[i].key; i++) - ExifUIList[i].current = ExifUIList[i].default_value; - - rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); - - rc_pathl = path_from_utf8(rc_path); + rc_pathl = path_from_utf8(utf8_path); f = fopen(rc_pathl,"r"); g_free(rc_pathl); - if (!f) - { - g_free(rc_path); - return; - } + if (!f) return FALSE; while (fgets(s_buf, sizeof(s_buf), f)) { @@ -917,5 +909,14 @@ } fclose(f); + return TRUE; +} + +void load_options(void) +{ + gchar *rc_path; + + rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); + load_options_from(rc_path); g_free(rc_path); }