mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-30 18:22:50 -05:00
conf_editbox_handler: support the new string types.
Now you can use an ordinary edit box in the config setup to talk to a string-valued Conf setting typed as any of CONF_TYPE_STR, CONF_TYPE_UTF8 or CONF_TYPE_STR_AMBI.
This commit is contained in:
parent
55d413a47a
commit
dc4ac7c4e1
16
config.c
16
config.c
@ -122,11 +122,19 @@ void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
|
|
||||||
if (type->type == EDIT_STR) {
|
if (type->type == EDIT_STR) {
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
char *field = conf_get_str(conf, key);
|
bool utf8;
|
||||||
dlg_editbox_set(ctrl, dlg, field);
|
char *field = conf_get_str_ambi(conf, key, &utf8);
|
||||||
|
if (utf8)
|
||||||
|
dlg_editbox_set_utf8(ctrl, dlg, field);
|
||||||
|
else
|
||||||
|
dlg_editbox_set(ctrl, dlg, field);
|
||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
char *field = dlg_editbox_get(ctrl, dlg);
|
char *field = dlg_editbox_get_utf8(ctrl, dlg);
|
||||||
conf_set_str(conf, key, field);
|
if (!conf_try_set_utf8(conf, key, field)) {
|
||||||
|
sfree(field);
|
||||||
|
field = dlg_editbox_get(ctrl, dlg);
|
||||||
|
conf_set_str(conf, key, field);
|
||||||
|
}
|
||||||
sfree(field);
|
sfree(field);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user