[grilo] net: use G_IO_ERROR on cancelled operation



commit 1a89d35172abe0e7344f7f99f9802bfba1177a9a
Author: Victor Toso <me victortoso com>
Date:   Wed May 25 21:51:52 2016 +0200

    net: use G_IO_ERROR on cancelled operation
    
    By deprecating GRL_NET_WC_ERROR_CANCELLED we can use
    G_IO_ERROR_CANCELLED instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764077

 libs/net/grl-net-wc.c |   10 +++++-----
 libs/net/grl-net-wc.h |    3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index 2cb20fa..c798847 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -482,8 +482,8 @@ parse_error (guint status,
                                      response);
     return;
   case SOUP_STATUS_CANCELLED:
-    g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
-                                     GRL_NET_WC_ERROR_CANCELLED,
+    g_simple_async_result_set_error (result, G_IO_ERROR,
+                                     G_IO_ERROR_CANCELLED,
                                      _("Operation was cancelled"));
     return;
   default:
@@ -590,9 +590,9 @@ read_async_cb (GObject *source,
   g_object_unref (source);
 
   if (error) {
-    if (error->code == G_IO_ERROR_CANCELLED) {
-      g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
-                                       GRL_NET_WC_ERROR_CANCELLED,
+    if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+      g_simple_async_result_set_error (result, G_IO_ERROR,
+                                       G_IO_ERROR_CANCELLED,
                                        _("Operation was cancelled"));
     } else {
       g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
diff --git a/libs/net/grl-net-wc.h b/libs/net/grl-net-wc.h
index 8d660ac..d28fb77 100644
--- a/libs/net/grl-net-wc.h
+++ b/libs/net/grl-net-wc.h
@@ -43,7 +43,8 @@ G_BEGIN_DECLS
  * @GRL_NET_WC_ERROR_NETWORK_ERROR: Cannot connect to the server
  * @GRL_NET_WC_ERROR_PROXY_ERROR: Deprecated. You should check for
  * G_IO_ERROR_PROXY_FAILED from G_IO_ERROR domain.
- * @GRL_NET_WC_ERROR_CANCELLED: The operation has been cancelled (see #GCancellable)
+ * @GRL_NET_WC_ERROR_CANCELLED: Deprecated. You should check for
+ * G_IO_ERROR_CANCELLED from G_IO_ERROR domain.
  *
  * These constants identify all the available errors managed by
  * the web client.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]