This is both a bug report and a discussion about the general need for the "clear cache" entries in the thumbnail context menu.
At step 4, the thumbnail should have been reverted to the embedded thumbnail since all cached files including the PP3 were deleted.
But should the "Cache" entry be there in the context menu at all? After all these years I still don't know the difference between "Clear from cache" -partial and -full. It doesn't seem like a feature which a user would ever need to use. If a user wants to clear the cache, they can go to Preferences > File Browser > Cache and click Clear All.
I agree 100%, let's kill those menu entries
@agriggio I use the per file 'Clear from cache full' quite often during development...
Ingo, how about a compile-time option to show/hide these menu entries then?
In regular use, I've never used these cache options. If I ever want to revert something, applying Neutral is easier than removing the pp3. And maybe contrary to others, I don't really care about what the thumbnail shows me...
Alberto, a compile time option would be good. When working on supporting currently unsupported files it's really good to have the possibility to clear the cache for only a few files.
With this patch to get the cache-submenu in context-menu you have to add
-DWITH_CACHEMENU="ON" to your cmake command.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2739c4da..25977f5ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,6 +125,7 @@ endif()
option(USE_EXPERIMENTAL_LANG_VERSIONS "Build with -std=c++0x" OFF)
option(BUILD_SHARED "Build with shared libraries" OFF)
option(WITH_BENCHMARK "Build with benchmark code" OFF)
+option(WITH_CACHEMENU "Allow clear cache from context menu" OFF)
option(WITH_MYFILE_MMAP "Build using memory mapped file" ON)
option(WITH_LTO "Build with link-time optimizations" OFF)
option(WITH_SAN "Build with run-time sanitizer" OFF)
@@ -340,6 +341,10 @@ if(WITH_MYFILE_MMAP)
add_definitions(-DMYFILE_MMAP)
endif()
+if(WITH_CACHEMENU)
+ add_definitions(-DCACHEMENU)
+endif()
+
if(WITH_LTO)
# Using LTO with older versions of binutils requires setting extra flags
SET(BINUTILS_VERSION_MININUM "2.29")
diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc
index f83e39146..742845010 100644
--- a/rtgui/filebrowser.cc
+++ b/rtgui/filebrowser.cc
@@ -390,10 +390,11 @@ FileBrowser::FileBrowser () :
pmenu->attach (*Gtk::manage(menuFF = new Gtk::MenuItem (M("FILEBROWSER_FLATFIELD"))), 0, 1, p, p + 1);
p++;
+#ifdef CACHEMENU
pmenu->attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1);
p++;
pmenu->attach (*Gtk::manage(cachemenu = new Gtk::MenuItem (M("FILEBROWSER_CACHE"))), 0, 1, p, p + 1);
-
+#endif
pmenu->show_all ();
/***********************
@@ -451,7 +452,6 @@ FileBrowser::FileBrowser () :
applypartprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), applypartprof));
resetdefaultprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), resetdefaultprof));
clearprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearprof));
- cachemenu->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), cachemenu));
// A separate pop-up menu for Color Labels
int c = 0;
@@ -540,6 +540,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry)
submenuFF->show_all ();
menuFF->set_submenu (*submenuFF);
+#ifdef CACHEMENU
// build cache sub menu
p = 0;
Gtk::Menu* cachesubmenu = Gtk::manage (new Gtk::Menu ());
@@ -551,7 +552,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry)
clearFromCacheFull->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearFromCacheFull));
cachesubmenu->show_all ();
cachemenu->set_submenu (*cachesubmenu);
-
+#endif
pmenu->popup (3, this->eventTime);
}
There are things which don't really belong in a stable release, but development releases could absolutely have them. This cache item is one such thing. Maybe a more generic WITH_DEVTOOLS=true or IS_RELEASE=false or something to that affect would be more future-proof, allowing to automatically show/hide other dev-only things?
Most helpful comment
There are things which don't really belong in a stable release, but development releases could absolutely have them. This cache item is one such thing. Maybe a more generic
WITH_DEVTOOLS=trueorIS_RELEASE=falseor something to that affect would be more future-proof, allowing to automatically show/hide other dev-only things?