We want the exported functions to follow the gio async idom. Currently, both install() and uninstall() are paired with install_finish(). In the following patch we introduce uninstall_async() uninstall_finish() using that common internal op_finish() function. Then we correctly pair associated async/finish() calls. --- gtk/win-usb-driver-install.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/gtk/win-usb-driver-install.c b/gtk/win-usb-driver-install.c index 928b38f..2e2a48b 100644 --- a/gtk/win-usb-driver-install.c +++ b/gtk/win-usb-driver-install.c @@ -325,7 +325,25 @@ void spice_win_usb_driver_op(SpiceWinUsbDriver *self, g_clear_object(&result); } +/** + * Returns: currently returns 0 (failure) and 1 (success) + * possibly later we'll add error-codes + */ +static gint +spice_win_usb_driver_op_finish(SpiceWinUsbDriver *self, + GAsyncResult *res, GError **err) +{ + GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(res); + g_return_val_if_fail(SPICE_IS_WIN_USB_DRIVER(self), 0); + g_return_val_if_fail(g_simple_async_result_is_valid(res, G_OBJECT(self), + spice_win_usb_driver_op), + FALSE); + if (g_simple_async_result_propagate_error(result, err)) + return 0; + + return self->priv->reply.status; +} /** * spice_win_usb_driver_install: @@ -362,25 +380,11 @@ void spice_win_usb_driver_uninstall(SpiceWinUsbDriver *self, callback, user_data); } - -/** - * Returns: currently returns 0 (failure) and 1 (success) - * possibly later we'll add error-codes - */ G_GNUC_INTERNAL gint spice_win_usb_driver_install_finish(SpiceWinUsbDriver *self, GAsyncResult *res, GError **err) { - GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(res); - - g_return_val_if_fail(SPICE_IS_WIN_USB_DRIVER(self), 0); - g_return_val_if_fail(g_simple_async_result_is_valid(res, G_OBJECT(self), - spice_win_usb_driver_op), - FALSE); - if (g_simple_async_result_propagate_error(result, err)) - return 0; - - return self->priv->reply.status; + return spice_win_usb_driver_op_finish(self, res, err); } G_GNUC_INTERNAL -- 1.8.5.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel