From f7f984033dc5fe4d80e023fb7f99898be25b5b99 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Sat, 18 Sep 2010 22:46:36 -0700 Subject: [PATCH] prevent launching image opening if there is one in progress --- rtgui/filepanel.cc | 9 ++++++++- rtgui/filepanel.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 2b9f67d98..ebac0cd29 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -30,6 +30,7 @@ int fbinit (void* data) { FilePanel::FilePanel () : parent(NULL) { + isloading = false; dirpaned = new Gtk::HPaned (); dirpaned->set_position (options.dirBrowserWidth); @@ -140,6 +141,10 @@ bool FilePanel::fileSelected (Thumbnail* thm) { // try to open the file // fileCatalog->setEnabled (false); + if (isloading) + return false; + + isloading = true; ProgressConnector *ld = new ProgressConnector(); 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) ); @@ -178,10 +183,12 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnectorsetProgress(0.); parent->setProgressStr(""); // fileCatalog->setEnabled (true); + isloading = false; + return false; // MUST return false from idle function } diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index 0b485608f..7aeba50d7 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -52,7 +52,7 @@ class FilePanel : public Gtk::HPaned, Gtk::Notebook* rightNotebook; int error; - + bool isloading; public: FilePanel ();