[libgdata] Bug 598913 — Add gdata_picasaweb_service_insert_album()



commit 66eaf1948c1d4c38482c37b0b8cd1cd89f65d0a9
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sun Oct 25 15:34:23 2009 +0000

    Bug 598913 â?? Add gdata_picasaweb_service_insert_album()
    
    Remove API bloat in GDataPicasaWebAlbum: *_get_name and
    *_[get|set]_description are now gone. Helps: bgo#598913

 docs/reference/gdata-sections.txt                |    3 -
 gdata/gdata.symbols                              |    3 -
 gdata/services/picasaweb/gdata-picasaweb-album.c |  138 +++-------------------
 gdata/services/picasaweb/gdata-picasaweb-album.h |    3 -
 gdata/tests/picasaweb.c                          |    5 +-
 5 files changed, 19 insertions(+), 133 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 9f5bdd8..179d9c4 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -1277,7 +1277,6 @@ gdata_picasaweb_album_new
 gdata_picasaweb_album_get_user
 gdata_picasaweb_album_get_nickname
 gdata_picasaweb_album_get_edited
-gdata_picasaweb_album_get_name
 gdata_picasaweb_album_get_location
 gdata_picasaweb_album_set_location
 gdata_picasaweb_album_get_visibility
@@ -1292,8 +1291,6 @@ gdata_picasaweb_album_set_is_commenting_enabled
 gdata_picasaweb_album_get_comment_count
 gdata_picasaweb_album_get_tags
 gdata_picasaweb_album_set_tags
-gdata_picasaweb_album_get_description
-gdata_picasaweb_album_set_description
 gdata_picasaweb_album_get_contents
 gdata_picasaweb_album_get_thumbnails
 gdata_picasaweb_album_get_coordinates
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 672b3e9..0b617b3 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -533,7 +533,6 @@ gdata_picasaweb_album_new
 gdata_picasaweb_album_get_user
 gdata_picasaweb_album_get_nickname
 gdata_picasaweb_album_get_edited
-gdata_picasaweb_album_get_name
 gdata_picasaweb_album_get_location
 gdata_picasaweb_album_set_location
 gdata_picasaweb_album_get_visibility
@@ -548,8 +547,6 @@ gdata_picasaweb_album_set_is_commenting_enabled
 gdata_picasaweb_album_get_comment_count
 gdata_picasaweb_album_get_tags
 gdata_picasaweb_album_set_tags
-gdata_picasaweb_album_get_description
-gdata_picasaweb_album_set_description
 gdata_picasaweb_album_get_contents
 gdata_picasaweb_album_get_thumbnails
 gdata_picasaweb_album_get_coordinates
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c
index 82c1ee1..3bd2e40 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.c
@@ -30,7 +30,7 @@
  * online documentation</ulink>.
  **/
 
-/* TODO: support the album cover/icon ? */
+/* TODO: support the album cover/icon ? I think this is already done with the thumbnails, but we don't set it yet :( */
 
 #include <config.h>
 #include <glib.h>
@@ -60,7 +60,6 @@ struct _GDataPicasaWebAlbumPrivate {
 	gchar *user;
 	gchar *nickname;
 	GTimeVal edited;
-	gchar *name; /* album title, usable in URIs */
 	gchar *location;
 	GDataPicasaWebVisibility visibility;
 	GTimeVal timestamp;
@@ -80,7 +79,6 @@ enum {
 	PROP_USER = 1,
 	PROP_NICKNAME,
 	PROP_EDITED,
-	PROP_NAME,
 	PROP_LOCATION,
 	PROP_VISIBILITY,
 	PROP_TIMESTAMP,
@@ -89,7 +87,6 @@ enum {
 	PROP_BYTES_USED,
 	PROP_IS_COMMENTING_ENABLED,
 	PROP_COMMENT_COUNT,
-	PROP_DESCRIPTION,
 	PROP_TAGS,
 	PROP_LATITUDE,
 	PROP_LONGITUDE
@@ -164,22 +161,6 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
 							     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * GDataPicasaWeb:name
-	 *
-	 * The name of the album, which is the URI-usable name derived from the album title (#GDataEntry:title).
-	 *
-	 * For more information, see the <ulink type="http" url="http://code.google.com/apis/picasaweb/reference.html#gphoto_name";>
-	 * gphoto specification</ulink>.
-	 *
-	 * Since: 0.4.0
-	 **/
-	g_object_class_install_property (gobject_class, PROP_NAME,
-					 g_param_spec_string ("name",
-							      "Name", "The name of the album.",
-							      NULL,
-							      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-	/**
 	 * GDataPicasaWeb:location
 	 *
 	 * The user-specified location associated with the album. A place name.
@@ -310,22 +291,6 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass)
 							    G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * GDataPicasaWebAlbum:description:
-	 *
-	 * Description of the album.
-	 *
-	 * For more information, see the <ulink type="http" url="http://code.google.com/apis/picasaweb/reference.html#media_description";>
-	 * Media RSS specification</ulink>.
-	 *
-	 * Since: 0.4.0
-	 **/
-	g_object_class_install_property (gobject_class, PROP_DESCRIPTION,
-					 g_param_spec_string ("description",
-							      "Description", "Description of the album.",
-							      NULL,
-							      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-	/**
 	 * GDataPicasaWebAlbum:tags:
 	 *
 	 * A comma-separated list of tags associated with the album; all the tags associated with the individual photos in the album.
@@ -382,6 +347,14 @@ notify_title_cb (GDataPicasaWebAlbum *self, GParamSpec *pspec, gpointer user_dat
 		gdata_media_group_set_title (self->priv->media_group, gdata_entry_get_title (GDATA_ENTRY (self)));
 }
 
+static void
+notify_summary_cb (GDataPicasaWebAlbum *self, GParamSpec *pspec, gpointer user_data)
+{
+	/* Update our media:group description */
+	if (self->priv->media_group != NULL)
+		gdata_media_group_set_description (self->priv->media_group, gdata_entry_get_summary (GDATA_ENTRY (self)));
+}
+
 static void notify_visibility_cb (GDataPicasaWebAlbum *self, GParamSpec *pspec, gpointer user_data);
 
 static void
@@ -435,11 +408,15 @@ gdata_picasaweb_album_init (GDataPicasaWebAlbum *self)
 	/* Initialise the timestamp to the current time (bgo#599140) */
 	g_get_current_time (&(self->priv->timestamp));
 
-	/* Connect to the notify::title signal from GDataEntry so our media:group title can be kept in sync */
+	/* Connect to the notify::title signal from GDataEntry so our media:group title can be kept in sync
+	 * (the title of an album is duplicated in atom:title and media:group/media:title) */
 	g_signal_connect (GDATA_ENTRY (self), "notify::title", G_CALLBACK (notify_title_cb), NULL);
-	/* Connect to the notify::rights signal from GDataEntry so our gphoto:visibility can be kept in sync */
+	/* Connect to the notify::description signal from GDataEntry so our media:group description can be kept in sync
+	 * (the description of an album is duplicated in atom:summary and media:group/media:description) */
+	g_signal_connect (GDATA_ENTRY (self), "notify::summary", G_CALLBACK (notify_summary_cb), NULL);
+	/* Connect to the notify::rights signal from GDataEntry so our gphoto:visibility can be kept in sync (and vice-versa)
+	 * (visibility settings are duplicated in atom:rights and gphoto:visibility) */
 	g_signal_connect (GDATA_ENTRY (self), "notify::rights", G_CALLBACK (notify_rights_cb), NULL);
-	/* Connect to the notify::visibility signal so our rights can be kept in sync */
 	g_signal_connect (self, "notify::visibility", G_CALLBACK (notify_visibility_cb), NULL);
 }
 
@@ -467,7 +444,6 @@ gdata_picasaweb_album_finalize (GObject *object)
 
 	xmlFree (priv->user);
 	xmlFree (priv->nickname);
-	xmlFree (priv->name);
 	g_free (priv->location);
 
 	/* Chain up to the parent class */
@@ -489,9 +465,6 @@ gdata_picasaweb_album_get_property (GObject *object, guint property_id, GValue *
 		case PROP_EDITED:
 			g_value_set_boxed (value, &(priv->edited));
 			break;
-		case PROP_NAME:
-			g_value_set_string (value, priv->name);
-			break;
 		case PROP_LOCATION:
 			g_value_set_string (value, priv->location);
 			break;
@@ -516,9 +489,6 @@ gdata_picasaweb_album_get_property (GObject *object, guint property_id, GValue *
 		case PROP_COMMENT_COUNT:
 			g_value_set_uint (value, priv->comment_count);
 			break;
-		case PROP_DESCRIPTION:
-			g_value_set_string (value, gdata_media_group_get_description (priv->media_group));
-			break;
 		case PROP_TAGS:
 			g_value_set_string (value, gdata_media_group_get_keywords (priv->media_group));
 			break;
@@ -553,9 +523,6 @@ gdata_picasaweb_album_set_property (GObject *object, guint property_id, const GV
 		case PROP_IS_COMMENTING_ENABLED:
 			gdata_picasaweb_album_set_is_commenting_enabled (self, g_value_get_boolean (value));
 			break;
-		case PROP_DESCRIPTION:
-			gdata_picasaweb_album_set_description (self, g_value_get_string (value));
-			break;
 		case PROP_TAGS:
 			gdata_picasaweb_album_set_tags (self, g_value_get_string (value));
 			break;
@@ -625,21 +592,6 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
 			return FALSE;
 		}
 		xmlFree (edited);
-	} else if (xmlStrcmp (node->name, (xmlChar*) "summary") == 0) {
-		/* gphoto:summary */
-		/* @summary and @description are the same, so they're combined to @description */
-		xmlChar *summary = xmlNodeListGetString (doc, node->children, TRUE);
-		gdata_picasaweb_album_set_description (self, (gchar*) summary);
-		xmlFree (summary);
-	} else if (xmlStrcmp (node->name, (xmlChar*) "name") == 0) {
-		/* gphoto:name */
-		xmlChar *name = xmlNodeListGetString (doc, node->children, TRUE);
-		if (name == NULL || *name == '\0') {
-			xmlFree (name);
-			return gdata_parser_error_required_content_missing (node, error);
-		}
-		xmlFree (self->priv->name);
-		self->priv->name = (gchar*) name;
 	} else if (xmlStrcmp (node->name, (xmlChar*) "location") == 0) {
 		/* gphoto:location */
 		xmlChar *location = xmlNodeListGetString (doc, node->children, TRUE);
@@ -723,7 +675,7 @@ 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:name?, gphoto:id */
+	/* TODO: gphoto:id */
 	if (priv->location != NULL)
 		gdata_parser_string_append_escaped (xml_string, "<gphoto:location>", priv->location, "</gphoto:location>");
 
@@ -852,23 +804,6 @@ gdata_picasaweb_album_get_edited (GDataPicasaWebAlbum *self, GTimeVal *edited)
 }
 
 /**
- * gdata_picasaweb_album_get_name:
- * @self: a #GDataPicasaWebAlbum
- *
- * Gets the #GDataPicasaWebAlbum:name property.
- *
- * Return value: the album's name, as usable in URIs, or %NULL
- *
- * Since: 0.4.0
- **/
-const gchar *
-gdata_picasaweb_album_get_name (GDataPicasaWebAlbum *self)
-{
-	g_return_val_if_fail (GDATA_IS_PICASAWEB_ALBUM (self), NULL);
-	return self->priv->name;
-}
-
-/**
  * gdata_picasaweb_album_get_location:
  * @self: a #GDataPicasaWebAlbum
  *
@@ -1122,45 +1057,6 @@ gdata_picasaweb_album_set_tags (GDataPicasaWebAlbum *self, const gchar *tags)
 }
 
 /**
- * gdata_picasaweb_album_get_description:
- * @self: a #GDataPicasaWebAlbum
- *
- * Gets the #GDataPicasaWebAlbum:description property.
- *
- * Return value: the album's long text description, or %NULL
- *
- * Since: 0.4.0
- **/
-const gchar *
-gdata_picasaweb_album_get_description (GDataPicasaWebAlbum *self)
-{
-	g_return_val_if_fail (GDATA_IS_PICASAWEB_ALBUM (self), NULL);
-	return gdata_media_group_get_description (self->priv->media_group);
-}
-
-/**
- * gdata_picasaweb_album_set_description:
- * @self: a #GDataPicasaWebAlbum
- * @description: the album's new description, or %NULL
- *
- * Sets the #GDataPicasaWebAlbum:description property to the new description, @description.
- *
- * Set @description to %NULL to unset the album's description.
- *
- * Since: 0.4.0
- **/
-void
-gdata_picasaweb_album_set_description (GDataPicasaWebAlbum *self, const gchar *description)
-{
-	g_return_if_fail (GDATA_IS_PICASAWEB_ALBUM (self));
-
-	/* media:group/media:description is the same as atom:summary */
-	gdata_media_group_set_description (self->priv->media_group, description);
-	/*gdata_entry_set_summary (GDATA_ENTRY (self), description); TODO function doesn't exist yet */
-	g_object_notify (G_OBJECT (self), "description");
-}
-
-/**
  * gdata_picasaweb_album_get_contents:
  * @self: a #GDataPicasaWebAlbum
  *
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.h b/gdata/services/picasaweb/gdata-picasaweb-album.h
index a79c1d3..d28f6b4 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.h
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.h
@@ -83,7 +83,6 @@ GDataPicasaWebAlbum *gdata_picasaweb_album_new (const gchar *id) G_GNUC_WARN_UNU
 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);
-const gchar *gdata_picasaweb_album_get_name (GDataPicasaWebAlbum *self);
 const gchar *gdata_picasaweb_album_get_location (GDataPicasaWebAlbum *self);
 void gdata_picasaweb_album_set_location (GDataPicasaWebAlbum *self, const gchar *location);
 GDataPicasaWebVisibility gdata_picasaweb_album_get_visibility (GDataPicasaWebAlbum *self);
@@ -98,8 +97,6 @@ void gdata_picasaweb_album_set_is_commenting_enabled (GDataPicasaWebAlbum *self,
 guint gdata_picasaweb_album_get_comment_count (GDataPicasaWebAlbum *self);
 const gchar *gdata_picasaweb_album_get_tags (GDataPicasaWebAlbum *self);
 void gdata_picasaweb_album_set_tags (GDataPicasaWebAlbum *self, const gchar *tags);
-const gchar *gdata_picasaweb_album_get_description (GDataPicasaWebAlbum *self);
-void gdata_picasaweb_album_set_description (GDataPicasaWebAlbum *self, const gchar *description);
 GList *gdata_picasaweb_album_get_contents (GDataPicasaWebAlbum *self);
 GList *gdata_picasaweb_album_get_thumbnails (GDataPicasaWebAlbum *self);
 void gdata_picasaweb_album_get_coordinates (GDataPicasaWebAlbum *self, gdouble *latitude, gdouble *longitude);
diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c
index 6779b16..018dafa 100644
--- a/gdata/tests/picasaweb.c
+++ b/gdata/tests/picasaweb.c
@@ -432,10 +432,9 @@ test_album (GDataService *service)
 	g_assert_cmpstr (str, ==, "2009-04-26T06:57:03.474000Z");
 	g_free (str);
 
-	g_assert_cmpstr (gdata_picasaweb_album_get_description (album), ==, "This is the test description.  This album should be in Venice.");
+	g_assert_cmpstr (gdata_entry_get_title (GDATA_ENTRY (album)), ==, "Test Album 1 - Venice - Public");
+	g_assert_cmpstr (gdata_entry_get_summary (GDATA_ENTRY (album)), ==, "This is the test description.  This album should be in Venice.");
 	g_assert_cmpint (gdata_picasaweb_album_get_visibility (album), ==, GDATA_PICASAWEB_PUBLIC);
-	/* TODO: Google doesn't seem to be returning this one any more; investigate */
-	/*g_assert_cmpstr (gdata_picasaweb_album_get_name (album), ==, "TestAlbum1VenicePublic");*/
 	g_assert_cmpstr (gdata_picasaweb_album_get_location (album), ==, "Venice");
 
 	gdata_picasaweb_album_get_timestamp (album, &_time);



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