mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
config: Reset OPT_TOUCHED flags after a successful save.
Previously, they were reset by smart_config_string(), which was not called if the value of the option was saved by rewriting an existing command in elinks.conf. Also, it is better to reset the flags only after the file operations have actually succeeded.
This commit is contained in:
parent
ab8ef9698f
commit
6bd961246a
@ -982,6 +982,8 @@ write_config_file(unsigned char *prefix, unsigned char *name,
|
|||||||
if (ssi) {
|
if (ssi) {
|
||||||
secure_fputs(ssi, cfg_str);
|
secure_fputs(ssi, cfg_str);
|
||||||
ret = secure_close(ssi);
|
ret = secure_close(ssi);
|
||||||
|
if (!ret)
|
||||||
|
untouch_options(options->value.tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_config_dialog(term, config_file, secsave_errno, ret);
|
write_config_dialog(term, config_file, secsave_errno, ret);
|
||||||
|
@ -748,6 +748,19 @@ unmark_options_tree(LIST_OF(struct option) *tree)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
untouch_options(LIST_OF(struct option) *tree)
|
||||||
|
{
|
||||||
|
struct option *option;
|
||||||
|
|
||||||
|
foreach (option, *tree) {
|
||||||
|
option->flags &= ~OPT_TOUCHED;
|
||||||
|
|
||||||
|
if (option->type == OPT_TREE)
|
||||||
|
untouch_options(option->value.tree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_nonempty_tree(LIST_OF(struct option) *options)
|
check_nonempty_tree(LIST_OF(struct option) *options)
|
||||||
{
|
{
|
||||||
@ -851,10 +864,6 @@ smart_config_string(struct string *str, int print_comment, int i18n,
|
|||||||
|
|
||||||
fn(str, option, path, depth, /*pc*/1, 3, i18n);
|
fn(str, option, path, depth, /*pc*/1, 3, i18n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: We should maybe clear the touched flag only when really
|
|
||||||
* saving the stuff...? --pasky */
|
|
||||||
option->flags &= ~OPT_TOUCHED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ extern void register_change_hooks(const struct change_hook_info *change_hooks);
|
|||||||
|
|
||||||
extern LIST_OF(struct option) *init_options_tree(void);
|
extern LIST_OF(struct option) *init_options_tree(void);
|
||||||
extern void unmark_options_tree(LIST_OF(struct option) *);
|
extern void unmark_options_tree(LIST_OF(struct option) *);
|
||||||
|
extern void untouch_options(LIST_OF(struct option) *);
|
||||||
|
|
||||||
extern void smart_config_string(struct string *, int, int,
|
extern void smart_config_string(struct string *, int, int,
|
||||||
LIST_OF(struct option) *, unsigned char *, int,
|
LIST_OF(struct option) *, unsigned char *, int,
|
||||||
|
Loading…
Reference in New Issue
Block a user