[Spice-devel] [PATCH spice-gtk 02/14] win-usb: introduce a spice_win_usb_driver_op_finish

Marc-André Lureau marcandre.lureau at gmail.com
Wed Apr 23 11:09:07 PDT 2014


---
 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



More information about the Spice-devel mailing list