[libgdata] core: Add a public wrapper for GDataParsable:get_content_type



commit b44646093db8f41de952c9b740529cb849c73122
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jan 31 13:33:41 2017 +0100

    core: Add a public wrapper for GDataParsable:get_content_type
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777980

 docs/reference/gdata-sections.txt |    1 +
 gdata/gdata-core.symbols          |    1 +
 gdata/gdata-parsable.c            |   23 +++++++++++++++++++++++
 gdata/gdata-parsable.h            |    2 ++
 4 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 231c2b5..441d67d 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 c04188d..7f5da8a 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 64fa1bf..06ea622 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 2f16a8e..f4a090f 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;


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