mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Introduce and use local variable item, assigned the value of
This commit is contained in:
parent
5042a48750
commit
4eb0cbf271
@ -406,21 +406,22 @@ widget_handler_status_T
|
|||||||
push_hierbox_info_button(struct dialog_data *dlg_data, struct widget_data *button)
|
push_hierbox_info_button(struct dialog_data *dlg_data, struct widget_data *button)
|
||||||
{
|
{
|
||||||
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
||||||
|
struct listbox_item *item = box->sel;
|
||||||
struct terminal *term = dlg_data->win->term;
|
struct terminal *term = dlg_data->win->term;
|
||||||
struct listbox_context *context;
|
struct listbox_context *context;
|
||||||
unsigned char *msg;
|
unsigned char *msg;
|
||||||
|
|
||||||
if (!box->sel) return EVENT_PROCESSED;
|
if (!item) return EVENT_PROCESSED;
|
||||||
|
|
||||||
assert(box->ops);
|
assert(box->ops);
|
||||||
|
|
||||||
context = init_listbox_context(box, term, box->sel, NULL);
|
context = init_listbox_context(box, term, item, NULL);
|
||||||
if (!context) return EVENT_PROCESSED;
|
if (!context) return EVENT_PROCESSED;
|
||||||
|
|
||||||
msg = box->ops->get_info(context->item, term);
|
msg = box->ops->get_info(context->item, term);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
mem_free(context);
|
mem_free(context);
|
||||||
if (box->sel->type == BI_FOLDER) {
|
if (item->type == BI_FOLDER) {
|
||||||
info_box(term, 0, N_("Info"), ALIGN_CENTER,
|
info_box(term, 0, N_("Info"), ALIGN_CENTER,
|
||||||
N_("Press space to expand this folder."));
|
N_("Press space to expand this folder."));
|
||||||
}
|
}
|
||||||
@ -494,14 +495,15 @@ push_hierbox_goto_button(struct dialog_data *dlg_data,
|
|||||||
struct widget_data *button)
|
struct widget_data *button)
|
||||||
{
|
{
|
||||||
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
||||||
|
struct listbox_item *item = box->sel;
|
||||||
struct session *ses = dlg_data->dlg->udata;
|
struct session *ses = dlg_data->dlg->udata;
|
||||||
struct terminal *term = dlg_data->win->term;
|
struct terminal *term = dlg_data->win->term;
|
||||||
struct listbox_context *context;
|
struct listbox_context *context;
|
||||||
|
|
||||||
/* Do nothing with a folder */
|
/* Do nothing with a folder */
|
||||||
if (!box->sel) return EVENT_PROCESSED;
|
if (!item) return EVENT_PROCESSED;
|
||||||
|
|
||||||
context = init_listbox_context(box, term, box->sel, scan_for_marks);
|
context = init_listbox_context(box, term, item, scan_for_marks);
|
||||||
if (!context) return EVENT_PROCESSED;
|
if (!context) return EVENT_PROCESSED;
|
||||||
|
|
||||||
if (!context->item) {
|
if (!context->item) {
|
||||||
@ -510,11 +512,11 @@ push_hierbox_goto_button(struct dialog_data *dlg_data,
|
|||||||
context->box, 0, 0,
|
context->box, 0, 0,
|
||||||
goto_marked, context);
|
goto_marked, context);
|
||||||
|
|
||||||
} else if (box->sel->type == BI_FOLDER) {
|
} else if (item->type == BI_FOLDER) {
|
||||||
recursively_goto_each_listbox(ses, box->sel, box);
|
recursively_goto_each_listbox(ses, item, box);
|
||||||
|
|
||||||
} else if (box->sel->type == BI_LEAF) {
|
} else if (item->type == BI_LEAF) {
|
||||||
struct uri *uri = box->ops->get_uri(box->sel);
|
struct uri *uri = box->ops->get_uri(item);
|
||||||
|
|
||||||
if (uri) {
|
if (uri) {
|
||||||
goto_uri(ses, uri);
|
goto_uri(ses, uri);
|
||||||
@ -694,15 +696,16 @@ push_hierbox_delete_button(struct dialog_data *dlg_data,
|
|||||||
{
|
{
|
||||||
struct terminal *term = dlg_data->win->term;
|
struct terminal *term = dlg_data->win->term;
|
||||||
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
struct listbox_data *box = get_dlg_listbox_data(dlg_data);
|
||||||
|
struct listbox_item *item = box->sel;
|
||||||
struct listbox_context *context;
|
struct listbox_context *context;
|
||||||
unsigned char *text;
|
unsigned char *text;
|
||||||
enum delete_error delete;
|
enum delete_error delete;
|
||||||
|
|
||||||
if (!box->sel) return EVENT_PROCESSED;
|
if (!item) return EVENT_PROCESSED;
|
||||||
|
|
||||||
assert(box->ops && box->ops->can_delete && box->ops->delete);
|
assert(box->ops && box->ops->can_delete && box->ops->delete);
|
||||||
|
|
||||||
context = init_listbox_context(box, term, box->sel, scan_for_marks);
|
context = init_listbox_context(box, term, item, scan_for_marks);
|
||||||
if (!context) return EVENT_PROCESSED;
|
if (!context) return EVENT_PROCESSED;
|
||||||
|
|
||||||
context->widget_data = dlg_data->widgets_data;
|
context->widget_data = dlg_data->widgets_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user