GTK thread cleanup, next round
This commit is contained in:
parent
5e4cbd02fc
commit
03da048a76
@ -535,13 +535,11 @@ struct spparams {
|
|||||||
double val;
|
double val;
|
||||||
Glib::ustring str;
|
Glib::ustring str;
|
||||||
Gtk::ProgressBar *pProgress;
|
Gtk::ProgressBar *pProgress;
|
||||||
bool gtkEnter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int _setprogressStr( void *p )
|
int setprogressStrUI( void *p )
|
||||||
{
|
{
|
||||||
spparams *s= (spparams*)p;
|
spparams *s= (spparams*)p;
|
||||||
if (s->gtkEnter) gdk_threads_enter ();
|
|
||||||
|
|
||||||
if( ! s->str.empty() )
|
if( ! s->str.empty() )
|
||||||
s->pProgress->set_text( M(s->str) );
|
s->pProgress->set_text( M(s->str) );
|
||||||
@ -553,8 +551,6 @@ int _setprogressStr( void *p )
|
|||||||
s->pProgress->modify_bg( Gtk::STATE_NORMAL,Gdk::Color("grey") );
|
s->pProgress->modify_bg( Gtk::STATE_NORMAL,Gdk::Color("grey") );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->gtkEnter) gdk_threads_leave ();
|
|
||||||
|
|
||||||
delete s;
|
delete s;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -564,8 +560,7 @@ void EditorPanel::setProgress (double p)
|
|||||||
spparams *s=new spparams;
|
spparams *s=new spparams;
|
||||||
s->val = p;
|
s->val = p;
|
||||||
s->pProgress = progressLabel;
|
s->pProgress = progressLabel;
|
||||||
s->gtkEnter = true;
|
g_idle_add (setprogressStrUI, s);
|
||||||
g_idle_add (_setprogressStr, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::setProgressStr (Glib::ustring str)
|
void EditorPanel::setProgressStr (Glib::ustring str)
|
||||||
@ -574,15 +569,13 @@ void EditorPanel::setProgressStr (Glib::ustring str)
|
|||||||
s->str = str;
|
s->str = str;
|
||||||
s->val = -1;
|
s->val = -1;
|
||||||
s->pProgress = progressLabel;
|
s->pProgress = progressLabel;
|
||||||
s->gtkEnter = true;
|
g_idle_add (setprogressStrUI, s);
|
||||||
g_idle_add (_setprogressStr, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is only called from the ThreadUI, so within the gtk thread
|
// This is only called from the ThreadUI, so within the gtk thread
|
||||||
void EditorPanel::refreshProcessingState (bool inProcessingP) {
|
void EditorPanel::refreshProcessingState (bool inProcessingP) {
|
||||||
spparams *s=new spparams;
|
spparams *s=new spparams;
|
||||||
s->pProgress = progressLabel;
|
s->pProgress = progressLabel;
|
||||||
s->gtkEnter = false;
|
|
||||||
|
|
||||||
if (inProcessingP) {
|
if (inProcessingP) {
|
||||||
if (processingStartedTime==0) processingStartedTime = ::time(NULL);
|
if (processingStartedTime==0) processingStartedTime = ::time(NULL);
|
||||||
@ -618,7 +611,7 @@ void EditorPanel::refreshProcessingState (bool inProcessingP) {
|
|||||||
|
|
||||||
isProcessing=inProcessingP;
|
isProcessing=inProcessingP;
|
||||||
|
|
||||||
_setprogressStr(s);
|
setprogressStrUI(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct errparams {
|
struct errparams {
|
||||||
|
@ -404,19 +404,6 @@ FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname) {
|
|||||||
return NULL;
|
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 () {
|
void FileBrowser::close () {
|
||||||
if (fbih->pending)
|
if (fbih->pending)
|
||||||
fbih->destroyed = true;
|
fbih->destroyed = true;
|
||||||
@ -977,21 +964,19 @@ void FileBrowser::openPrevImage () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int redrawtb (void* data) {
|
int refreshThumbImagesUI (void* data) {
|
||||||
|
|
||||||
((FileBrowser*)data)->_thumbRearrangementNeeded ();
|
((FileBrowser*)data)->_thumbRearrangementNeeded ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::_thumbRearrangementNeeded () {
|
void FileBrowser::_thumbRearrangementNeeded () {
|
||||||
|
|
||||||
refreshThumbImages ();
|
refreshThumbImages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::thumbRearrangementNeeded () {
|
void FileBrowser::thumbRearrangementNeeded () {
|
||||||
|
g_idle_add (refreshThumbImagesUI, this);
|
||||||
g_idle_add (redrawtb, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::selectionChanged () {
|
void FileBrowser::selectionChanged () {
|
||||||
|
|
||||||
notifySelectionListener ();
|
notifySelectionListener ();
|
||||||
|
@ -114,7 +114,6 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
|
|||||||
void addEntry (FileBrowserEntry* entry); // can be called from any thread
|
void addEntry (FileBrowserEntry* entry); // can be called from any thread
|
||||||
void addEntry_ (FileBrowserEntry* entry); // this must be executed inside the gtk 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* 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 close ();
|
||||||
|
|
||||||
void setFileBrowserListener (FileBrowserListener* l) { tbl = l; }
|
void setFileBrowserListener (FileBrowserListener* l) { tbl = l; }
|
||||||
|
@ -546,7 +546,6 @@ void FileCatalog::_refreshProgressBar () {
|
|||||||
hbb->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP"));
|
hbb->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP"));
|
||||||
hbb->show_all ();
|
hbb->show_all ();
|
||||||
nb->set_tab_label(*filepanel,*hbb);
|
nb->set_tab_label(*filepanel,*hbb);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +622,7 @@ void FileCatalog::previewsFinishedUI () {
|
|||||||
}
|
}
|
||||||
// restart anything that might have been loaded low quality
|
// restart anything that might have been loaded low quality
|
||||||
fileBrowser->refreshQuickThumbImages();
|
fileBrowser->refreshQuickThumbImages();
|
||||||
fileBrowser->applyFilter (getFilter());
|
//fileBrowser->applyFilter (getFilter());
|
||||||
_refreshProgressBar();
|
_refreshProgressBar();
|
||||||
filepanel->loadingThumbs(M("PROGRESSBAR_READY"),0);
|
filepanel->loadingThumbs(M("PROGRESSBAR_READY"),0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user