[libgdata] [core] Consolidate generic errors



commit fec244fd5e1693d8d60893be25e64fb6c575c64b
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Jan 31 14:03:12 2010 +0000

    [core] Consolidate generic errors
    
    Consolidate the GDATA_SERVICE_ERROR_WITH_* generic errors, and convert
    everything to use GDATA_SERVICE_ERROR_PROTOCOL_ERROR instead. This is an API
    break, as the old errors have now been removed.

 docs/reference/gdata-sections.txt                  |    1 +
 gdata/gdata-access-handler.c                       |   24 ++++----
 gdata/gdata-download-stream.c                      |    6 +-
 gdata/gdata-service.c                              |   66 ++++++++++----------
 gdata/gdata-service.h                              |   58 ++++++++++-------
 gdata/gdata-upload-stream.c                        |    6 +-
 gdata/gdata.symbols                                |    1 +
 gdata/services/contacts/gdata-contacts-contact.c   |   12 ++--
 gdata/services/documents/gdata-documents-entry.c   |    2 +-
 .../documents/gdata-documents-presentation.c       |    2 +-
 gdata/services/documents/gdata-documents-service.c |   14 ++--
 .../documents/gdata-documents-spreadsheet.c        |    2 +-
 gdata/services/documents/gdata-documents-text.c    |    2 +-
 gdata/services/youtube/gdata-youtube-service.c     |   12 ++--
 14 files changed, 110 insertions(+), 98 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index a6d4287..2d42d10 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -6,6 +6,7 @@ GDataServiceClass
 GDataServiceError
 GDataAuthenticationError
 GDataParserError
+GDataOperationType
 GDataQueryProgressCallback
 gdata_service_authenticate
 gdata_service_authenticate_async
diff --git a/gdata/gdata-access-handler.c b/gdata/gdata-access-handler.c
index a43bce4..4b5fe99 100644
--- a/gdata/gdata-access-handler.c
+++ b/gdata/gdata-access-handler.c
@@ -69,7 +69,7 @@ gdata_access_handler_get_type (void)
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * A %GDATA_SERVICE_ERROR_WITH_QUERY will be returned if the server indicates there is a problem with the query.
+ * A %GDATA_SERVICE_ERROR_PROTOCOL_ERROR will be returned if the server indicates there is a problem with the query.
  *
  * For each rule in the response feed, @progress_callback will be called in the main thread. If there was an error parsing the XML response,
  * a #GDataParserError will be returned.
@@ -118,8 +118,8 @@ gdata_access_handler_get_rules (GDataAccessHandler *self, GDataService *service,
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (service, GDATA_SERVICE_ERROR_WITH_QUERY, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (service, GDATA_OPERATION_QUERY, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -151,7 +151,7 @@ gdata_access_handler_get_rules (GDataAccessHandler *self, GDataService *service,
  * If the rule is marked as already having been inserted a %GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED error will be returned immediately
  * (there will be no network requests).
  *
- * If there is an error inserting the rule, a %GDATA_SERVICE_ERROR_WITH_INSERTION error will be returned.
+ * If there is an error inserting the rule, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: an updated #GDataAccessRule, or %NULL
  *
@@ -207,8 +207,8 @@ gdata_access_handler_insert_rule (GDataAccessHandler *self, GDataService *servic
 	if (status != 201) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (service, GDATA_SERVICE_ERROR_WITH_INSERTION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (service, GDATA_OPERATION_INSERTION, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -273,7 +273,7 @@ get_soup_message (GDataAccessHandler *access_handler, GDataAccessRule *rule, con
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error updating the rule, a %GDATA_SERVICE_ERROR_WITH_UPDATE error will be returned.
+ * If there is an error updating the rule, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: an updated #GDataAccessRule, or %NULL
  *
@@ -321,8 +321,8 @@ gdata_access_handler_update_rule (GDataAccessHandler *self, GDataService *servic
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (service, GDATA_SERVICE_ERROR_WITH_UPDATE, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (service, GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -351,7 +351,7 @@ gdata_access_handler_update_rule (GDataAccessHandler *self, GDataService *servic
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error deleting the rule, a %GDATA_SERVICE_ERROR_WITH_DELETION error will be returned, unless the @rule was the owner's
+ * If there is an error deleting the rule, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned, unless the @rule was the owner's
  * rule; in which case, %GDATA_SERVICE_ERROR_FORBIDDEN will be returned without any network activity.
  *
  * Return value: %TRUE on success, %FALSE otherwise
@@ -404,8 +404,8 @@ gdata_access_handler_delete_rule (GDataAccessHandler *self, GDataService *servic
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (service, GDATA_SERVICE_ERROR_WITH_DELETION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (service, GDATA_OPERATION_DELETION, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return FALSE;
 	}
diff --git a/gdata/gdata-download-stream.c b/gdata/gdata-download-stream.c
index ee0137f..cc3c31c 100644
--- a/gdata/gdata-download-stream.c
+++ b/gdata/gdata-download-stream.c
@@ -282,8 +282,8 @@ gdata_download_stream_read (GInputStream *stream, void *buffer, gsize count, GCa
 
 		/* Set an appropriate error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (priv->service, GDATA_SERVICE_ERROR_WITH_DOWNLOAD, priv->message->status_code, priv->message->reason_phrase,
-					     NULL, 0, error);
+		klass->parse_error_response (priv->service, GDATA_OPERATION_DOWNLOAD, priv->message->status_code, priv->message->reason_phrase,
+		                             NULL, 0, error);
 		return 0;
 	}
 
@@ -456,7 +456,7 @@ create_network_thread (GDataDownloadStream *self, GError **error)
  * Creates a new #GDataDownloadStream, allowing a file to be downloaded from a GData service using standard #GInputStream API.
  *
  * As well as the standard GIO errors, calls to the #GInputStream API on a #GDataDownloadStream can also return any relevant specific error from
- * #GDataServiceError, or %GDATA_SERVICE_ERROR_WITH_DOWNLOAD in the general case.
+ * #GDataServiceError, or %GDATA_SERVICE_ERROR_PROTOCOL_ERROR in the general case.
  *
  * Return value: a new #GInputStream, or %NULL; unref with g_object_unref()
  *
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 638062c..72e6b49 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -64,8 +64,8 @@ static void gdata_service_get_property (GObject *object, guint property_id, GVal
 static void gdata_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static gboolean real_parse_authentication_response (GDataService *self, guint status, const gchar *response_body, gint length, GError **error);
 static void real_append_query_headers (GDataService *self, SoupMessage *message);
-static void real_parse_error_response (GDataService *self, GDataServiceError error_type, guint status, const gchar *reason_phrase,
-				       const gchar *response_body, gint length, GError **error);
+static void real_parse_error_response (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase,
+                                       const gchar *response_body, gint length, GError **error);
 static void notify_proxy_uri_cb (GObject *gobject, GParamSpec *pspec, GObject *self);
 
 struct _GDataServicePrivate {
@@ -329,7 +329,7 @@ real_append_query_headers (GDataService *self, SoupMessage *message)
 }
 
 static void
-real_parse_error_response (GDataService *self, GDataServiceError error_type, guint status, const gchar *reason_phrase, const gchar *response_body,
+real_parse_error_response (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase, const gchar *response_body,
 			   gint length, GError **error)
 {
 	/* See: http://code.google.com/apis/gdata/docs/2.0/reference.html#HTTPStatusCodes */
@@ -361,40 +361,40 @@ real_parse_error_response (GDataService *self, GDataServiceError error_type, gui
 			break;
 	}
 
-	/* If the error hasn't been handled already, throw a generic error corresponding to the action type */
-	switch (error_type) {
-		case GDATA_SERVICE_ERROR_WITH_INSERTION:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_INSERTION,
+	/* If the error hasn't been handled already, throw a generic error */
+	switch (operation_type) {
+		case GDATA_OPERATION_QUERY:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
+				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
+				     _("Error code %u when querying: %s"), status, response_body);
+			break;
+		case GDATA_OPERATION_INSERTION:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
 				     _("Error code %u when inserting an entry: %s"), status, response_body);
 			break;
-		case GDATA_SERVICE_ERROR_WITH_UPDATE:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_UPDATE,
+		case GDATA_OPERATION_UPDATE:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
 				     _("Error code %u when updating an entry: %s"), status, response_body);
 			break;
-		case GDATA_SERVICE_ERROR_WITH_DELETION:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_DELETION,
+		case GDATA_OPERATION_DELETION:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
 				     _("Error code %u when deleting an entry: %s"), status, response_body);
 			break;
-		case GDATA_SERVICE_ERROR_WITH_QUERY:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_QUERY,
-				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
-				     _("Error code %u when querying: %s"), status, response_body);
-			break;
-		case GDATA_SERVICE_ERROR_WITH_DOWNLOAD:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_DOWNLOAD,
+		case GDATA_OPERATION_DOWNLOAD:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
 				     _("Error code %u when downloading: %s"), status, response_body);
 			break;
-		case GDATA_SERVICE_ERROR_WITH_UPLOAD:
-			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_WITH_UPLOAD,
+		case GDATA_OPERATION_UPLOAD:
+			g_set_error (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
 				     /* Translators: the first parameter is an HTTP status, and the second is an error message returned by the server. */
 				     _("Error code %u when uploading: %s"), status, response_body);
 			break;
 		default:
-			/* We should not be called with anything other than the above four generic error types */
+			/* We should not be called with anything other than the above operation types */
 			g_assert_not_reached ();
 	}
 }
@@ -998,8 +998,8 @@ _gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *que
 	} else if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (self, GDATA_SERVICE_ERROR_WITH_QUERY, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (self, GDATA_OPERATION_QUERY, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -1023,7 +1023,7 @@ _gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *que
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * A %GDATA_SERVICE_ERROR_WITH_QUERY will be returned if the server indicates there is a problem with the query, but subclasses may override
+ * A %GDATA_SERVICE_ERROR_PROTOCOL_ERROR will be returned if the server indicates there is a problem with the query, but subclasses may override
  * this and return their own errors. See their documentation for more details.
  *
  * For each entry in the response feed, @progress_callback will be called in the main thread. If there was an error parsing the XML response,
@@ -1216,7 +1216,7 @@ gdata_service_insert_entry_finish (GDataService *self, GAsyncResult *async_resul
  * If the entry is marked as already having been inserted a %GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED error will be returned immediately
  * (there will be no network requests).
  *
- * If there is an error inserting the entry, a %GDATA_SERVICE_ERROR_WITH_INSERTION error will be returned. Currently, subclasses
+ * If there is an error inserting the entry, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned. Currently, subclasses
  * <emphasis>cannot</emphasis> cannot override this or provide more specific errors.
  *
  * Return value: an updated #GDataEntry, or %NULL
@@ -1267,8 +1267,8 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
 	if (status != 201) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (self, GDATA_SERVICE_ERROR_WITH_INSERTION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (self, GDATA_OPERATION_INSERTION, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -1390,7 +1390,7 @@ gdata_service_update_entry_finish (GDataService *self, GAsyncResult *async_resul
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error updating the entry, a %GDATA_SERVICE_ERROR_WITH_UPDATE error will be returned. Currently, subclasses
+ * If there is an error updating the entry, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned. Currently, subclasses
  * <emphasis>cannot</emphasis> cannot override this or provide more specific errors.
  *
  * Return value: an updated #GDataEntry, or %NULL
@@ -1444,8 +1444,8 @@ gdata_service_update_entry (GDataService *self, GDataEntry *entry, GCancellable
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (self, GDATA_SERVICE_ERROR_WITH_UPDATE, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (self, GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -1560,7 +1560,7 @@ gdata_service_delete_entry_finish (GDataService *self, GAsyncResult *async_resul
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error deleting the entry, a %GDATA_SERVICE_ERROR_WITH_DELETION error will be returned. Currently, subclasses
+ * If there is an error deleting the entry, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned. Currently, subclasses
  * <emphasis>cannot</emphasis> cannot override this or provide more specific errors.
  *
  * Return value: %TRUE on success, %FALSE otherwise
@@ -1608,8 +1608,8 @@ gdata_service_delete_entry (GDataService *self, GDataEntry *entry, GCancellable
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (self, GDATA_SERVICE_ERROR_WITH_DELETION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (self, GDATA_OPERATION_DELETION, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return FALSE;
 	}
diff --git a/gdata/gdata-service.h b/gdata/gdata-service.h
index c0e1141..66e8784 100644
--- a/gdata/gdata-service.h
+++ b/gdata/gdata-service.h
@@ -29,21 +29,37 @@
 G_BEGIN_DECLS
 
 /**
+ * GDataOperationType:
+ * @GDATA_OPERATION_QUERY: a query
+ * @GDATA_OPERATION_INSERTION: an insertion of a #GDataEntry
+ * @GDATA_OPERATION_UPDATE: an update of a #GDataEntry
+ * @GDATA_OPERATION_DELETION: a deletion of a #GDataEntry
+ * @GDATA_OPERATION_DOWNLOAD: a download of a file
+ * @GDATA_OPERATION_UPLOAD: an upload of a file
+ *
+ * Representations of the different operations performed by the library.
+ *
+ * Since: 0.6.0
+ **/
+typedef enum {
+	GDATA_OPERATION_QUERY = 1,
+	GDATA_OPERATION_INSERTION,
+	GDATA_OPERATION_UPDATE,
+	GDATA_OPERATION_DELETION,
+	GDATA_OPERATION_DOWNLOAD,
+	GDATA_OPERATION_UPLOAD
+} GDataOperationType;
+
+/**
  * GDataServiceError:
  * @GDATA_SERVICE_ERROR_UNAVAILABLE: The service is unavailable due to maintainence or other reasons
  * @GDATA_SERVICE_ERROR_PROTOCOL_ERROR: The client or server unexpectedly strayed from the protocol (fatal error)
- * @GDATA_SERVICE_ERROR_WITH_QUERY: Generic error when querying for entries
  * @GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED: An entry has already been inserted, and cannot be re-inserted
- * @GDATA_SERVICE_ERROR_WITH_INSERTION: Generic error when inserting an entry
  * @GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED: The user attempted to do something which required authentication, and they weren't authenticated
- * @GDATA_SERVICE_ERROR_WITH_UPDATE: Generic error when updating an entry
- * @GDATA_SERVICE_ERROR_WITH_DELETION: Generic error when deleting an entry
  * @GDATA_SERVICE_ERROR_NOT_FOUND: A requested resource (feed or entry) was not found on the server
  * @GDATA_SERVICE_ERROR_CONFLICT: There was a conflict when updating an entry on the server; the server-side copy was modified inbetween downloading
  * and uploading the modified entry
  * @GDATA_SERVICE_ERROR_FORBIDDEN: Generic error for a forbidden action (not due to having insufficient permissions)
- * @GDATA_SERVICE_ERROR_WITH_DOWNLOAD: Generic error when downloading a file (rather than querying for an entry)
- * @GDATA_SERVICE_ERROR_WITH_UPLOAD: Generic error when uploading a file (either inserting or updating an entry)
  * @GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER: A given query parameter was invalid for the query type
  *
  * Error codes for #GDataService operations.
@@ -51,17 +67,11 @@ G_BEGIN_DECLS
 typedef enum {
 	GDATA_SERVICE_ERROR_UNAVAILABLE = 1,
 	GDATA_SERVICE_ERROR_PROTOCOL_ERROR,
-	GDATA_SERVICE_ERROR_WITH_QUERY,
 	GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED,
-	GDATA_SERVICE_ERROR_WITH_INSERTION,
 	GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
-	GDATA_SERVICE_ERROR_WITH_UPDATE,
-	GDATA_SERVICE_ERROR_WITH_DELETION,
 	GDATA_SERVICE_ERROR_NOT_FOUND,
 	GDATA_SERVICE_ERROR_CONFLICT,
 	GDATA_SERVICE_ERROR_FORBIDDEN,
-	GDATA_SERVICE_ERROR_WITH_DOWNLOAD,
-	GDATA_SERVICE_ERROR_WITH_UPLOAD,
 	GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER
 } GDataServiceError;
 
@@ -155,8 +165,8 @@ typedef struct {
 
 	gboolean (*parse_authentication_response) (GDataService *self, guint status, const gchar *response_body, gint length, GError **error);
 	void (*append_query_headers) (GDataService *self, SoupMessage *message);
-	void (*parse_error_response) (GDataService *self, GDataServiceError error_type, guint status, const gchar *reason_phrase,
-				      const gchar *response_body, gint length, GError **error);
+	void (*parse_error_response) (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase,
+	                              const gchar *response_body, gint length, GError **error);
 } GDataServiceClass;
 
 GType gdata_service_get_type (void) G_GNUC_CONST;
@@ -165,34 +175,34 @@ GQuark gdata_authentication_error_quark (void) G_GNUC_CONST;
 
 gboolean gdata_service_authenticate (GDataService *self, const gchar *username, const gchar *password, GCancellable *cancellable, GError **error);
 void gdata_service_authenticate_async (GDataService *self, const gchar *username, const gchar *password,
-				       GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+                                       GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
 gboolean gdata_service_authenticate_finish (GDataService *self, GAsyncResult *async_result, GError **error);
 
 #include <gdata/gdata-query.h>
 
 GDataFeed *gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *query, GType entry_type,
-				GCancellable *cancellable,
-				GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) G_GNUC_WARN_UNUSED_RESULT;
+                                GCancellable *cancellable,
+                                GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 void gdata_service_query_async (GDataService *self, const gchar *feed_uri, GDataQuery *query, GType entry_type,
-				GCancellable *cancellable,
-				GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
-				GAsyncReadyCallback callback, gpointer user_data);
+                                GCancellable *cancellable,
+                                GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
+                                GAsyncReadyCallback callback, gpointer user_data);
 GDataFeed *gdata_service_query_finish (GDataService *self, GAsyncResult *async_result, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 
 GDataEntry *gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEntry *entry,
-					GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT;
+                                        GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 void gdata_service_insert_entry_async (GDataService *self, const gchar *upload_uri, GDataEntry *entry, GCancellable *cancellable,
-				       GAsyncReadyCallback callback, gpointer user_data);
+                                       GAsyncReadyCallback callback, gpointer user_data);
 GDataEntry *gdata_service_insert_entry_finish (GDataService *self, GAsyncResult *async_result, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 
 GDataEntry *gdata_service_update_entry (GDataService *self, GDataEntry *entry, GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 void gdata_service_update_entry_async (GDataService *self, GDataEntry *entry, GCancellable *cancellable,
-				       GAsyncReadyCallback callback, gpointer user_data);
+                                       GAsyncReadyCallback callback, gpointer user_data);
 GDataEntry *gdata_service_update_entry_finish (GDataService *self, GAsyncResult *async_result, GError **error) G_GNUC_WARN_UNUSED_RESULT;
 
 gboolean gdata_service_delete_entry (GDataService *self, GDataEntry *entry, GCancellable *cancellable, GError **error);
 void gdata_service_delete_entry_async (GDataService *self, GDataEntry *entry, GCancellable *cancellable,
-				       GAsyncReadyCallback callback, gpointer user_data);
+                                       GAsyncReadyCallback callback, gpointer user_data);
 gboolean gdata_service_delete_entry_finish (GDataService *self, GAsyncResult *async_result, GError **error);
 
 SoupURI *gdata_service_get_proxy_uri (GDataService *self);
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index b432fc0..dd1e141 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -523,8 +523,8 @@ upload_thread (GDataUploadStream *self)
 		/* Error! Store it in the structure, and it'll be returned by the next function in the main thread
 		 * which can give an error response.*/
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (priv->service, GDATA_SERVICE_ERROR_WITH_UPLOAD, status, priv->message->reason_phrase,
-					     priv->message->response_body->data, priv->message->response_body->length, &(priv->response_error));
+		klass->parse_error_response (priv->service, GDATA_OPERATION_UPLOAD, status, priv->message->reason_phrase,
+		                             priv->message->response_body->data, priv->message->response_body->length, &(priv->response_error));
 	}
 
 	/* Signal the main thread that the response is ready (good or bad) */
@@ -564,7 +564,7 @@ create_network_thread (GDataUploadStream *self, GError **error)
  * content type for the file, and should be in the service's list of acceptable content types.
  *
  * As well as the standard GIO errors, calls to the #GOutputStream API on a #GDataUploadStream can also return any relevant specific error from
- * #GDataServiceError, or %GDATA_SERVICE_ERROR_WITH_UPLOAD in the general case.
+ * #GDataServiceError, or %GDATA_SERVICE_ERROR_PROTOCOL_ERROR in the general case.
  *
  * Note that network communication won't begin until the first call to g_output_stream_write() on the #GDataUploadStream.
  *
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 2999a00..90c8364 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -245,6 +245,7 @@ gdata_calendar_service_query_own_calendars
 gdata_calendar_service_query_own_calendars_async
 gdata_calendar_service_query_events
 gdata_calendar_service_insert_event
+gdata_operation_type_get_type
 gdata_service_error_get_type
 gdata_authentication_error_get_type
 gdata_media_expression_get_type
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index a6d9bfc..57b9c62 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -1170,7 +1170,7 @@ gdata_contacts_contact_has_photo (GDataContactsContact *self)
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error getting the photo, a %GDATA_SERVICE_ERROR_WITH_QUERY error will be returned.
+ * If there is an error getting the photo, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: the image data, or %NULL; free with g_free()
  *
@@ -1221,8 +1221,8 @@ gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsServi
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (GDATA_SERVICE (service), GDATA_SERVICE_ERROR_WITH_QUERY, status, message->reason_phrase,
-					     message->response_body->data, message->response_body->length, error);
+		klass->parse_error_response (GDATA_SERVICE (service), GDATA_OPERATION_DOWNLOAD, status, message->reason_phrase,
+		                             message->response_body->data, message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -1257,7 +1257,7 @@ gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsServi
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error setting the photo, a %GDATA_SERVICE_ERROR_WITH_UPDATE error will be returned.
+ * If there is an error setting the photo, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: %TRUE on success, %FALSE otherwise
  *
@@ -1320,8 +1320,8 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *serv
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (service, GDATA_SERVICE_ERROR_WITH_UPDATE, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (service, GDATA_OPERATION_UPLOAD, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return FALSE;
 	}
diff --git a/gdata/services/documents/gdata-documents-entry.c b/gdata/services/documents/gdata-documents-entry.c
index 8f7e457..a189dff 100644
--- a/gdata/services/documents/gdata-documents-entry.c
+++ b/gdata/services/documents/gdata-documents-entry.c
@@ -582,7 +582,7 @@ notify_content_type_cb (GDataDownloadStream *download_stream, GParamSpec *pspec,
  *
  * If @service isn't authenticated, a %GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED is returned.
  *
- * If there is an error downloading the document, a %GDATA_SERVICE_ERROR_WITH_QUERY error will be returned.
+ * If there is an error downloading the document, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * If @destination_file is a directory, the file will be downloaded to this directory with the #GDataEntry:title and 
  * the appropriate extension as its filename.
diff --git a/gdata/services/documents/gdata-documents-presentation.c b/gdata/services/documents/gdata-documents-presentation.c
index 1203f38..5525b6a 100644
--- a/gdata/services/documents/gdata-documents-presentation.c
+++ b/gdata/services/documents/gdata-documents-presentation.c
@@ -113,7 +113,7 @@ gdata_documents_presentation_new (const gchar *id)
  * If @cancellable is not %NULL, then the operation can be cancelled by triggering the @cancellable object from another thread.
  * If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
  *
- * If there is an error getting the document, a %GDATA_SERVICE_ERROR_WITH_QUERY error will be returned.
+ * If there is an error getting the document, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * If @destination_file is a directory, then the file will be downloaded in this directory with the #GDataEntry:title with 
  * the apropriate extension as name.
diff --git a/gdata/services/documents/gdata-documents-service.c b/gdata/services/documents/gdata-documents-service.c
index f73947f..db05681 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -630,8 +630,8 @@ gdata_documents_service_move_document_to_folder (GDataDocumentsService *self, GD
 	if (status != 201) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (GDATA_SERVICE (self), GDATA_SERVICE_ERROR_WITH_INSERTION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (GDATA_SERVICE (self), GDATA_OPERATION_UPDATE, status, message->reason_phrase,
+		                             message->response_body->data, message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -641,7 +641,7 @@ gdata_documents_service_move_document_to_folder (GDataDocumentsService *self, GD
 
 	/* Parse the XML; and update the document*/
 	new_document = GDATA_DOCUMENTS_ENTRY (gdata_parsable_new_from_xml (G_OBJECT_TYPE (document), message->response_body->data,
-									   message->response_body->length, error));
+	                                                                   message->response_body->length, error));
 	g_object_unref (message);
 
 	return new_document;
@@ -680,7 +680,7 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
-				     _("You must be authenticated to move documents."));
+		                     _("You must be authenticated to move documents."));
 		return NULL;
 	}
 
@@ -728,8 +728,8 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 	if (status != 200) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
-		klass->parse_error_response (GDATA_SERVICE (self), GDATA_SERVICE_ERROR_WITH_INSERTION, status, message->reason_phrase, message->response_body->data,
-					     message->response_body->length, error);
+		klass->parse_error_response (GDATA_SERVICE (self), GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,
+		                             message->response_body->length, error);
 		g_object_unref (message);
 		return NULL;
 	}
@@ -739,7 +739,7 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 	/* Google's servers don't return an updated copy of the entry, so we have to query for it again.
 	 * See: http://code.google.com/p/gdata-issues/issues/detail?id=1380 */
 	return gdata_documents_service_query_single_document (self, G_OBJECT_TYPE (document), gdata_documents_entry_get_document_id (document),
-							      cancellable, error);
+	                                                      cancellable, error);
 }
 
 /**
diff --git a/gdata/services/documents/gdata-documents-spreadsheet.c b/gdata/services/documents/gdata-documents-spreadsheet.c
index 7629004..2ebf5d9 100644
--- a/gdata/services/documents/gdata-documents-spreadsheet.c
+++ b/gdata/services/documents/gdata-documents-spreadsheet.c
@@ -121,7 +121,7 @@ gdata_documents_spreadsheet_new (const gchar *id)
  * If @destination_file is a directory, then the file will be downloaded in this directory with the #GDataEntry:title with 
  * the apropriate extension as name.
  *
- * If there is an error getting the document, a %GDATA_SERVICE_ERROR_WITH_QUERY error will be returned.
+ * If there is an error getting the document, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: the document's data, or %NULL; unref with g_object_unref()
  *
diff --git a/gdata/services/documents/gdata-documents-text.c b/gdata/services/documents/gdata-documents-text.c
index 07718d4..18449c1 100644
--- a/gdata/services/documents/gdata-documents-text.c
+++ b/gdata/services/documents/gdata-documents-text.c
@@ -118,7 +118,7 @@ gdata_documents_text_new (const gchar *id)
  * If @destination_file is a directory, then the file will be downloaded in this directory with the #GDataEntry:title with 
  * the apropriate extension as name.
  *
- * If there is an error getting the document, a %GDATA_SERVICE_ERROR_WITH_QUERY error will be returned.
+ * If there is an error getting the document, a %GDATA_SERVICE_ERROR_PROTOCOL_ERROR error will be returned.
  *
  * Return value: the document's data, or %NULL; unref with g_object_unref()
  *
diff --git a/gdata/services/youtube/gdata-youtube-service.c b/gdata/services/youtube/gdata-youtube-service.c
index e973572..17ff72d 100644
--- a/gdata/services/youtube/gdata-youtube-service.c
+++ b/gdata/services/youtube/gdata-youtube-service.c
@@ -56,8 +56,8 @@ static void gdata_youtube_service_get_property (GObject *object, guint property_
 static void gdata_youtube_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static gboolean parse_authentication_response (GDataService *self, guint status, const gchar *response_body, gint length, GError **error);
 static void append_query_headers (GDataService *self, SoupMessage *message);
-static void parse_error_response (GDataService *self, GDataServiceError error_type, guint status, const gchar *reason_phrase,
-				  const gchar *response_body, gint length, GError **error);
+static void parse_error_response (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase,
+                                  const gchar *response_body, gint length, GError **error);
 
 struct _GDataYouTubeServicePrivate {
 	gchar *youtube_user;
@@ -224,8 +224,8 @@ append_query_headers (GDataService *self, SoupMessage *message)
 }
 
 static void
-parse_error_response (GDataService *self, GDataServiceError error_type, guint status, const gchar *reason_phrase, const gchar *response_body,
-		      gint length, GError **error)
+parse_error_response (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase, const gchar *response_body,
+                      gint length, GError **error)
 {
 	xmlDoc *doc;
 	xmlNode *node;
@@ -346,8 +346,8 @@ parse_error_response (GDataService *self, GDataServiceError error_type, guint st
 
 parent:
 	/* Chain up to the parent class */
-	GDATA_SERVICE_CLASS (gdata_youtube_service_parent_class)->parse_error_response (self, error_type, status, reason_phrase,
-											response_body, length, error);
+	GDATA_SERVICE_CLASS (gdata_youtube_service_parent_class)->parse_error_response (self, operation_type, status, reason_phrase,
+	                                                                                response_body, length, error);
 	return;
 }
 



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