GTK thread cleanup, next round

This commit is contained in:
Oliver Duis 2011-07-04 18:49:13 +02:00
parent 5e4cbd02fc
commit 03da048a76
4 changed files with 8 additions and 32 deletions

View File

@ -535,13 +535,11 @@ struct spparams {
double val;
Glib::ustring str;
Gtk::ProgressBar *pProgress;
bool gtkEnter;
};
int _setprogressStr( void *p )
int setprogressStrUI( void *p )
{
spparams *s= (spparams*)p;
if (s->gtkEnter) gdk_threads_enter ();
if( ! s->str.empty() )
s->pProgress->set_text( M(s->str) );
@ -552,8 +550,6 @@ int _setprogressStr( void *p )
else
s->pProgress->modify_bg( Gtk::STATE_NORMAL,Gdk::Color("grey") );
}
if (s->gtkEnter) gdk_threads_leave ();
delete s;
return 0;
@ -564,8 +560,7 @@ void EditorPanel::setProgress (double p)
spparams *s=new spparams;
s->val = p;
s->pProgress = progressLabel;
s->gtkEnter = true;
g_idle_add (_setprogressStr, s);
g_idle_add (setprogressStrUI, s);
}
void EditorPanel::setProgressStr (Glib::ustring str)
@ -574,15 +569,13 @@ void EditorPanel::setProgressStr (Glib::ustring str)
s->str = str;
s->val = -1;
s->pProgress = progressLabel;
s->gtkEnter = true;
g_idle_add (_setprogressStr, s);
g_idle_add (setprogressStrUI, s);
}
// This is only called from the ThreadUI, so within the gtk thread
void EditorPanel::refreshProcessingState (bool inProcessingP) {
spparams *s=new spparams;
s->pProgress = progressLabel;
s->gtkEnter = false;
if (inProcessingP) {
if (processingStartedTime==0) processingStartedTime = ::time(NULL);
@ -618,7 +611,7 @@ void EditorPanel::refreshProcessingState (bool inProcessingP) {
isProcessing=inProcessingP;
_setprogressStr(s);
setprogressStrUI(s);
}
struct errparams {

View File

@ -404,19 +404,6 @@ FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname) {
return NULL;
}
FileBrowserEntry* FileBrowser::findEntry (const Glib::ustring& fname) {
// TODO: Check for Linux
#ifdef WIN32
Glib::RWLock::ReaderLock l(entryRW);
#endif
for (std::vector<ThumbBrowserEntryBase*>::iterator i=fd.begin(); i!=fd.end(); i++)
if ((*i)->filename==fname)
return (FileBrowserEntry*)*i;
return NULL;
}
void FileBrowser::close () {
if (fbih->pending)
fbih->destroyed = true;
@ -977,21 +964,19 @@ void FileBrowser::openPrevImage () {
}
}
int redrawtb (void* data) {
int refreshThumbImagesUI (void* data) {
((FileBrowser*)data)->_thumbRearrangementNeeded ();
return 0;
}
void FileBrowser::_thumbRearrangementNeeded () {
refreshThumbImages ();
}
void FileBrowser::thumbRearrangementNeeded () {
g_idle_add (redrawtb, this);
g_idle_add (refreshThumbImagesUI, this);
}
void FileBrowser::selectionChanged () {
notifySelectionListener ();

View File

@ -114,7 +114,6 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
void addEntry (FileBrowserEntry* entry); // can be called from any thread
void addEntry_ (FileBrowserEntry* entry); // this must be executed inside the gtk thread
FileBrowserEntry* delEntry (const Glib::ustring& fname); // return the entry if found here return NULL otherwise
FileBrowserEntry* findEntry (const Glib::ustring& fname); // return the entry if found here return NULL otherwise
void close ();
void setFileBrowserListener (FileBrowserListener* l) { tbl = l; }

View File

@ -546,7 +546,6 @@ void FileCatalog::_refreshProgressBar () {
hbb->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP"));
hbb->show_all ();
nb->set_tab_label(*filepanel,*hbb);
}
}
@ -623,7 +622,7 @@ void FileCatalog::previewsFinishedUI () {
}
// restart anything that might have been loaded low quality
fileBrowser->refreshQuickThumbImages();
fileBrowser->applyFilter (getFilter());
//fileBrowser->applyFilter (getFilter());
_refreshProgressBar();
filepanel->loadingThumbs(M("PROGRESSBAR_READY"),0);
}