Merge branch 'idle_harder' into dev
This commit is contained in:
@@ -1016,44 +1016,42 @@ void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, r
|
||||
// saveLabel->set_markup (Glib::ustring("<span foreground=\"#AA0000\" weight=\"bold\">") + M("MAIN_BUTTON_SAVE") + "</span>");
|
||||
}
|
||||
|
||||
struct spsparams {
|
||||
bool inProcessing;
|
||||
EditorPanelIdleHelper* epih;
|
||||
};
|
||||
|
||||
int setProgressStateUIThread (void* data)
|
||||
{
|
||||
|
||||
spsparams* p = static_cast<spsparams*> (data);
|
||||
|
||||
if (p->epih->destroyed) {
|
||||
if (p->epih->pending == 1) {
|
||||
delete p->epih;
|
||||
} else {
|
||||
p->epih->pending--;
|
||||
}
|
||||
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
p->epih->epanel->refreshProcessingState (p->inProcessing);
|
||||
p->epih->pending--;
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EditorPanel::setProgressState (bool inProcessing)
|
||||
{
|
||||
struct spsparams {
|
||||
bool inProcessing;
|
||||
EditorPanelIdleHelper* epih;
|
||||
};
|
||||
|
||||
epih->pending++;
|
||||
|
||||
spsparams* p = new spsparams;
|
||||
p->inProcessing = inProcessing;
|
||||
p->epih = epih;
|
||||
g_idle_add (setProgressStateUIThread, p);
|
||||
|
||||
const auto func = [](gpointer data) -> gboolean {
|
||||
spsparams* const p = static_cast<spsparams*>(data);
|
||||
|
||||
if (p->epih->destroyed) {
|
||||
if (p->epih->pending == 1) {
|
||||
delete p->epih;
|
||||
} else {
|
||||
p->epih->pending--;
|
||||
}
|
||||
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
p->epih->epanel->refreshProcessingState (p->inProcessing);
|
||||
p->epih->pending--;
|
||||
delete p;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
idle_register.add(func, p);
|
||||
}
|
||||
|
||||
void EditorPanel::setProgress (double p)
|
||||
@@ -1125,12 +1123,6 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
|
||||
setprogressStrUI (s);
|
||||
}
|
||||
|
||||
struct errparams {
|
||||
Glib::ustring descr;
|
||||
Glib::ustring title;
|
||||
EditorPanelIdleHelper* epih;
|
||||
};
|
||||
|
||||
void EditorPanel::displayError (Glib::ustring title, Glib::ustring descr)
|
||||
{
|
||||
GtkWidget* msgd = gtk_message_dialog_new_with_markup (nullptr,
|
||||
@@ -1146,38 +1138,43 @@ void EditorPanel::displayError (Glib::ustring title, Glib::ustring descr)
|
||||
gtk_widget_show_all (msgd);
|
||||
}
|
||||
|
||||
int disperrorUI (void* data)
|
||||
{
|
||||
errparams* p = static_cast<errparams*> (data);
|
||||
|
||||
if (p->epih->destroyed) {
|
||||
if (p->epih->pending == 1) {
|
||||
delete p->epih;
|
||||
} else {
|
||||
p->epih->pending--;
|
||||
}
|
||||
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
p->epih->epanel->displayError (p->title, p->descr);
|
||||
p->epih->pending--;
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EditorPanel::error (Glib::ustring title, Glib::ustring descr)
|
||||
{
|
||||
struct errparams {
|
||||
Glib::ustring descr;
|
||||
Glib::ustring title;
|
||||
EditorPanelIdleHelper* epih;
|
||||
};
|
||||
|
||||
epih->pending++;
|
||||
errparams* p = new errparams;
|
||||
errparams* const p = new errparams;
|
||||
p->descr = descr;
|
||||
p->title = title;
|
||||
p->epih = epih;
|
||||
g_idle_add (disperrorUI, p);
|
||||
|
||||
const auto func = [](gpointer data) -> gboolean {
|
||||
errparams* const p = static_cast<errparams*> (data);
|
||||
|
||||
if (p->epih->destroyed) {
|
||||
if (p->epih->pending == 1) {
|
||||
delete p->epih;
|
||||
} else {
|
||||
p->epih->pending--;
|
||||
}
|
||||
|
||||
delete p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
p->epih->epanel->displayError (p->title, p->descr);
|
||||
p->epih->pending--;
|
||||
delete p;
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
idle_register.add(func, p);
|
||||
}
|
||||
|
||||
void EditorPanel::info_toggled ()
|
||||
|
Reference in New Issue
Block a user