Replace g_idle_add_full() with IdleRegister (#3767)

This commit is contained in:
Flössie
2017-03-30 21:40:09 +02:00
parent 91f8e46029
commit 6e1f7df2fb
6 changed files with 64 additions and 62 deletions

View File

@@ -24,14 +24,6 @@
#include "soundman.h"
#include "rtimage.h"
int processLoadedBatchQueueUIThread (void* data)
{
BatchQueue* bq = static_cast<BatchQueue*>(data);
bq->resizeLoadedQueue();
return 0;
}
static Glib::ustring makeFolderLabel(Glib::ustring path)
{
if (!Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
@@ -185,11 +177,22 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog)
show_all ();
if (batchQueue->loadBatchQueue ()) {
g_idle_add_full (G_PRIORITY_LOW, processLoadedBatchQueueUIThread, batchQueue, nullptr);
if (batchQueue->loadBatchQueue()) {
const auto func = [](gpointer data) -> gboolean {
static_cast<BatchQueue*>(data)->resizeLoadedQueue();
return FALSE;
};
idle_register.add(func, batchQueue, G_PRIORITY_LOW);
}
}
BatchQueuePanel::~BatchQueuePanel()
{
idle_register.destroy();
}
void BatchQueuePanel::init (RTWindow *parent)
{
this->parent = parent;