From 0ad5b642b457edb8e03197540e80face9b13023b Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Wed, 3 Jun 2009 12:58:43 +0000 Subject: [PATCH] Cache manager: Add "Invalidate" button Add an "Invalidate" button to the cache manager, which is useful when a cache entry is locked and cannot be deleted but one does not want ELinks to use that cache entry. --- NEWS | 1 + src/cache/dialogs.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/NEWS b/NEWS index 70e916f3..a30b2577 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,7 @@ Miscellaneous: Especially useful for multi-file BitTorrent downloads. * Report if the Lua function edit_bookmark_dialog receives the wrong number or types of arguments instead of silently failing. +* enhancement: Add ``Invalidate'' button to the cache manager. ////////////////////////////////////////////////////////////////////// The following changes should be removed from NEWS before ELinks 0.13.0 diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 55da14a6..5b48eb59 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -242,12 +242,32 @@ static const struct listbox_ops cache_entry_listbox_ops = { &cache_messages, }; +static widget_handler_status_T +push_invalidate_button(struct dialog_data *dlg_data, struct widget_data *button) +{ + struct terminal *term = dlg_data->win->term; + struct listbox_data *box = get_dlg_listbox_data(dlg_data); + struct cache_entry *cached = box->sel->udata; + + if (!box->sel || !box->sel->udata) return EVENT_PROCESSED; + + assert(box->sel->type == BI_LEAF); + + cached->valid = 0; + + info_box(term, 0, N_("Cache entry invalidated"), ALIGN_CENTER, + N_("Cache entry invalidated.")); + + return EVENT_PROCESSED; +} + static const struct hierbox_browser_button cache_buttons[] = { /* [gettext_accelerator_context(.cache_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Delete"), push_hierbox_delete_button, 1 }, { N_("~Search"), push_hierbox_search_button, 1 }, + { N_("In~validate"), push_invalidate_button, 1 }, }; struct_hierbox_browser(