# HG changeset patch # User zas_ # Date 1211498246 0 # Node ID 0e8b802e54d553afb22b165d644dba8f71265416 # Parent 9b0ac8d58c89311dcff18e598f851c9c6df573a4 Move code from save_options() to new save_options_to() which takes the destination path as parameter. diff -r 9b0ac8d58c89 -r 0e8b802e54d5 src/rcfile.c --- a/src/rcfile.c Thu May 22 23:09:53 2008 +0000 +++ b/src/rcfile.c Thu May 22 23:17:26 2008 +0000 @@ -292,23 +292,19 @@ *----------------------------------------------------------------------------- */ -void save_options(void) +static gboolean save_options_to(const gchar *utf8_path) { SecureSaveInfo *ssi; - gchar *rc_path; gchar *rc_pathl; gint i; - 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); ssi = secure_open(rc_pathl); g_free(rc_pathl); if (!ssi) { - log_printf(_("error saving config file: %s\n"), rc_path); - g_free(rc_path); - return; + log_printf(_("error saving config file: %s\n"), utf8_path); + return FALSE; } #define WRITE_BOOL(_name_) write_bool_option(ssi, #_name_, options->_name_) @@ -589,12 +585,26 @@ if (secure_close(ssi)) - log_printf(_("error saving config file: %s\nerror: %s\n"), rc_path, - secsave_strerror(secsave_errno)); + { + log_printf(_("error saving config file: %s\nerror: %s\n"), utf8_path, + secsave_strerror(secsave_errno)); + return FALSE; + } + return TRUE; +} + +void save_options(void) +{ + gchar *rc_path; + + rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); + save_options_to(rc_path); g_free(rc_path); } + + /* *----------------------------------------------------------------------------- * load configuration (public)