summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@gnome.org>2017-01-31 13:33:41 +0100
committerDebarshi Ray <debarshir@gnome.org>2017-01-31 16:48:27 +0100
commitb44646093db8f41de952c9b740529cb849c73122 (patch)
treee5f3adbaa004462382e945355830a1ded38f96c4
parentb262909695437f02ecda557b701bec3a397aa70b (diff)
downloadlibgdata-b44646093db8f41de952c9b740529cb849c73122.tar.gz
core: Add a public wrapper for GDataParsable:get_content_type
https://bugzilla.gnome.org/show_bug.cgi?id=777980
-rw-r--r--docs/reference/gdata-sections.txt1
-rw-r--r--gdata/gdata-core.symbols1
-rw-r--r--gdata/gdata-parsable.c23
-rw-r--r--gdata/gdata-parsable.h2
4 files changed, 27 insertions, 0 deletions
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 231c2b5f..441d67db 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -706,6 +706,7 @@ GDataAccessRulePrivate
<TITLE>GDataParsable</TITLE>
GDataParsable
GDataParsableClass
+gdata_parsable_get_content_type
gdata_parsable_new_from_xml
gdata_parsable_get_xml
gdata_parsable_new_from_json
diff --git a/gdata/gdata-core.symbols b/gdata/gdata-core.symbols
index c04188d8..7f5da8a5 100644
--- a/gdata/gdata-core.symbols
+++ b/gdata/gdata-core.symbols
@@ -311,6 +311,7 @@ gdata_access_rule_set_scope
gdata_access_rule_get_edited
gdata_access_rule_get_key
gdata_parsable_get_type
+gdata_parsable_get_content_type
gdata_parsable_new_from_xml
gdata_parsable_get_xml
gdata_parsable_new_from_json
diff --git a/gdata/gdata-parsable.c b/gdata/gdata-parsable.c
index 64fa1bfe..06ea6221 100644
--- a/gdata/gdata-parsable.c
+++ b/gdata/gdata-parsable.c
@@ -547,6 +547,29 @@ _gdata_parsable_new_from_json_node (GType parsable_type, JsonReader *reader, gpo
return parsable;
}
+/**
+ * gdata_parsable_get_content_type:
+ * @self: a #GDataParsable
+ *
+ * Returns the content type upon which the #GDataParsable is built. For example, `application/atom+xml` or `application/json`.
+ *
+ * Return value: the parsable's content type
+ *
+ * Since: UNRELEASED
+ */
+const gchar *
+gdata_parsable_get_content_type (GDataParsable *self)
+{
+ GDataParsableClass *klass;
+
+ g_return_val_if_fail (GDATA_IS_PARSABLE (self), NULL);
+
+ klass = GDATA_PARSABLE_GET_CLASS (self);
+ g_assert (klass->get_content_type != NULL);
+
+ return klass->get_content_type ();
+}
+
static void
build_namespaces_cb (gchar *prefix, gchar *href, GString *output)
{
diff --git a/gdata/gdata-parsable.h b/gdata/gdata-parsable.h
index 2f16a8e7..f4a090f2 100644
--- a/gdata/gdata-parsable.h
+++ b/gdata/gdata-parsable.h
@@ -120,6 +120,8 @@ typedef struct {
GType gdata_parsable_get_type (void) G_GNUC_CONST;
+const gchar *gdata_parsable_get_content_type (GDataParsable *self);
+
GDataParsable *gdata_parsable_new_from_xml (GType parsable_type, const gchar *xml, gint length,
GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
gchar *gdata_parsable_get_xml (GDataParsable *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;