1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Introduce a macro listbox_message(msg) that tries ops->messages->msg

This commit is contained in:
Miciah Dashiel Butler Masters 2006-01-01 04:39:01 +00:00 committed by Miciah Dashiel Butler Masters
parent 6114066803
commit 985efb99b6

View File

@ -581,6 +581,11 @@ struct listbox_ops_messages default_listbox_ops_messages = {
NULL,
};
#define listbox_message(msg) \
ops->messages && ops->messages->msg \
? ops->messages->msg \
: default_listbox_ops_messages.msg
static void
print_delete_error(struct listbox_item *item, struct terminal *term,
struct listbox_ops *ops, enum delete_error err)
@ -592,29 +597,17 @@ print_delete_error(struct listbox_item *item, struct terminal *term,
switch (err) {
case DELETE_IMPOSSIBLE:
if (item->type == BI_FOLDER) {
if (ops->messages && ops->messages->cant_delete_folder)
errmsg = ops->messages->cant_delete_folder;
else
errmsg = default_listbox_ops_messages.cant_delete_folder;
errmsg = listbox_message(cant_delete_folder);
} else {
if (ops->messages && ops->messages->cant_delete_item)
errmsg = ops->messages->cant_delete_item;
else
errmsg = default_listbox_ops_messages.cant_delete_item;
errmsg = listbox_message(cant_delete_item);
}
break;
case DELETE_LOCKED:
if (item->type == BI_FOLDER) {
if (ops->messages && ops->messages->cant_delete_used_folder)
errmsg = ops->messages->cant_delete_used_folder;
else
errmsg = default_listbox_ops_messages.cant_delete_used_folder;
errmsg = listbox_message(cant_delete_used_folder);
} else {
if (ops->messages && ops->messages->cant_delete_used_item)
errmsg = ops->messages->cant_delete_used_item;
else
errmsg = default_listbox_ops_messages.cant_delete_used_item;
errmsg = listbox_message(cant_delete_used_item);
}
break;
@ -646,6 +639,8 @@ print_delete_error(struct listbox_item *item, struct terminal *term,
msg.source);
}
#undef listbox_message
static void
do_delete_item(struct listbox_item *item, struct listbox_context *info,
int last)