Commit 7664c4b7 authored by Christian Hergert's avatar Christian Hergert
Browse files

workers: port to IdeTask

parent fe718a0e
......@@ -32,6 +32,7 @@
#include "workers/ide-worker-process.h"
#include "workers/ide-worker-manager.h"
#include "threading/ide-task.h"
struct _IdeWorkerManager
{
......@@ -225,21 +226,21 @@ ide_worker_manager_get_worker_cb (GObject *object,
gpointer user_data)
{
IdeWorkerProcess *worker_process = (IdeWorkerProcess *)object;
g_autoptr(GTask) task = user_data;
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
GDBusProxy *proxy;
IDE_ENTRY;
g_assert (IDE_IS_WORKER_PROCESS (worker_process));
g_assert (G_IS_TASK (task));
g_assert (IDE_IS_TASK (task));
proxy = ide_worker_process_get_proxy_finish (worker_process, result, &error);
if (proxy == NULL)
g_task_return_error (task, g_steal_pointer (&error));
ide_task_return_error (task, g_steal_pointer (&error));
else
g_task_return_pointer (task, proxy, g_object_unref);
ide_task_return_pointer (task, proxy, g_object_unref);
IDE_EXIT;
}
......@@ -252,13 +253,13 @@ ide_worker_manager_get_worker_async (IdeWorkerManager *self,
gpointer user_data)
{
IdeWorkerProcess *worker_process;
GTask *task;
IdeTask *task;
g_return_if_fail (IDE_IS_WORKER_MANAGER (self));
g_return_if_fail (plugin_name != NULL);
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
task = ide_task_new (self, cancellable, callback, user_data);
worker_process = ide_worker_manager_get_worker_process (self, plugin_name);
ide_worker_process_get_proxy_async (worker_process,
cancellable,
......@@ -271,12 +272,12 @@ ide_worker_manager_get_worker_finish (IdeWorkerManager *self,
GAsyncResult *result,
GError **error)
{
GTask *task = (GTask *)result;
IdeTask *task = (IdeTask *)result;
g_return_val_if_fail (IDE_IS_WORKER_MANAGER (self), NULL);
g_return_val_if_fail (G_IS_TASK (task), NULL);
g_return_val_if_fail (IDE_IS_TASK (task), NULL);
return g_task_propagate_pointer (task, error);
return ide_task_propagate_pointer (task, error);
}
IdeWorkerManager *
......
......@@ -26,6 +26,7 @@
#include "logging/ide-log.h"
#include "workers/ide-worker-process.h"
#include "workers/ide-worker.h"
#include "threading/ide-task.h"
struct _IdeWorkerProcess
{
......@@ -363,7 +364,7 @@ ide_worker_process_matches_credentials (IdeWorkerProcess *self,
static void
ide_worker_process_create_proxy_for_task (IdeWorkerProcess *self,
GTask *task)
IdeTask *task)
{
GDBusProxy *proxy;
g_autoptr(GError) error = NULL;
......@@ -371,14 +372,14 @@ ide_worker_process_create_proxy_for_task (IdeWorkerProcess *self,
IDE_ENTRY;
g_assert (IDE_IS_WORKER_PROCESS (self));
g_assert (G_IS_TASK (task));
g_assert (IDE_IS_TASK (task));
if (self->worker == NULL)
{
g_task_return_new_error (task,
G_IO_ERROR,
G_IO_ERROR_PROXY_FAILED,
"Failed to create IdeWorker instance.");
ide_task_return_new_error (task,
G_IO_ERROR,
G_IO_ERROR_PROXY_FAILED,
"Failed to create IdeWorker instance.");
IDE_EXIT;
}
......@@ -390,11 +391,11 @@ ide_worker_process_create_proxy_for_task (IdeWorkerProcess *self,
error = g_error_new_literal (G_IO_ERROR,
G_IO_ERROR_PROXY_FAILED,
"IdeWorker returned NULL and did not set an error.");
g_task_return_error (task, g_steal_pointer (&error));
ide_task_return_error (task, g_steal_pointer (&error));
IDE_EXIT;
}
g_task_return_pointer (task, proxy, g_object_unref);
ide_task_return_pointer (task, proxy, g_object_unref);
IDE_EXIT;
}
......@@ -418,7 +419,7 @@ ide_worker_process_set_connection (IdeWorkerProcess *self,
for (i = 0; i < ar->len; i++)
{
GTask *task = g_ptr_array_index (ar, i);
IdeTask *task = g_ptr_array_index (ar, i);
ide_worker_process_create_proxy_for_task (self, task);
}
}
......@@ -431,14 +432,14 @@ ide_worker_process_get_proxy_async (IdeWorkerProcess *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
g_autoptr(IdeTask) task = NULL;
IDE_ENTRY;
g_return_if_fail (IDE_IS_WORKER_PROCESS (self));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
task = ide_task_new (self, cancellable, callback, user_data);
if (self->connection != NULL)
{
......@@ -459,15 +460,15 @@ ide_worker_process_get_proxy_finish (IdeWorkerProcess *self,
GAsyncResult *result,
GError **error)
{
GTask *task = (GTask *)result;
IdeTask *task = (IdeTask *)result;
GDBusProxy *ret;
IDE_ENTRY;
g_return_val_if_fail (IDE_IS_WORKER_PROCESS (self), NULL);
g_return_val_if_fail (G_IS_TASK (task), NULL);
g_return_val_if_fail (IDE_IS_TASK (task), NULL);
ret = g_task_propagate_pointer (task, error);
ret = ide_task_propagate_pointer (task, error);
IDE_RETURN (ret);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment