diff --git a/rtdata/languages/default b/rtdata/languages/default index 3e2bff9e9..d23148c48 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -899,6 +899,7 @@ PREFERENCES_LEVAUTDN;Denoising level PREFERENCES_LEVDN;Cell size PREFERENCES_LISS;Auto multi-zone smoothing PREFERENCES_MAX;Maxi (Tile) +PREFERENCES_MAXRECENTFOLDERS;Maximum number of recent folders PREFERENCES_MED;Medium (Tile/2) PREFERENCES_MENUGROUPEXTPROGS;Group "Open with" PREFERENCES_MENUGROUPFILEOPERATIONS;Group "File operations" diff --git a/rtgui/options.cc b/rtgui/options.cc index 7ffb9d4b4..cbf5866ec 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -631,7 +631,7 @@ void Options::setDefaults () { lastVibranceCurvesDir = ""; lastProfilingReferenceDir = ""; lastBWCurvesDir = ""; - + maxRecentFolders = 15; } Options* Options::copyFrom (Options* other) { @@ -780,6 +780,9 @@ if (keyFile.has_group ("File Browser")) { if (keyFile.has_key ("File Browser", "menuGroupFileOperations")) menuGroupFileOperations = keyFile.get_boolean ("File Browser", "menuGroupFileOperations"); if (keyFile.has_key ("File Browser", "menuGroupProfileOperations")) menuGroupProfileOperations = keyFile.get_boolean ("File Browser", "menuGroupProfileOperations"); if (keyFile.has_key ("File Browser", "menuGroupExtProg")) menuGroupExtProg = keyFile.get_boolean ("File Browser", "menuGroupExtProg"); + if (keyFile.has_key ("File Browser", "MaxRecentFolders")) maxRecentFolders = keyFile.get_integer ("File Browser", "MaxRecentFolders"); + recentFolders.reserve(maxRecentFolders+10); // reserve some more than maxRecentFolders, because at runtime it stores more than that + if (keyFile.has_key ("File Browser", "RecentFolders")) recentFolders = keyFile.get_string_list ("File Browser", "RecentFolders"); } if (keyFile.has_group ("Clipping Indication")) { @@ -1081,8 +1084,15 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel); keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations); keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations); - keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); - + keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg); + keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders); + { + std::vector temp; + temp.reserve(maxRecentFolders); + for(unsigned int i=0;i recentFolders; // List containing all recent folders + Options (); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 9820ead15..31d2a66a5 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1116,6 +1116,16 @@ Gtk::Widget* Preferences::getFileBrowserPanel () { vbro->pack_start (*filmStripOverlayedFileNames, Gtk::PACK_SHRINK, 0); vbro->pack_start (*sameThumbSize, Gtk::PACK_SHRINK, 0); vbro->pack_start (*ckbInternalThumbIfUntouched, Gtk::PACK_SHRINK, 0); + + Gtk::HBox* hbrecent = Gtk::manage( new Gtk::HBox () ); + Gtk::Label* labrecent = Gtk::manage( new Gtk::Label (M("PREFERENCES_MAXRECENTFOLDERS")+":") ); + maxRecentFolders = Gtk::manage( new Gtk::SpinButton () ); + hbrecent->pack_start (*labrecent, Gtk::PACK_SHRINK, 4); + hbrecent->pack_start (*maxRecentFolders, Gtk::PACK_SHRINK, 4); + maxRecentFolders->set_digits (0); + maxRecentFolders->set_increments (1, 5); + maxRecentFolders->set_range (1, 25); + vbro->pack_start (*hbrecent, Gtk::PACK_SHRINK, 4); fro->add (*vbro); @@ -1411,7 +1421,8 @@ void Preferences::storePreferences () { moptions.parseExtensions.push_back (c[i][extensionColumns.ext]); moptions.parseExtensionsEnabled.push_back (c[i][extensionColumns.enabled]); } - + + moptions.maxRecentFolders = (int)maxRecentFolders->get_value(); moptions.maxThumbnailHeight = (int)maxThumbSize->get_value (); moptions.maxCacheEntries = (int)maxCacheEntries->get_value (); moptions.overlayedFileNames = overlayedFileNames->get_active (); @@ -1574,7 +1585,8 @@ void Preferences::fillPreferences () { row[extensionColumns.ext] = moptions.parseExtensions[i]; } - maxThumbSize->set_value (moptions.maxThumbnailHeight); + maxThumbSize->set_value (moptions.maxThumbnailHeight); + maxRecentFolders->set_value(moptions.maxRecentFolders); maxCacheEntries->set_value (moptions.maxCacheEntries); overlayedFileNames->set_active (moptions.overlayedFileNames); filmStripOverlayedFileNames->set_active(moptions.filmStripOverlayedFileNames); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index c7fa8e74b..a81dec5a4 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -121,7 +121,8 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener { Gtk::ColorButton* butNavGuideCol; Gtk::SpinButton* maxThumbSize; - Gtk::SpinButton* maxCacheEntries; + Gtk::SpinButton* maxCacheEntries; + Gtk::SpinButton* maxRecentFolders; Gtk::Button* clearThumbnails; Gtk::Button* clearProfiles; Gtk::Button* clearAll; diff --git a/rtgui/recentbrowser.cc b/rtgui/recentbrowser.cc index e8ee0afca..8d0abde1c 100644 --- a/rtgui/recentbrowser.cc +++ b/rtgui/recentbrowser.cc @@ -18,6 +18,7 @@ */ #include "recentbrowser.h" #include "multilangmgr.h" +#include "options.h" using namespace rtengine; @@ -27,6 +28,9 @@ RecentBrowser::RecentBrowser () : listener (NULL) { Gtk::Frame* frame = Gtk::manage (new Gtk::Frame (M("MAIN_FRAME_RECENT"))); frame->add (*recentDirs); + for(size_t i=0;iappend_text (options.recentFolders[i]); + } pack_start (*frame, Gtk::PACK_SHRINK, 4); @@ -43,6 +47,24 @@ void RecentBrowser::selectionChanged () { } void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile) { + + size_t numFolders = options.recentFolders.size(); + if(numFolders>0) { // search entry and move to top if it exists + size_t i; + for(i=0;i0) { + if(i