On Mon, Jan 18, 2016 at 10:05:46AM +0100, Fabiano Fidêncio wrote:
> Instead of using GSimpleAsyncResult, use the new GTask API, which is
> much more straightforward.
> ---
> src/usb-device-manager.c | 61
> ++++++++++++++++++++++++------------------------
> 1 file changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index c62f56e..1840177 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -1055,15 +1055,16 @@ static void
> spice_usb_device_manager_channel_connect_cb(
> GObject *gobject, GAsyncResult *channel_res, gpointer user_data)
> {
> SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(gobject);
> - GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(user_data);
> + GTask *task = G_TASK(user_data);
> GError *err = NULL;
>
> spice_usbredir_channel_connect_device_finish(channel, channel_res, &err);
> - if (err) {
> - g_simple_async_result_take_error(result, err);
> - }
> - g_simple_async_result_complete(result);
> - g_object_unref(result);
> + if (err)
> + g_task_return_error(task, err);
> + else
> + g_task_return_boolean(task, TRUE);
> +
> + g_object_unref(task);
> }
>
> #ifdef G_OS_WIN32
> @@ -1229,7 +1230,7 @@ static void
> spice_usb_device_manager_check_redir_on_connect(
> SpiceUsbDeviceManager *self, SpiceChannel *channel)
> {
> SpiceUsbDeviceManagerPrivate *priv = self->priv;
> - GSimpleAsyncResult *result;
> + GTask *task;
> SpiceUsbDevice *device;
> libusb_device *libdev;
> guint i;
> @@ -1254,15 +1255,19 @@ static void
> spice_usb_device_manager_check_redir_on_connect(
> libdev, 0) == 0) {
> /* Note: re-uses spice_usb_device_manager_connect_device_async's
> completion handling code! */
> - result = g_simple_async_result_new(G_OBJECT(self),
> - spice_usb_device_manager_auto_connect_cb,
> - spice_usb_device_ref(device),
> -
> spice_usb_device_manager_connect_device_async);
> + task = g_task_new(self,
> + NULL,
> + spice_usb_device_manager_auto_connect_cb,
> + spice_usb_device_ref(device));
> +
> + g_task_set_source_tag(task,
> + spice_usb_device_manager_connect_device_async);
> +I don't think this is used. Acked-by: Christophe Fergeau <[email protected]> Christophe
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/spice-devel
