[libgdata] [picasaweb] Add functions to get album and file IDs
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] [picasaweb] Add functions to get album and file IDs
- Date: Thu, 25 Mar 2010 00:36:14 +0000 (UTC)
commit 8b64cfab781063e08432294786beb2ad433e4f58
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-sections.txt | 2 +
gdata/gdata-parsable.c | 6 +-
gdata/gdata.symbols | 2 +
gdata/services/picasaweb/gdata-picasaweb-album.c | 95 +++++++++++++++++++---
gdata/services/picasaweb/gdata-picasaweb-album.h | 1 +
gdata/services/picasaweb/gdata-picasaweb-file.c | 78 +++++++++++++++++-
gdata/services/picasaweb/gdata-picasaweb-file.h | 1 +
gdata/tests/picasaweb.c | 10 ++-
8 files changed, 173 insertions(+), 22 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index a627a7a..16d44ee 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -1290,6 +1290,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
@@ -1329,6 +1330,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 ec7cda6..96807e5 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -537,6 +537,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
@@ -560,6 +561,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 972ac81..67e980d 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.7.0
+ **/
+ 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.
*
@@ -441,6 +461,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);
@@ -455,6 +476,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;
@@ -510,6 +534,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;
@@ -562,7 +591,9 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
} else if (gdata_parser_is_namespace (node, "http://schemas.google.com/photos/2007") == TRUE) {
if (gdata_parser_string_from_element (node, "user", P_REQUIRED | P_NON_EMPTY, &(self->priv->user), &success, error) == TRUE ||
gdata_parser_string_from_element (node, "nickname", P_REQUIRED | P_NON_EMPTY, &(self->priv->nickname), &success, error) == TRUE ||
- gdata_parser_string_from_element (node, "location", P_NONE, &(self->priv->location), &success, error) == TRUE) {
+ gdata_parser_string_from_element (node, "location", P_NONE, &(self->priv->location), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "id", P_REQUIRED | P_NON_EMPTY | P_NO_DUPES,
+ &(self->priv->album_id), &success, error) == TRUE) {
return success;
} else if (xmlStrcmp (node->name, (xmlChar*) "access") == 0) {
/* gphoto:access */
@@ -660,7 +691,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>");
@@ -722,18 +755,37 @@ 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)
{
- GDataPicasaWebAlbum *album = GDATA_PICASAWEB_ALBUM (g_object_new (GDATA_TYPE_PICASAWEB_ALBUM, "id", id, NULL));
+ const gchar *album_id = NULL, *i;
+ GDataPicasaWebAlbum *album;
+
+ 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;
+ }
+ }
+
+ album = GDATA_PICASAWEB_ALBUM (g_object_new (GDATA_TYPE_PICASAWEB_ALBUM, "id", id, "album-id", album_id, NULL));
/* Set the edited and timestamp properties to the current time (creation time). bgo#599140
* We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */
@@ -744,6 +796,23 @@ gdata_picasaweb_album_new (const gchar *id)
}
/**
+ * gdata_picasaweb_album_get_id:
+ * @self: a #GDataPicasaWebAlbum
+ *
+ * Gets the #GDataPicasaWebAlbum:album-id property.
+ *
+ * Return value: the album's ID
+ *
+ * Since: 0.7.0
+ **/
+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;
+}
+
+/**
* gdata_picasaweb_album_get_user:
* @self: a #GDataPicasaWebAlbum
*
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.h b/gdata/services/picasaweb/gdata-picasaweb-album.h
index 8fa598c..8c4bcd5 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 2f50009..bb43bf5 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.7.0
+ **/
+ 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>.
@@ -624,6 +645,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);
@@ -640,6 +662,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;
@@ -738,6 +763,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);
@@ -814,7 +844,9 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
gdata_parser_string_from_element (node, "imageVersion", P_NONE, &(self->priv->version), &success, error) == TRUE ||
gdata_parser_string_from_element (node, "albumid", P_NONE, &(self->priv->album_id), &success, error) == TRUE ||
gdata_parser_string_from_element (node, "client", P_NONE, &(self->priv->client), &success, error) == TRUE ||
- gdata_parser_string_from_element (node, "checksum", P_NONE, &(self->priv->client), &success, error) == TRUE) {
+ gdata_parser_string_from_element (node, "checksum", P_NONE, &(self->priv->client), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "id", P_REQUIRED | P_NON_EMPTY | P_NO_DUPES,
+ &(self->priv->file_id), &success, error) == TRUE) {
return success;
} else if (xmlStrcmp (node->name, (xmlChar*) "position") == 0) {
/* gphoto:position */
@@ -892,6 +924,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);
@@ -969,7 +1004,23 @@ get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
GDataPicasaWebFile *
gdata_picasaweb_file_new (const gchar *id)
{
- GDataPicasaWebFile *file = GDATA_PICASAWEB_FILE (g_object_new (GDATA_TYPE_PICASAWEB_FILE, "id", id, NULL));
+ const gchar *file_id = NULL, *i;
+ GDataPicasaWebFile *file;
+
+ 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;
+ }
+ }
+
+ file = GDATA_PICASAWEB_FILE (g_object_new (GDATA_TYPE_PICASAWEB_FILE, "id", id, "file-id", file_id, NULL));
/* Set the edited and timestamp properties to the current time (creation time). bgo#599140
* We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */
@@ -980,6 +1031,23 @@ gdata_picasaweb_file_new (const gchar *id)
}
/**
+ * gdata_picasaweb_file_get_id:
+ * @self: a #GDataPicasaWebFile
+ *
+ * Gets the #GDataPicasaWebFile:file-id property.
+ *
+ * Return value: the file's ID
+ *
+ * Since: 0.7.0
+ **/
+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;
+}
+
+/**
* gdata_picasaweb_file_get_edited:
* @self: a #GDataPicasaWebFile
* @edited: a #GTimeVal
@@ -1052,7 +1120,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 2288219..ec85df6 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 a16ae34..d33e2d2 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]