diff options
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/IconLoader.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unity-shared/IconLoader.cpp b/unity-shared/IconLoader.cpp index 3cdd9def1..aca8191f9 100644 --- a/unity-shared/IconLoader.cpp +++ b/unity-shared/IconLoader.cpp @@ -634,6 +634,9 @@ private: void PushSchedulerJob() { +#if G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 + g_io_scheduler_push_job (LoaderJobFunc, this, nullptr, G_PRIORITY_HIGH_IDLE, nullptr); +#else glib::Object<GTask> task(g_task_new(nullptr, nullptr, [] (GObject*, GAsyncResult*, gpointer data) { auto self = static_cast<IconLoaderTask*>(data); self->LoadIconComplete(data); @@ -643,10 +646,15 @@ private: g_task_set_task_data(task, this, nullptr); g_task_run_in_thread(task, LoaderJobFunc); +#endif } // Loading/rendering of pixbufs is done in a separate thread +#if G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 + static gboolean LoaderJobFunc(GIOSchedulerJob* job, GCancellable *canc, gpointer data) +#else static void LoaderJobFunc(GTask* job, gpointer source_object, gpointer data, GCancellable* canc) +#endif { auto task = static_cast<IconLoaderTask*>(data); @@ -676,6 +684,11 @@ private: g_input_stream_close(stream, canc, nullptr); } } + +#if G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 + g_io_scheduler_job_send_to_mainloop_async (job, LoadIconComplete, task, nullptr); + return FALSE; +#endif } // this will be invoked back in the thread from which push_job was called |
