diff --git a/rtdata/languages/default b/rtdata/languages/default
index c23410661..0b581d05d 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -1824,6 +1824,8 @@ PREFERENCES_BEHADDALLHINT;Set all parameters to the Add mode.\nAdjustment
PREFERENCES_BEHAVIOR;Behavior
PREFERENCES_BEHSETALL;All to 'Set'
PREFERENCES_BEHSETALLHINT;Set all parameters to the Set mode.\nAdjustments of parameters in the batch tool panel will be absolute, the actual values will be displayed.
+PREFERENCES_BROWSERECURSIVEDEPTH;Browse sub-folders depth
+PREFERENCES_BROWSERECURSIVEMAXDIRS;Maximum sub-folders
PREFERENCES_CACHECLEAR;Clear
PREFERENCES_CACHECLEAR_ALL;Clear all cached files:
PREFERENCES_CACHECLEAR_ALLBUTPROFILES;Clear all cached files except for cached processing profiles:
diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc
index c9737704e..025fbb3ae 100644
--- a/rtgui/preferences.cc
+++ b/rtgui/preferences.cc
@@ -1389,6 +1389,24 @@ Gtk::Widget* Preferences::getFileBrowserPanel()
maxRecentFolders->set_range(1, 25);
vbro->pack_start(*hbrecent, Gtk::PACK_SHRINK, 4);
+ // Recursive browsing options.
+ Gtk::Box *hbBrowseRecursive = Gtk::manage(new Gtk::Box());
+ Gtk::Label *labBrowseRecursiveDepth = Gtk::manage(new Gtk::Label(M("PREFERENCES_BROWSERECURSIVEDEPTH") + ":"));
+ browseRecursiveDepth = Gtk::manage(new Gtk::SpinButton());
+ browseRecursiveDepth->set_digits(0);
+ browseRecursiveDepth->set_increments(1, 5);
+ browseRecursiveDepth->set_range(1, 999);
+ Gtk::Label *labBrowseRecursiveMaxDirs = Gtk::manage(new Gtk::Label(M("PREFERENCES_BROWSERECURSIVEMAXDIRS") + ":"));
+ browseRecursiveMaxDirs = Gtk::manage(new Gtk::SpinButton());
+ browseRecursiveMaxDirs->set_digits(0);
+ browseRecursiveMaxDirs->set_increments(1, 5);
+ browseRecursiveMaxDirs->set_range(1, 999);
+ hbBrowseRecursive->pack_start(*labBrowseRecursiveDepth, Gtk::PACK_SHRINK, 4);
+ hbBrowseRecursive->pack_start(*browseRecursiveDepth, Gtk::PACK_SHRINK, 4);
+ hbBrowseRecursive->pack_start(*labBrowseRecursiveMaxDirs, Gtk::PACK_SHRINK, 4);
+ hbBrowseRecursive->pack_start(*browseRecursiveMaxDirs, Gtk::PACK_SHRINK, 4);
+ vbro->pack_start(*hbBrowseRecursive, Gtk::PACK_SHRINK, 0);
+
fro->add(*vbro);
@@ -1864,6 +1882,8 @@ void Preferences::storePreferences()
moptions.filmStripOverlayedFileNames = filmStripOverlayedFileNames->get_active();
moptions.sameThumbSize = sameThumbSize->get_active();
moptions.internalThumbIfUntouched = ckbInternalThumbIfUntouched->get_active();
+ moptions.browseRecursiveDepth = static_cast(browseRecursiveDepth->get_value());
+ moptions.browseRecursiveMaxDirs = static_cast(browseRecursiveMaxDirs->get_value());
auto save_where = saveParamsPreference->get_active_row_number();
moptions.saveParamsFile = save_where == 0 || save_where == 2;
@@ -2089,6 +2109,8 @@ void Preferences::fillPreferences()
filmStripOverlayedFileNames->set_active(moptions.filmStripOverlayedFileNames);
sameThumbSize->set_active(moptions.sameThumbSize);
ckbInternalThumbIfUntouched->set_active(moptions.internalThumbIfUntouched);
+ browseRecursiveDepth->set_value(moptions.browseRecursiveDepth);
+ browseRecursiveMaxDirs->set_value(moptions.browseRecursiveMaxDirs);
saveParamsPreference->set_active(moptions.saveParamsFile ? (moptions.saveParamsCache ? 2 : 0) : 1);
diff --git a/rtgui/preferences.h b/rtgui/preferences.h
index 6e31761a4..829506894 100644
--- a/rtgui/preferences.h
+++ b/rtgui/preferences.h
@@ -194,6 +194,8 @@ class Preferences final :
Gtk::CheckButton* overlayedFileNames;
Gtk::CheckButton* filmStripOverlayedFileNames;
Gtk::CheckButton* sameThumbSize;
+ Gtk::SpinButton* browseRecursiveDepth;
+ Gtk::SpinButton* browseRecursiveMaxDirs;
Gtk::SpinButton* threadsSpinBtn;
Gtk::SpinButton* clutCacheSizeSB;