[libgdata/libgdata-0-6] [picasaweb] Add functions to get album and file IDs
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata/libgdata-0-6] [picasaweb] Add functions to get album and file IDs
- Date: Mon, 29 Mar 2010 21:31:32 +0000 (UTC)
commit 85a55dbc2c0a174dfd84ec6a8b6094e38fc33a74
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Mar 25 00:27:06 2010 +0000
[picasaweb] Add functions to get album and file IDs
Add gdata_picasaweb_album_get_id() and gdata_picasaweb_file_get_id() to get
the forms of ID which were previously (incorrectly) returned by
gdata_entry_get_id() for the two classes.
docs/reference/gdata-docs.xml | 4 +
docs/reference/gdata-sections.txt | 2 +
gdata/gdata-parsable.c | 6 +-
gdata/gdata.symbols | 2 +
gdata/services/picasaweb/gdata-picasaweb-album.c | 97 +++++++++++++++++++---
gdata/services/picasaweb/gdata-picasaweb-album.h | 1 +
gdata/services/picasaweb/gdata-picasaweb-file.c | 82 +++++++++++++++++-
gdata/services/picasaweb/gdata-picasaweb-file.h | 1 +
gdata/tests/picasaweb.c | 10 ++-
9 files changed, 184 insertions(+), 21 deletions(-)
---
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml
index d981c3a..71de357 100644
--- a/docs/reference/gdata-docs.xml
+++ b/docs/reference/gdata-docs.xml
@@ -161,5 +161,9 @@
<title>Index of new symbols in 0.6.3</title>
<xi:include href="xml/api-index-0.6.3.xml"><xi:fallback/></xi:include>
</index>
+ <index role="0.6.4">
+ <title>Index of new symbols in 0.6.4</title>
+ <xi:include href="xml/api-index-0.6.4.xml"><xi:fallback/></xi:include>
+ </index>
</part>
</book>
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 8ae4bcf..91cfdfa 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -1283,6 +1283,7 @@ GDataPicasaWebAlbum
GDataPicasaWebAlbumClass
GDataPicasaWebVisibility
gdata_picasaweb_album_new
+gdata_picasaweb_album_get_id
gdata_picasaweb_album_get_user
gdata_picasaweb_album_get_nickname
gdata_picasaweb_album_get_edited
@@ -1322,6 +1323,7 @@ GDataPicasaWebAlbumPrivate
GDataPicasaWebFile
GDataPicasaWebFileClass
gdata_picasaweb_file_new
+gdata_picasaweb_file_get_id
gdata_picasaweb_file_get_edited
gdata_picasaweb_file_get_version
gdata_picasaweb_file_get_position
diff --git a/gdata/gdata-parsable.c b/gdata/gdata-parsable.c
index 86f59b2..008e57d 100644
--- a/gdata/gdata-parsable.c
+++ b/gdata/gdata-parsable.c
@@ -281,7 +281,11 @@ filter_namespaces_cb (gchar *prefix, gchar *href, GHashTable *canonical_namespac
gchar *
gdata_parsable_get_xml (GDataParsable *self)
{
- GString *xml_string = g_string_sized_new (100);
+ GString *xml_string;
+
+ g_return_val_if_fail (GDATA_IS_PARSABLE (self), NULL);
+
+ xml_string = g_string_sized_new (100);
_gdata_parsable_get_xml (self, xml_string, TRUE);
return g_string_free (xml_string, FALSE);
}
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 9878ace..2919ea2 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -536,6 +536,7 @@ gdata_youtube_state_get_help_uri
gdata_youtube_state_get_message
gdata_picasaweb_album_get_type
gdata_picasaweb_album_new
+gdata_picasaweb_album_get_id
gdata_picasaweb_album_get_user
gdata_picasaweb_album_get_nickname
gdata_picasaweb_album_get_edited
@@ -559,6 +560,7 @@ gdata_picasaweb_album_get_coordinates
gdata_picasaweb_album_set_coordinates
gdata_picasaweb_file_get_type
gdata_picasaweb_file_new
+gdata_picasaweb_file_get_id
gdata_picasaweb_file_get_edited
gdata_picasaweb_file_get_version
gdata_picasaweb_file_get_position
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c
index ebf20e4..8fc5b81 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.c
@@ -59,6 +59,7 @@ static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node,
static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
struct _GDataPicasaWebAlbumPrivate {
+ gchar *album_id;
gchar *user;
gchar *nickname;
GTimeVal edited;
@@ -91,7 +92,8 @@ enum {
PROP_COMMENT_COUNT,
PROP_TAGS,
PROP_LATITUDE,
- PROP_LONGITUDE
+ PROP_LONGITUDE,
+ PROP_ALBUM_ID
};
G_DEFINE_TYPE (GDataPicasaWebAlbum, gdata_picasaweb_album, GDATA_TYPE_ENTRY)
@@ -115,7 +117,25 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
parsable_class->get_namespaces = get_namespaces;
/**
- * GDataPicasaWeb:user
+ * GDataPicasaWebAlbum:album-id
+ *
+ * The ID of the album. This is a substring of the ID returned by gdata_entry_get_id() for #GDataPicasaWebAlbum<!-- -->s; for example,
+ * if gdata_entry_get_id() returned "http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249" for a
+ * particular #GDataPicasaWebAlbum, the #GDataPicasaWebAlbum:album-id property would be "5328889949261497249".
+ *
+ * For more information, see the <ulink type="http" url="http://code.google.com/apis/picasaweb/reference.html#gphoto_id">
+ * gphoto specification</ulink>.
+ *
+ * Since: 0.6.4
+ **/
+ g_object_class_install_property (gobject_class, PROP_ALBUM_ID,
+ g_param_spec_string ("album-id",
+ "Album ID", "The ID of the album.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataPicasaWebAlbum:user
*
* The username of the album owner.
*
@@ -131,7 +151,7 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
- * GDataPicasaWeb:nickname
+ * GDataPicasaWebAlbum:nickname
*
* The user's nickname. This is a user-specified value that should be used when referring to the user by name.
*
@@ -147,7 +167,7 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
- * GDataPicasaWeb:edited
+ * GDataPicasaWebAlbum:edited
*
* The time this album was last edited. If the album has not been edited yet, the content indicates the time it was created.
*
@@ -163,7 +183,7 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
- * GDataPicasaWeb:location
+ * GDataPicasaWebAlbum:location
*
* The user-specified location associated with the album. A place name.
*
@@ -179,7 +199,7 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
- * GDataPicasaWeb:visibility
+ * GDataPicasaWebAlbum:visibility
*
* The visibility (or access rights) of the album.
*
@@ -195,7 +215,7 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
- * GDataPicasaWeb:timestamp
+ * GDataPicasaWebAlbum:timestamp
*
* The timestamp of when the album occurred, settable by the user.
*
@@ -445,6 +465,7 @@ gdata_picasaweb_album_finalize (GObject *object)
{
GDataPicasaWebAlbumPrivate *priv = GDATA_PICASAWEB_ALBUM_GET_PRIVATE (object);
+ g_free (priv->album_id);
g_free (priv->user);
g_free (priv->nickname);
g_free (priv->location);
@@ -459,6 +480,9 @@ gdata_picasaweb_album_get_property (GObject *object, guint property_id, GValue *
GDataPicasaWebAlbumPrivate *priv = GDATA_PICASAWEB_ALBUM_GET_PRIVATE (object);
switch (property_id) {
+ case PROP_ALBUM_ID:
+ g_value_set_string (value, priv->album_id);
+ break;
case PROP_USER:
g_value_set_string (value, priv->user);
break;
@@ -514,6 +538,11 @@ gdata_picasaweb_album_set_property (GObject *object, guint property_id, const GV
GDataPicasaWebAlbum *self = GDATA_PICASAWEB_ALBUM (object);
switch (property_id) {
+ case PROP_ALBUM_ID:
+ /* Construct only */
+ g_free (self->priv->album_id);
+ self->priv->album_id = g_value_dup_string (value);
+ break;
case PROP_LOCATION:
gdata_picasaweb_album_set_location (self, g_value_get_string (value));
break;
@@ -603,6 +632,13 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
/* gphoto:location */
g_free (self->priv->location);
self->priv->location = (gchar*) xmlNodeListGetString (doc, node->children, TRUE);
+ } else if (xmlStrcmp (node->name, (xmlChar*) "id") == 0) {
+ /* gphoto:id */
+ xmlChar *id = xmlNodeListGetString (doc, node->children, TRUE);
+ if (id == NULL || *id == '\0')
+ return gdata_parser_error_required_content_missing (node, error);
+ g_free (self->priv->album_id);
+ self->priv->album_id = (gchar*) id;
} else if (xmlStrcmp (node->name, (xmlChar*) "access") == 0) {
/* gphoto:access */
xmlChar *access = xmlNodeListGetString (doc, node->children, TRUE);
@@ -697,7 +733,9 @@ get_xml (GDataParsable *parsable, GString *xml_string)
GDATA_PARSABLE_CLASS (gdata_picasaweb_album_parent_class)->get_xml (parsable, xml_string);
/* Add all the album-specific XML */
- /* TODO: gphoto:id */
+ if (priv->album_id != NULL)
+ g_string_append_printf (xml_string, "<gphoto:id>%s</gphoto:id>", priv->album_id);
+
if (priv->location != NULL)
gdata_parser_string_append_escaped (xml_string, "<gphoto:location>", priv->location, "</gphoto:location>");
@@ -759,18 +797,53 @@ get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
/**
* gdata_picasaweb_album_new:
- * @id: the album's ID, or %NULL
+ * @id: the album's entry ID, or %NULL
+ *
+ * Creates a new #GDataPicasaWebAlbum with the given ID and default properties. @id is the ID which would be returned by gdata_entry_get_id(),
+ * not gdata_picasaweb_album_get_id().
*
- * Creates a new #GDataPicasaWebAlbum with the given ID and default properties.
+ * If @id is not %NULL and can't be parsed to extract an album ID, %NULL will be returned.
*
- * Return value: a new #GDataPicasaWebAlbum; unref with g_object_unref()
+ * Return value: a new #GDataPicasaWebAlbum, or %NULL; unref with g_object_unref()
*
* Since: 0.4.0
**/
GDataPicasaWebAlbum *
gdata_picasaweb_album_new (const gchar *id)
{
- return g_object_new (GDATA_TYPE_PICASAWEB_ALBUM, "id", id, NULL);
+ const gchar *album_id = NULL, *i;
+
+ if (id != NULL) {
+ album_id = g_strrstr (id, "/");
+ if (album_id == NULL)
+ return NULL;
+ album_id++; /* skip the slash */
+
+ /* Ensure the @album_id is entirely numeric */
+ for (i = album_id; *i != '\0'; i = g_utf8_next_char (i)) {
+ if (g_unichar_isdigit (g_utf8_get_char (i)) == FALSE)
+ return NULL;
+ }
+ }
+
+ return GDATA_PICASAWEB_ALBUM (g_object_new (GDATA_TYPE_PICASAWEB_ALBUM, "id", id, "album-id", album_id, NULL));
+}
+
+/**
+ * gdata_picasaweb_album_get_id:
+ * @self: a #GDataPicasaWebAlbum
+ *
+ * Gets the #GDataPicasaWebAlbum:album-id property.
+ *
+ * Return value: the album's ID
+ *
+ * Since: 0.6.4
+ **/
+const gchar *
+gdata_picasaweb_album_get_id (GDataPicasaWebAlbum *self)
+{
+ g_return_val_if_fail (GDATA_IS_PICASAWEB_ALBUM (self), NULL);
+ return self->priv->album_id;
}
/**
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.h b/gdata/services/picasaweb/gdata-picasaweb-album.h
index d28f6b4..81dcf0b 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.h
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.h
@@ -80,6 +80,7 @@ GType gdata_picasaweb_album_get_type (void) G_GNUC_CONST;
GDataPicasaWebAlbum *gdata_picasaweb_album_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT;
+const gchar *gdata_picasaweb_album_get_id (GDataPicasaWebAlbum *self);
const gchar *gdata_picasaweb_album_get_user (GDataPicasaWebAlbum *self);
const gchar *gdata_picasaweb_album_get_nickname (GDataPicasaWebAlbum *self);
void gdata_picasaweb_album_get_edited (GDataPicasaWebAlbum *self, GTimeVal *edited);
diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c
index b343071..1ec3d45 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-file.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-file.c
@@ -56,6 +56,7 @@ static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node,
static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
struct _GDataPicasaWebFilePrivate {
+ gchar *file_id;
GTimeVal edited;
gchar *version;
gdouble position;
@@ -107,7 +108,8 @@ enum {
PROP_MAKE,
PROP_MODEL,
PROP_LATITUDE,
- PROP_LONGITUDE
+ PROP_LONGITUDE,
+ PROP_FILE_ID
};
G_DEFINE_TYPE (GDataPicasaWebFile, gdata_picasaweb_file, GDATA_TYPE_ENTRY)
@@ -131,6 +133,25 @@ gdata_picasaweb_file_class_init (GDataPicasaWebFileClass *klass)
parsable_class->get_namespaces = get_namespaces;
/**
+ * GDataPicasaWebFile:file-id:
+ *
+ * The ID of the file. This is a substring of the ID returned by gdata_entry_get_id() for #GDataPicasaWebFile<!-- -->s; for example,
+ * if gdata_entry_get_id() returned
+ * "http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249/photoid/5328890138794566386" for a
+ * particular #GDataPicasaWebFile, the #GDataPicasaWebFile:file-id property would be "5328890138794566386".
+ *
+ * For more information, see the <ulink type="http" url="http://code.google.com/apis/picasaweb/reference.html#gphoto_id">
+ * gphoto specification</ulink>.
+ *
+ * Since: 0.6.4
+ **/
+ g_object_class_install_property (gobject_class, PROP_FILE_ID,
+ g_param_spec_string ("file-id",
+ "File ID", "The ID of the file.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ /**
* GDataPicasaWebFile:version:
*
* The version number of the file. Version numbers are based on modification time, so they don't increment linearly.
@@ -149,7 +170,7 @@ gdata_picasaweb_file_class_init (GDataPicasaWebFileClass *klass)
/**
* GDataPicasaWebFile:album-id:
*
- * The ID for the file's album.
+ * The ID for the file's album. This is in the same form as returned by gdata_picasaweb_album_get_id().
*
* For more information, see the <ulink type="http" url="http://code.google.com/apis/picasaweb/reference.html#gphoto_albumid">
* gphoto specification</ulink>.
@@ -628,6 +649,7 @@ gdata_picasaweb_file_finalize (GObject *object)
{
GDataPicasaWebFilePrivate *priv = GDATA_PICASAWEB_FILE_GET_PRIVATE (object);
+ g_free (priv->file_id);
g_free (priv->version);
g_free (priv->album_id);
g_free (priv->client);
@@ -644,6 +666,9 @@ gdata_picasaweb_file_get_property (GObject *object, guint property_id, GValue *v
GDataPicasaWebFilePrivate *priv = GDATA_PICASAWEB_FILE_GET_PRIVATE (object);
switch (property_id) {
+ case PROP_FILE_ID:
+ g_value_set_string (value, priv->file_id);
+ break;
case PROP_EDITED:
g_value_set_boxed (value, &(priv->edited));
break;
@@ -742,6 +767,11 @@ gdata_picasaweb_file_set_property (GObject *object, guint property_id, const GVa
GDataPicasaWebFile *self = GDATA_PICASAWEB_FILE (object);
switch (property_id) {
+ case PROP_FILE_ID:
+ /* Construct only */
+ g_free (self->priv->file_id);
+ self->priv->file_id = g_value_dup_string (value);
+ break;
case PROP_VERSION:
/* Construct only */
g_free (self->priv->version);
@@ -846,13 +876,20 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
/* gphoto:imageVersion */
g_free (self->priv->version);
self->priv->version = (gchar*) xmlNodeListGetString (doc, node->children, TRUE);
+ } else if (xmlStrcmp (node->name, (xmlChar*) "id") == 0) {
+ /* gphoto:id */
+ xmlChar *id = xmlNodeListGetString (doc, node->children, TRUE);
+ if (id == NULL || *id == '\0')
+ return gdata_parser_error_required_content_missing (node, error);
+ g_free (self->priv->file_id);
+ self->priv->file_id = (gchar*) id;
} else if (xmlStrcmp (node->name, (xmlChar*) "position") == 0) {
/* gphoto:position */
xmlChar *position_str = xmlNodeListGetString (doc, node->children, TRUE);
gdata_picasaweb_file_set_position (self, g_ascii_strtod ((gchar*) position_str, NULL));
xmlFree (position_str);
} else if (xmlStrcmp (node->name, (xmlChar*) "albumid") == 0) {
- /* gphoto:album_id */
+ /* gphoto:albumid */
self->priv->album_id = (gchar*) xmlNodeListGetString (doc, node->children, TRUE);
} else if (xmlStrcmp (node->name, (xmlChar*) "width") == 0) {
/* gphoto:width */
@@ -939,6 +976,9 @@ get_xml (GDataParsable *parsable, GString *xml_string)
GDATA_PARSABLE_CLASS (gdata_picasaweb_file_parent_class)->get_xml (parsable, xml_string);
/* Add all the PicasaWeb-specific XML */
+ if (priv->file_id != NULL)
+ g_string_append_printf (xml_string, "<gphoto:id>%s</gphoto:id>", priv->file_id);
+
if (priv->version != NULL)
g_string_append_printf (xml_string, "<gphoto:version>%s</gphoto:version>", priv->version);
@@ -1016,7 +1056,39 @@ get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
GDataPicasaWebFile *
gdata_picasaweb_file_new (const gchar *id)
{
- return g_object_new (GDATA_TYPE_PICASAWEB_FILE, "id", id, NULL);
+ const gchar *file_id = NULL, *i;
+
+ if (id != NULL) {
+ file_id = g_strrstr (id, "/");
+ if (file_id == NULL)
+ return NULL;
+ file_id++; /* skip the slash */
+
+ /* Ensure the @file_id is entirely numeric */
+ for (i = file_id; *i != '\0'; i = g_utf8_next_char (i)) {
+ if (g_unichar_isdigit (g_utf8_get_char (i)) == FALSE)
+ return NULL;
+ }
+ }
+
+ return GDATA_PICASAWEB_FILE (g_object_new (GDATA_TYPE_PICASAWEB_FILE, "id", id, "file-id", file_id, NULL));
+}
+
+/**
+ * gdata_picasaweb_file_get_id:
+ * @self: a #GDataPicasaWebFile
+ *
+ * Gets the #GDataPicasaWebFile:file-id property.
+ *
+ * Return value: the file's ID
+ *
+ * Since: 0.6.4
+ **/
+const gchar *
+gdata_picasaweb_file_get_id (GDataPicasaWebFile *self)
+{
+ g_return_val_if_fail (GDATA_IS_PICASAWEB_FILE (self), NULL);
+ return self->priv->file_id;
}
/**
@@ -1092,7 +1164,7 @@ gdata_picasaweb_file_set_position (GDataPicasaWebFile *self, gdouble position)
* gdata_picasaweb_file_get_album_id:
* @self: a #GDataPicasaWebFile
*
- * Gets the #GDataPicasaWebFile:album-id property.
+ * Gets the #GDataPicasaWebFile:album-id property. This is in the same form as returned by gdata_picasaweb_album_get_id().
*
* Return value: the ID of the album containing the #GDataPicasaWebFile
*
diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.h b/gdata/services/picasaweb/gdata-picasaweb-file.h
index abfaacd..835a5a6 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-file.h
+++ b/gdata/services/picasaweb/gdata-picasaweb-file.h
@@ -66,6 +66,7 @@ GType gdata_picasaweb_file_get_type (void) G_GNUC_CONST;
GDataPicasaWebFile *gdata_picasaweb_file_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT;
+const gchar *gdata_picasaweb_file_get_id (GDataPicasaWebFile *self);
void gdata_picasaweb_file_get_edited (GDataPicasaWebFile *self, GTimeVal *edited);
const gchar *gdata_picasaweb_file_get_version (GDataPicasaWebFile *self);
gdouble gdata_picasaweb_file_get_position (GDataPicasaWebFile *self);
diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c
index 4e8e1ad..dcdbada 100644
--- a/gdata/tests/picasaweb.c
+++ b/gdata/tests/picasaweb.c
@@ -777,6 +777,7 @@ test_photo_feed_entry (gconstpointer service)
g_assert_cmpuint (g_list_length (files), ==, 1);
g_assert_cmpstr (gdata_entry_get_title (photo_entry), ==, "100_0269.jpg");
+ g_assert_cmpstr (gdata_picasaweb_file_get_id (GDATA_PICASAWEB_FILE (photo_entry)), ==, "5328890138794566386");
g_assert_cmpstr (gdata_entry_get_id (photo_entry), ==, "http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249/photoid/5328890138794566386");
g_assert_cmpstr (gdata_entry_get_etag (photo_entry), !=, NULL);
@@ -984,6 +985,7 @@ test_album_feed_entry (gconstpointer service)
/* Tests */
g_assert_cmpstr (gdata_entry_get_title (entry), ==, "Test Album 1 - Venice - Public");
+ g_assert_cmpstr (gdata_picasaweb_album_get_id (GDATA_PICASAWEB_ALBUM (entry)), ==, "5328889949261497249");
g_assert_cmpstr (gdata_entry_get_id (entry), ==, "http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249");
g_assert_cmpstr (gdata_entry_get_etag (entry), !=, NULL);
g_assert_cmpstr (gdata_entry_get_rights (entry), ==, "public");
@@ -1045,7 +1047,7 @@ test_insert_album (gconstpointer service)
error = NULL;
- album = gdata_picasaweb_album_new ("album_id_72");
+ album = gdata_picasaweb_album_new (NULL);
g_assert (GDATA_IS_PICASAWEB_ALBUM (album));
gdata_entry_set_title (GDATA_ENTRY (album), "Thanksgiving photos");
@@ -1257,7 +1259,8 @@ test_album_new (gconstpointer service)
"xmlns:app='http://www.w3.org/2007/app' "
"xmlns:georss='http://www.georss.org/georss'>"
"<title type='text'></title>"
- "<id>some-id</id>"
+ "<id>http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249</id>"
+ "<gphoto:id>5328889949261497249</gphoto:id>"
"<gphoto:access>private</gphoto:access>"
"<gphoto:timestamp>([0-9]+)</gphoto:timestamp>"
"<gphoto:commentingEnabled>false</gphoto:commentingEnabled>"
@@ -1265,7 +1268,8 @@ test_album_new (gconstpointer service)
"</entry>", 0, 0, NULL);
/* Build the album */
- album = gdata_picasaweb_album_new ("some-id");
+ album = gdata_picasaweb_album_new ("http://picasaweb.google.com/data/entry/user/libgdata.picasaweb/albumid/5328889949261497249");
+ g_assert (GDATA_IS_PICASAWEB_ALBUM (album));
/* Check the XML: match it against the regex built above, then check that the timestamp is within 100ms of the current time at the start of
* the test function. We can't check it exactly, as a few milliseconds may have passed inbetween building the expected XML and building the XML
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]