diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2013-01-17 17:11:14 +0100 |
|---|---|---|
| committer | Andrea Azzarone <azzaronea@gmail.com> | 2013-01-17 17:11:14 +0100 |
| commit | fa1a24f868e1f9b4c96ccfe38cda141b5cb815c7 (patch) | |
| tree | 2ee51eda1ed77566bd13bff9bd0ef474241f6987 /unity-shared | |
| parent | 5a890d641918beaf04e13ec12314bf29add52c4b (diff) | |
Support older glib version too.
(bzr r3043.1.3)
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 |
