[Spice-devel] [PATCH spice-gtk 09/14] usb: use SPICE_CLIENT_ERROR_ prefix

Marc-André Lureau marcandre.lureau at gmail.com
Thu Apr 24 08:50:57 PDT 2014


To be consistent with GLib idioms, the code should use a common prefix for errors.
---
 gtk/channel-usbredir.c |  4 ++--
 gtk/spice-client.h     | 11 +++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index 239fe12..64487b3 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -654,12 +654,12 @@ static void usbredir_handle_msg(SpiceChannel *c, SpiceMsgIn *in)
             break;
         case usbredirhost_read_device_rejected:
             err = g_error_new(SPICE_CLIENT_ERROR,
-                              SPICE_CLIENT_USB_DEVICE_REJECTED,
+                              SPICE_CLIENT_ERROR_USB_DEVICE_REJECTED,
                               _("%s rejected by host"), desc);
             break;
         case usbredirhost_read_device_lost:
             err = g_error_new(SPICE_CLIENT_ERROR,
-                              SPICE_CLIENT_USB_DEVICE_LOST,
+                              SPICE_CLIENT_ERROR_USB_DEVICE_LOST,
                               _("%s disconnected (fatal IO error)"), desc);
             break;
         default:
diff --git a/gtk/spice-client.h b/gtk/spice-client.h
index 0e1e49d..e734cca 100644
--- a/gtk/spice-client.h
+++ b/gtk/spice-client.h
@@ -56,16 +56,23 @@ G_BEGIN_DECLS
 /**
  * SpiceClientError:
  * @SPICE_CLIENT_ERROR_FAILED: generic error code
+ * @SPICE_CLIENT_ERROR_USB_DEVICE_REJECTED: device redirection rejected by host
+ * @SPICE_CLIENT_ERROR_USB_DEVICE_LOST: device disconnected (fatal IO error)
  *
  * Error codes returned by spice-client API.
  */
 typedef enum
 {
     SPICE_CLIENT_ERROR_FAILED,
-    SPICE_CLIENT_USB_DEVICE_REJECTED,
-    SPICE_CLIENT_USB_DEVICE_LOST,
+    SPICE_CLIENT_ERROR_USB_DEVICE_REJECTED,
+    SPICE_CLIENT_ERROR_USB_DEVICE_LOST,
 } SpiceClientError;
 
+#ifndef SPICE_DISABLE_DEPRECATED
+#define SPICE_CLIENT_USB_DEVICE_REJECTED SPICE_CLIENT_ERROR_USB_DEVICE_REJECTED
+#define SPICE_CLIENT_USB_DEVICE_LOST SPICE_CLIENT_ERROR_USB_DEVICE_LOST
+#endif
+
 GQuark spice_client_error_quark(void);
 
 G_END_DECLS
-- 
1.8.5.3



More information about the Spice-devel mailing list