[libgdata] contacts: Tighten the type of service in gdata_contacts_contact_set_photo()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] contacts: Tighten the type of service in gdata_contacts_contact_set_photo()
- Date: Fri, 10 Dec 2010 20:02:40 +0000 (UTC)
commit 2735092f558b98cfa58c71cdf167ba102b424ce2
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Dec 10 19:46:48 2010 +0000
contacts: Tighten the type of service in gdata_contacts_contact_set_photo()
We shouldn't support the use of a GDataService for one service with methods
for a different service.
This breaks the API of gdata_contacts_contact_set_photo() (again).
gdata/services/contacts/gdata-contacts-contact.c | 14 +++++++-------
gdata/services/contacts/gdata-contacts-contact.h | 2 +-
gdata/tests/contacts.c | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 76bb6dc..05a5520 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -3125,7 +3125,7 @@ gdata_contacts_contact_get_photo_finish (GDataContactsContact *self, GAsyncResul
/**
* gdata_contacts_contact_set_photo:
* @self: a #GDataContactsContact
- * @service: a #GDataService
+ * @service: a #GDataContactsService
* @data: (allow-none): the image data, or %NULL
* @length: the image length, in bytes
* @content_type: (allow-none): the content type of the image, or %NULL
@@ -3144,8 +3144,8 @@ gdata_contacts_contact_get_photo_finish (GDataContactsContact *self, GAsyncResul
* Since: 0.8.0
**/
gboolean
-gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const guint8 *data, gsize length, const gchar *content_type,
- GCancellable *cancellable, GError **error)
+gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataContactsService *service, const guint8 *data, gsize length,
+ const gchar *content_type, GCancellable *cancellable, GError **error)
{
GDataLink *_link;
SoupMessage *message;
@@ -3154,7 +3154,7 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *serv
/* TODO: async version */
g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), FALSE);
- g_return_val_if_fail (GDATA_IS_SERVICE (service), FALSE);
+ g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (service), FALSE);
g_return_val_if_fail (data == NULL || content_type != NULL, FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -3175,7 +3175,7 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *serv
soup_message_set_request (message, content_type, SOUP_MEMORY_STATIC, (gchar*) data, length);
/* Send the message */
- status = _gdata_service_send_message (service, message, cancellable, error);
+ status = _gdata_service_send_message (GDATA_SERVICE (service), message, cancellable, error);
if (status == SOUP_STATUS_NONE || status == SOUP_STATUS_CANCELLED) {
/* Redirect error or cancelled */
@@ -3185,8 +3185,8 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *serv
/* Error */
GDataServiceClass *klass = GDATA_SERVICE_GET_CLASS (service);
g_assert (klass->parse_error_response != NULL);
- klass->parse_error_response (service, GDATA_OPERATION_UPLOAD, status, message->reason_phrase, message->response_body->data,
- message->response_body->length, error);
+ klass->parse_error_response (GDATA_SERVICE (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/contacts/gdata-contacts-contact.h b/gdata/services/contacts/gdata-contacts-contact.h
index 6a5ebdd..1e565b7 100644
--- a/gdata/services/contacts/gdata-contacts-contact.h
+++ b/gdata/services/contacts/gdata-contacts-contact.h
@@ -286,7 +286,7 @@ void gdata_contacts_contact_get_photo_async (GDataContactsContact *self, GDataCo
guint8 *gdata_contacts_contact_get_photo_finish (GDataContactsContact *self, GAsyncResult *async_result, gsize *length, gchar **content_type,
GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
-gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *service, const guint8 *data, gsize length,
+gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataContactsService *service, const guint8 *data, gsize length,
const gchar *content_type, GCancellable *cancellable, GError **error);
G_END_DECLS
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index 14efeb8..0e383b9 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -1579,7 +1579,7 @@ test_photo_add (gconstpointer service)
/* Add it to the contact */
contact = get_contact (service);
- retval = gdata_contacts_contact_set_photo (contact, GDATA_SERVICE (service), data, length, "image/jpeg", NULL, &error);
+ retval = gdata_contacts_contact_set_photo (contact, GDATA_CONTACTS_SERVICE (service), data, length, "image/jpeg", NULL, &error);
g_assert_no_error (error);
g_assert (retval == TRUE);
@@ -1668,7 +1668,7 @@ test_photo_delete (gconstpointer service)
g_assert (gdata_contacts_contact_has_photo (contact) == TRUE);
/* Remove the contact's photo */
- g_assert (gdata_contacts_contact_set_photo (contact, GDATA_SERVICE (service), NULL, 0, NULL, NULL, &error) == TRUE);
+ g_assert (gdata_contacts_contact_set_photo (contact, GDATA_CONTACTS_SERVICE (service), NULL, 0, NULL, NULL, &error) == TRUE);
g_assert_no_error (error);
g_assert (gdata_contacts_contact_has_photo (contact) == FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]