[libgdata] Bug 618584 — Implement gdata_entry_get_authors()



commit 1c93522f7e82af080f4d467ddcc32d991cc2ad54
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat May 15 14:07:46 2010 +0100

    Bug 618584 â?? Implement gdata_entry_get_authors()
    
    Add gdata_entry_get_authors(), documentation and test cases.
    Closes: bgo#618584

 docs/reference/gdata-sections.txt |    1 +
 gdata/gdata-entry.c               |   17 +++++++++++++++++
 gdata/gdata-entry.h               |    1 +
 gdata/gdata.symbols               |    1 +
 gdata/tests/general.c             |   23 +++++++++++++++++++++++
 5 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index f6c6b03..0d43bd8 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -147,6 +147,7 @@ gdata_entry_get_content
 gdata_entry_set_content
 gdata_entry_get_published
 gdata_entry_get_updated
+gdata_entry_get_authors
 gdata_entry_add_author
 gdata_entry_add_category
 gdata_entry_get_categories
diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c
index 1c018c3..e70d8ab 100644
--- a/gdata/gdata-entry.c
+++ b/gdata/gdata-entry.c
@@ -672,6 +672,23 @@ gdata_entry_get_categories (GDataEntry *self)
 }
 
 /**
+ * gdata_entry_get_authors:
+ * @self: a #GDataEntry
+ *
+ * Gets a list of the #GDataAuthor<!-- -->s for this entry.
+ *
+ * Return value: a #GList of #GDataAuthor<!-- -->s
+ *
+ * Since: 0.7.0
+ **/
+GList *
+gdata_entry_get_authors (GDataEntry *self)
+{
+	g_return_val_if_fail (GDATA_IS_ENTRY (self), NULL);
+	return self->priv->authors;
+}
+
+/**
  * gdata_entry_get_content:
  * @self: a #GDataEntry
  *
diff --git a/gdata/gdata-entry.h b/gdata/gdata-entry.h
index 212f070..3034117 100644
--- a/gdata/gdata-entry.h
+++ b/gdata/gdata-entry.h
@@ -82,6 +82,7 @@ void gdata_entry_add_link (GDataEntry *self, GDataLink *link);
 GDataLink *gdata_entry_look_up_link (GDataEntry *self, const gchar *rel) G_GNUC_PURE;
 GList *gdata_entry_look_up_links (GDataEntry *self, const gchar *rel) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
 void gdata_entry_add_author (GDataEntry *self, GDataAuthor *author);
+GList *gdata_entry_get_authors (GDataEntry *self) G_GNUC_PURE;
 const gchar *gdata_entry_get_rights (GDataEntry *self) G_GNUC_PURE;
 void gdata_entry_set_rights (GDataEntry *self, const gchar *rights);
 
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 22c8f4f..deb834c 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -19,6 +19,7 @@ gdata_entry_add_link
 gdata_entry_look_up_link
 gdata_entry_look_up_links
 gdata_entry_add_author
+gdata_entry_get_authors
 gdata_entry_is_inserted
 gdata_entry_get_rights
 gdata_entry_set_rights
diff --git a/gdata/tests/general.c b/gdata/tests/general.c
index bee9e3f..52f4413 100644
--- a/gdata/tests/general.c
+++ b/gdata/tests/general.c
@@ -168,6 +168,29 @@ test_entry_get_xml (void)
 
 	g_list_free (list);
 
+	/* Check authors */
+	list = gdata_entry_get_authors (entry);
+	g_assert_cmpuint (g_list_length (list), ==, 3);
+
+	author = GDATA_AUTHOR (list->data);
+	g_assert (author != NULL);
+	author = gdata_author_new ("F. BarrØ?", NULL, NULL);
+	g_assert_cmpstr (gdata_author_get_name (author), ==, "F. BarrØ?");
+	g_assert (gdata_author_get_uri (author) == NULL);
+	g_assert (gdata_author_get_email_address (author) == NULL);
+
+	author = GDATA_AUTHOR (list->next->data);
+	g_assert (author != NULL);
+	g_assert_cmpstr (gdata_author_get_name (author), ==, "John Smith");
+	g_assert (gdata_author_get_uri (author) == NULL);
+	g_assert_cmpstr (gdata_author_get_email_address (author), ==, "smith john example com");
+
+	author = GDATA_AUTHOR (list->next->next->data);
+	g_assert (author != NULL);
+	g_assert_cmpstr (gdata_author_get_name (author), ==, "Joe Bloggs");
+	g_assert_cmpstr (gdata_author_get_uri (author), ==, "http://example.com/";);
+	g_assert_cmpstr (gdata_author_get_email_address (author), ==, "joe example com");
+
 	/* Check categories */
 	list = gdata_entry_get_categories (entry);
 	g_assert (list != NULL);



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