[libgdata] gdata: Allow creating GDataEntries out of JSON content
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] gdata: Allow creating GDataEntries out of JSON content
- Date: Sun, 27 Apr 2014 12:12:45 +0000 (UTC)
commit 7b73b3369b6a52f1164ed7b193ebec7395a77629
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 17 02:49:20 2014 +0100
gdata: Allow creating GDataEntries out of JSON content
Some services like Freebase are hardly based on JSON, and still
GDataEntry seems the most sensible base for the different server
responses in those services over GDataFeed.
A small spawn of https://bugzilla.gnome.org/show_bug.cgi?id=726486
gdata/gdata-service.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index b752dc2..4ec990f 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -1099,7 +1099,13 @@ gdata_service_query_single_entry (GDataService *self, GDataAuthorizationDomain *
}
g_assert (message->response_body->data != NULL);
- entry = GDATA_ENTRY (gdata_parsable_new_from_xml (entry_type, message->response_body->data,
message->response_body->length, error));
+
+ if (g_strcmp0 (GDATA_PARSABLE_CLASS (klass)->get_content_type (), "application/json") == 0) {
+ entry = GDATA_ENTRY (gdata_parsable_new_from_json (entry_type, message->response_body->data,
message->response_body->length, error));
+ } else {
+ entry = GDATA_ENTRY (gdata_parsable_new_from_xml (entry_type, message->response_body->data,
message->response_body->length, error));
+ }
+
g_object_unref (message);
g_type_class_unref (klass);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]