prevent launching image opening if there is one in progress

This commit is contained in:
Andrey Skvortsov
2010-09-18 22:46:36 -07:00
parent c16563902c
commit f7f984033d
2 changed files with 9 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ int fbinit (void* data) {
FilePanel::FilePanel () : parent(NULL) { FilePanel::FilePanel () : parent(NULL) {
isloading = false;
dirpaned = new Gtk::HPaned (); dirpaned = new Gtk::HPaned ();
dirpaned->set_position (options.dirBrowserWidth); dirpaned->set_position (options.dirBrowserWidth);
@@ -140,6 +141,10 @@ bool FilePanel::fileSelected (Thumbnail* thm) {
// try to open the file // try to open the file
// fileCatalog->setEnabled (false); // fileCatalog->setEnabled (false);
if (isloading)
return false;
isloading = true;
ProgressConnector<rtengine::InitialImage*> *ld = new ProgressConnector<rtengine::InitialImage*>(); ProgressConnector<rtengine::InitialImage*> *ld = new ProgressConnector<rtengine::InitialImage*>();
ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType()==FT_Raw, &error, parent->getProgressListener()), ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType()==FT_Raw, &error, parent->getProgressListener()),
sigc::bind(sigc::mem_fun(*this,&FilePanel::imageLoaded), thm, ld) ); sigc::bind(sigc::mem_fun(*this,&FilePanel::imageLoaded), thm, ld) );
@@ -178,10 +183,12 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
msgd.run (); msgd.run ();
} }
delete pc; delete pc;
parent->setProgress(0.); parent->setProgress(0.);
parent->setProgressStr(""); parent->setProgressStr("");
// fileCatalog->setEnabled (true); // fileCatalog->setEnabled (true);
isloading = false;
return false; // MUST return false from idle function return false; // MUST return false from idle function
} }

View File

@@ -52,7 +52,7 @@ class FilePanel : public Gtk::HPaned,
Gtk::Notebook* rightNotebook; Gtk::Notebook* rightNotebook;
int error; int error;
bool isloading;
public: public:
FilePanel (); FilePanel ();