[libgdata] Removed redundant parameters from insert and update functions
- From: Philip Withnall <pwithnall src gnome org>
- To: svn-commits-list gnome org
- Subject: [libgdata] Removed redundant parameters from insert and update functions
- Date: Sun, 19 Apr 2009 03:10:15 -0400 (EDT)
commit 47def37a7238f9454efd3120e5dbda09c90301d7
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Apr 19 08:08:47 2009 +0100
Removed redundant parameters from insert and update functions
Removed the entry_type parameters from _insert_entry and _update_entry, as
the entry's type can be acquired from the entry being inserted or updated
itself.
---
gdata/gdata-service.c | 17 ++++++-----------
gdata/gdata-service.h | 6 ++----
gdata/services/calendar/gdata-calendar-service.c | 2 +-
3 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 71407a7..f28d556 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -940,7 +940,6 @@ gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *quer
* @self: a #GDataService
* @upload_uri: the URI to which the upload should be sent
* @entry: the #GDataEntry to upload
- * @entry_type: a #GType for the #GDataEntry<!-- -->s to build from the updated XML
* @cancellable: optional #GCancellable object, or %NULL
* @error: a #GError, or %NULL
*
@@ -962,8 +961,7 @@ gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *quer
* Return value: an updated #GDataEntry, or %NULL
**/
GDataEntry *
-gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEntry *entry, GType entry_type,
- GCancellable *cancellable, GError **error)
+gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEntry *entry, GCancellable *cancellable, GError **error)
{
GDataServiceClass *klass;
GDataEntry *updated_entry;
@@ -974,7 +972,6 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
g_return_val_if_fail (GDATA_IS_SERVICE (self), NULL);
g_return_val_if_fail (upload_uri != NULL, NULL);
g_return_val_if_fail (GDATA_IS_ENTRY (entry), NULL);
- g_return_val_if_fail (entry_type != G_TYPE_INVALID, NULL);
if (gdata_entry_is_inserted (entry) == TRUE) {
g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_ENTRY_ALREADY_INSERTED,
@@ -1018,8 +1015,8 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
/* Build the updated entry */
g_assert (message->response_body->data != NULL);
- /* Parse the XML */
- updated_entry = _gdata_entry_new_from_xml (entry_type, message->response_body->data, message->response_body->length, error);
+ /* Parse the XML; create and return a new GDataEntry of the same type as @entry */
+ updated_entry = _gdata_entry_new_from_xml (G_OBJECT_TYPE (entry), message->response_body->data, message->response_body->length, error);
g_object_unref (message);
return updated_entry;
@@ -1029,7 +1026,6 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
* gdata_service_update_entry:
* @self: a #GDataService
* @entry: the #GDataEntry to update
- * @entry_type: a #GType for the #GDataEntry<!-- -->s to build from the updated XML
* @cancellable: optional #GCancellable object, or %NULL
* @error: a #GError, or %NULL
*
@@ -1048,7 +1044,7 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
* Return value: an updated #GDataEntry, or %NULL
**/
GDataEntry *
-gdata_service_update_entry (GDataService *self, GDataEntry *entry, GType entry_type, GCancellable *cancellable, GError **error)
+gdata_service_update_entry (GDataService *self, GDataEntry *entry, GCancellable *cancellable, GError **error)
{
GDataServiceClass *klass;
GDataEntry *updated_entry;
@@ -1059,7 +1055,6 @@ gdata_service_update_entry (GDataService *self, GDataEntry *entry, GType entry_t
g_return_val_if_fail (GDATA_IS_SERVICE (self), NULL);
g_return_val_if_fail (GDATA_IS_ENTRY (entry), NULL);
- g_return_val_if_fail (entry_type != G_TYPE_INVALID, NULL);
/* Get the edit URI */
link = gdata_entry_look_up_link (entry, "edit");
@@ -1104,8 +1099,8 @@ gdata_service_update_entry (GDataService *self, GDataEntry *entry, GType entry_t
/* Build the updated entry */
g_assert (message->response_body->data != NULL);
- /* Parse the XML */
- updated_entry = _gdata_entry_new_from_xml (entry_type, message->response_body->data, message->response_body->length, error);
+ /* Parse the XML; create and return a new GDataEntry of the same type as @entry */
+ updated_entry = _gdata_entry_new_from_xml (G_OBJECT_TYPE (entry), message->response_body->data, message->response_body->length, error);
g_object_unref (message);
return updated_entry;
diff --git a/gdata/gdata-service.h b/gdata/gdata-service.h
index ce2afdf..f135a96 100644
--- a/gdata/gdata-service.h
+++ b/gdata/gdata-service.h
@@ -163,12 +163,10 @@ void gdata_service_query_async (GDataService *self, const gchar *feed_uri, GData
GAsyncReadyCallback callback, gpointer user_data);
GDataFeed *gdata_service_query_finish (GDataService *self, GAsyncResult *async_result, GError **error);
-GDataEntry *gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEntry *entry, GType entry_type,
- GCancellable *cancellable, GError **error);
+GDataEntry *gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEntry *entry, GCancellable *cancellable, GError **error);
/* TODO: async version */
-GDataEntry *gdata_service_update_entry (GDataService *self, GDataEntry *entry, GType entry_type,
- GCancellable *cancellable, GError **error);
+GDataEntry *gdata_service_update_entry (GDataService *self, GDataEntry *entry, GCancellable *cancellable, GError **error);
/* TODO: async version */
gboolean gdata_service_delete_entry (GDataService *self, GDataEntry *entry, GCancellable *cancellable, GError **error);
diff --git a/gdata/services/calendar/gdata-calendar-service.c b/gdata/services/calendar/gdata-calendar-service.c
index 27cdc9f..76b73d1 100644
--- a/gdata/services/calendar/gdata-calendar-service.c
+++ b/gdata/services/calendar/gdata-calendar-service.c
@@ -160,7 +160,7 @@ gdata_calendar_service_insert_event (GDataCalendarService *self, GDataCalendarEv
uri = g_strdup_printf ("http://www.google.com/calendar/feeds/%s/private/full", gdata_service_get_username (GDATA_SERVICE (self)));
- entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (event), GDATA_TYPE_CALENDAR_EVENT, cancellable, error);
+ entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (event), cancellable, error);
g_free (uri);
return GDATA_CALENDAR_EVENT (entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]