diff options
author | Chris Davis <cd.rattan@gmail.com> | 2014-07-26 19:49:33 -0700 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-10-01 14:32:09 +0200 |
commit | 061d3e9a66f7f71cc6532fa6b0bcf47bf0fe3e35 (patch) | |
tree | bb7f10d42ec7b650a6ac14e3da54f07a7c09af05 /source3/utils/regedit_dialog.c | |
parent | a728c391d7d4f6474e37f7118ba6df14dc9da6fd (diff) | |
download | samba-061d3e9a66f7f71cc6532fa6b0bcf47bf0fe3e35.tar.gz |
regedit: move cursor to edited value in list and report edit errors
Signed-off-by: Chris Davis <cd.rattan@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils/regedit_dialog.c')
-rw-r--r-- | source3/utils/regedit_dialog.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/source3/utils/regedit_dialog.c b/source3/utils/regedit_dialog.c index 119219d4a35..3cef7a06d6d 100644 --- a/source3/utils/regedit_dialog.c +++ b/source3/utils/regedit_dialog.c @@ -1871,11 +1871,11 @@ static bool edit_on_submit(struct dialog *dia, struct dialog_section *section, } -WERROR dialog_edit_value(TALLOC_CTX *ctx, struct registry_key *key, - uint32_t type, const struct value_item *vitem, - bool force_binary) +int dialog_edit_value(TALLOC_CTX *ctx, struct registry_key *key, + uint32_t type, const struct value_item *vitem, + bool force_binary, WERROR *err, + const char **name) { - WERROR err; enum dialog_action action; struct dialog *dia; struct dialog_section *section; @@ -1947,17 +1947,25 @@ WERROR dialog_edit_value(TALLOC_CTX *ctx, struct registry_key *key, dialog_create(dia); - err = fill_value_buffer(dia, &edit); - if (!W_ERROR_IS_OK(err)) { - return err; + *err = fill_value_buffer(dia, &edit); + if (!W_ERROR_IS_OK(*err)) { + return DIALOG_CANCEL; } dialog_show(dia); - dialog_modal_loop(dia, &err, &action); + dialog_modal_loop(dia, err, &action); + + if (action == DIALOG_OK && name) { + if (vitem) { + *name = talloc_strdup(ctx, vitem->value_name); + } else if ((section = dialog_find_section(dia, "name"))) { + *name = dialog_section_text_field_get(ctx, section); + } + } talloc_free(dia); - return WERR_OK; + return action; } int dialog_select_type(TALLOC_CTX *ctx, int *type) |