Listen to changed dirs when browsing recursively

Remove images in removed directories and rescan when new directories are
added.
This commit is contained in:
Lawrence Lee 2023-06-11 18:28:16 -07:00
parent eef54f0f2d
commit 051bbaf322
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F

View File

@ -1783,7 +1783,7 @@ void FileCatalog::reparseDirectory ()
return;
}
// check if a thumbnailed file has been deleted
// check if a thumbnailed file has been deleted or is not in a directory of interest
const std::vector<ThumbBrowserEntryBase*>& t = fileBrowser->getEntries();
std::vector<Glib::ustring> fileNamesToDel;
std::vector<Glib::ustring> fileNamesToRemove;
@ -1832,8 +1832,10 @@ void FileCatalog::reparseDirectory ()
void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal)
{
if (options.has_retained_extention(file->get_parse_name())
&& (event_type == Gio::FILE_MONITOR_EVENT_CREATED || event_type == Gio::FILE_MONITOR_EVENT_DELETED || event_type == Gio::FILE_MONITOR_EVENT_CHANGED)) {
if ((options.has_retained_extention(file->get_parse_name())
&& (event_type == Gio::FILE_MONITOR_EVENT_CREATED || event_type == Gio::FILE_MONITOR_EVENT_DELETED || event_type == Gio::FILE_MONITOR_EVENT_CHANGED))
|| (event_type == Gio::FILE_MONITOR_EVENT_CREATED && Glib::file_test(file->get_path(), Glib::FileTest::FILE_TEST_IS_DIR))
|| (event_type == Gio::FILE_MONITOR_EVENT_DELETED && std::find_if(dirMonitors.cbegin(), dirMonitors.cend(), [&file](const FileMonitorInfo &monitor) { return monitor.filePath == file->get_path(); }) != dirMonitors.cend())) {
if (!internal) {
GThreadLock lock;
reparseDirectory ();