[PATCH] wc: raise an error when the operation is cancelled



Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez igalia com>
---
 libs/net/grl-net-wc.c |    3 +++
 libs/net/grl-net-wc.h |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index 96922a1..0b6253f 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -252,6 +252,9 @@ 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,
+                                     "Operation was cancelled");
     return;
   default:
     g_message ("Unhandled status: %s", soup_status_get_phrase (status));
diff --git a/libs/net/grl-net-wc.h b/libs/net/grl-net-wc.h
index fd87f13..71dfd72 100644
--- a/libs/net/grl-net-wc.h
+++ b/libs/net/grl-net-wc.h
@@ -40,6 +40,7 @@ G_BEGIN_DECLS
  * @GRL_NET_WC_ERROR_FORBIDDEN: TBD
  * @GRL_NET_WC_ERROR_NETWORK_ERROR: Cannot connect to the server
  * @GRL_NET_WC_ERROR_PROXY_ERROR: Cannot connect to the proxy server
+ * @GRL_NET_WC_ERROR_CANCELLED: The operation has been cancelled (see #GCancellable)
  *
  * These constants identify all the available errors managed by
  * the web client.
@@ -53,6 +54,7 @@ typedef enum {
 	GRL_NET_WC_ERROR_FORBIDDEN,
 	GRL_NET_WC_ERROR_NETWORK_ERROR,
 	GRL_NET_WC_ERROR_PROXY_ERROR,
+	GRL_NET_WC_ERROR_CANCELLED,
 } GrlNetWcError;
 
 #define GRL_TYPE_NET_WC				\
-- 
1.7.2.3



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