mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 21:00:40 +02:00
Move the validation of the CHOICE setting value
Also, use a FORMAT to show the error message.
This commit is contained in:
parent
6f795f020d
commit
9a30ab53df
4 changed files with 13 additions and 7 deletions
|
|
@ -387,15 +387,11 @@ gboolean settings_set_choice(const char *key, const char *value)
|
|||
|
||||
rec = settings_get_record(key);
|
||||
|
||||
if (rec != NULL && strarray_find(rec->choices, value) < 0) {
|
||||
char *msg = g_strjoinv(",", rec->choices);
|
||||
g_warning("Invalid value for '%s', must be one of: %s", key, msg);
|
||||
g_free(msg);
|
||||
|
||||
if (rec != NULL && strarray_find(rec->choices, value) < 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
settings_set_str(key, value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue