summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2014-04-24 17:50:50 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2015-06-05 13:17:40 +0200
commit1c43d7e586155f7498e71484f878d52668cb43f9 (patch)
treeb8a879a241db7fb587f7285f4d3fc40bcdb3d0e1 /gtk
parenta5747389cdb13ba2ef98a2c70b963328fdfa5cb7 (diff)
win-usb: introduce a spice_win_usb_driver_op_finish
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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/win-usb-driver-install.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/gtk/win-usb-driver-install.c b/gtk/win-usb-driver-install.c
index 674a7c6..5bb623a 100644
--- a/gtk/win-usb-driver-install.c
+++ b/gtk/win-usb-driver-install.c
@@ -326,7 +326,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:
@@ -363,25 +381,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