[libgdata] [gd] Add support for e-mail display names and organization locations



commit 45f641673c3536f65f54d241c526132975617483
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Jan 21 22:36:32 2010 +0000

    [gd] Add support for e-mail display names and organization locations
    
    Add support for e-mail address display names, and divination of the location
    of organizations. This adds the following API:
     * gdata_gd_organization_get_location
     * gdata_gd_organization_set_location
     * gdata_gd_email_address_get_display_name
     * gdata_gd_email_address_set_display_name
    Full documentation and test coverage is included.

 docs/reference/gdata-sections.txt  |    4 ++
 gdata/gd/gdata-gd-email-address.c  |   74 +++++++++++++++++++++++++--
 gdata/gd/gdata-gd-email-address.h  |    3 +
 gdata/gd/gdata-gd-organization.c   |   98 ++++++++++++++++++++++++++++++++++-
 gdata/gd/gdata-gd-organization.h   |    4 ++
 gdata/gd/gdata-gd-postal-address.c |    1 -
 gdata/gd/gdata-gd-where.c          |   20 ++++----
 gdata/gd/gdata-gd-who.c            |   20 ++++----
 gdata/gdata.symbols                |    4 ++
 gdata/tests/general.c              |   15 +++++-
 10 files changed, 213 insertions(+), 30 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 7f243a6..a6d4287 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -766,6 +766,8 @@ gdata_gd_organization_get_job_description
 gdata_gd_organization_set_job_description
 gdata_gd_organization_get_symbol
 gdata_gd_organization_set_symbol
+gdata_gd_organization_get_location
+gdata_gd_organization_set_location
 <SUBSECTION Standard>
 gdata_gd_organization_get_type
 GDATA_GD_ORGANIZATION
@@ -871,6 +873,8 @@ gdata_gd_email_address_get_label
 gdata_gd_email_address_set_label
 gdata_gd_email_address_is_primary
 gdata_gd_email_address_set_is_primary
+gdata_gd_email_address_get_display_name
+gdata_gd_email_address_set_display_name
 <SUBSECTION Standard>
 gdata_gd_email_address_get_type
 GDATA_GD_EMAIL_ADDRESS
diff --git a/gdata/gd/gdata-gd-email-address.c b/gdata/gd/gdata-gd-email-address.c
index a7e4ec4..022d052 100644
--- a/gdata/gd/gdata-gd-email-address.c
+++ b/gdata/gd/gdata-gd-email-address.c
@@ -27,8 +27,6 @@
  * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdEmail";>GData specification</ulink>.
  **/
 
-/* TODO: Implement "displayName": http://code.google.com/apis/gdata/docs/2.0/elements.html#gdEmail */
-
 #include <glib.h>
 #include <libxml/parser.h>
 
@@ -48,13 +46,15 @@ struct _GDataGDEmailAddressPrivate {
 	gchar *relation_type;
 	gchar *label;
 	gboolean is_primary;
+	gchar *display_name;
 };
 
 enum {
 	PROP_ADDRESS = 1,
 	PROP_RELATION_TYPE,
 	PROP_LABEL,
-	PROP_IS_PRIMARY
+	PROP_IS_PRIMARY,
+	PROP_DISPLAY_NAME
 };
 
 G_DEFINE_TYPE (GDataGDEmailAddress, gdata_gd_email_address, GDATA_TYPE_PARSABLE)
@@ -141,6 +141,22 @@ gdata_gd_email_address_class_init (GDataGDEmailAddressClass *klass)
 					"Primary?", "Indicates which e-mail address out of a group is primary.",
 					FALSE,
 					G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+	/**
+	 * GDataGDEmailAddress:display-name:
+	 *
+	 * A display name of the entity (e.g. a person) the e-mail address belongs to.
+	 *
+	 * For more information, see the
+	 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdEmail";>GData specification</ulink>.
+	 *
+	 * Since: 0.6.0
+	 **/
+	g_object_class_install_property (gobject_class, PROP_DISPLAY_NAME,
+				g_param_spec_string ("display-name",
+					"Display name", "A display name of the entity (e.g. a person) the e-mail address belongs to.",
+					NULL,
+					G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -157,6 +173,7 @@ gdata_gd_email_address_finalize (GObject *object)
 	g_free (priv->address);
 	g_free (priv->relation_type);
 	g_free (priv->label);
+	g_free (priv->display_name);
 
 	/* Chain up to the parent class */
 	G_OBJECT_CLASS (gdata_gd_email_address_parent_class)->finalize (object);
@@ -180,6 +197,9 @@ gdata_gd_email_address_get_property (GObject *object, guint property_id, GValue
 		case PROP_IS_PRIMARY:
 			g_value_set_boolean (value, priv->is_primary);
 			break;
+		case PROP_DISPLAY_NAME:
+			g_value_set_string (value, priv->display_name);
+			break;
 		default:
 			/* We don't have any other property... */
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -205,6 +225,9 @@ gdata_gd_email_address_set_property (GObject *object, guint property_id, const G
 		case PROP_IS_PRIMARY:
 			gdata_gd_email_address_set_is_primary (self, g_value_get_boolean (value));
 			break;
+		case PROP_DISPLAY_NAME:
+			gdata_gd_email_address_set_display_name (self, g_value_get_string (value));
+			break;
 		default:
 			/* We don't have any other property... */
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -215,7 +238,7 @@ gdata_gd_email_address_set_property (GObject *object, guint property_id, const G
 static gboolean
 pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error)
 {
-	xmlChar *address, *rel, *label, *primary;
+	xmlChar *address, *rel, *label, *primary, *display_name;
 	gboolean primary_bool;
 	GDataGDEmailAddressPrivate *priv = GDATA_GD_EMAIL_ADDRESS (parsable)->priv;
 
@@ -246,15 +269,18 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
 
 	/* Other properties */
 	label = xmlGetProp (root_node, (xmlChar*) "label");
+	display_name = xmlGetProp (root_node, (xmlChar*) "displayName");
 
 	priv->address = g_strdup ((gchar*) address);
 	priv->relation_type = g_strdup ((gchar*) rel);
 	priv->label = g_strdup ((gchar*) label);
 	priv->is_primary = primary_bool;
+	priv->display_name = g_strdup ((gchar*) display_name);
 
 	xmlFree (address);
 	xmlFree (rel);
 	xmlFree (label);
+	xmlFree (display_name);
 
 	return TRUE;
 }
@@ -269,6 +295,8 @@ pre_get_xml (GDataParsable *parsable, GString *xml_string)
 		g_string_append_printf (xml_string, " rel='%s'", priv->relation_type);
 	if (priv->label != NULL)
 		gdata_parser_string_append_escaped (xml_string, " label='", priv->label, "'");
+	if (priv->display_name != NULL)
+		gdata_parser_string_append_escaped (xml_string, " displayName='", priv->display_name, "'");
 
 	if (priv->is_primary == TRUE)
 		g_string_append (xml_string, " primary='true'");
@@ -480,3 +508,41 @@ gdata_gd_email_address_set_is_primary (GDataGDEmailAddress *self, gboolean is_pr
 	self->priv->is_primary = is_primary;
 	g_object_notify (G_OBJECT (self), "is-primary");
 }
+
+/**
+ * gdata_gd_email_address_get_display_name:
+ * @self: a #GDataGDEmailAddress
+ *
+ * Gets the #GDataGDEmailAddress:display-name property.
+ *
+ * Return value: a display name for the e-mail address, or %NULL
+ *
+ * Since: 0.6.0
+ **/
+const gchar *
+gdata_gd_email_address_get_display_name (GDataGDEmailAddress *self)
+{
+	g_return_val_if_fail (GDATA_IS_GD_EMAIL_ADDRESS (self), NULL);
+	return self->priv->display_name;
+}
+
+/**
+ * gdata_gd_email_address_set_display_name:
+ * @self: a #GDataGDEmailAddress
+ * @display_name: the new display name, or %NULL
+ *
+ * Sets the #GDataGDEmailAddress:display-name property to @display_name.
+ *
+ * Set @display_name to %NULL to unset the property in the e-mail address.
+ *
+ * Since: 0.6.0
+ **/
+void
+gdata_gd_email_address_set_display_name (GDataGDEmailAddress *self, const gchar *display_name)
+{
+	g_return_if_fail (GDATA_IS_GD_EMAIL_ADDRESS (self));
+
+	g_free (self->priv->display_name);
+	self->priv->display_name = g_strdup (display_name);
+	g_object_notify (G_OBJECT (self), "display-name");
+}
diff --git a/gdata/gd/gdata-gd-email-address.h b/gdata/gd/gdata-gd-email-address.h
index aed68c3..32887b2 100644
--- a/gdata/gd/gdata-gd-email-address.h
+++ b/gdata/gd/gdata-gd-email-address.h
@@ -73,6 +73,9 @@ void gdata_gd_email_address_set_relation_type (GDataGDEmailAddress *self, const
 const gchar *gdata_gd_email_address_get_label (GDataGDEmailAddress *self);
 void gdata_gd_email_address_set_label (GDataGDEmailAddress *self, const gchar *label);
 
+const gchar *gdata_gd_email_address_get_display_name (GDataGDEmailAddress *self);
+void gdata_gd_email_address_set_display_name (GDataGDEmailAddress *self, const gchar *display_name);
+
 gboolean gdata_gd_email_address_is_primary (GDataGDEmailAddress *self);
 void gdata_gd_email_address_set_is_primary (GDataGDEmailAddress *self, gboolean is_primary);
 
diff --git a/gdata/gd/gdata-gd-organization.c b/gdata/gd/gdata-gd-organization.c
index 32a328b..033cee7 100644
--- a/gdata/gd/gdata-gd-organization.c
+++ b/gdata/gd/gdata-gd-organization.c
@@ -27,15 +27,16 @@
  * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdOrganization";>GData specification</ulink>.
  **/
 
-/* TODO: Implement "where": http://code.google.com/apis/gdata/docs/2.0/elements.html#gdOrganization */
-
 #include <glib.h>
 #include <libxml/parser.h>
 
 #include "gdata-gd-organization.h"
 #include "gdata-parsable.h"
 #include "gdata-parser.h"
+#include "gdata-gd-where.h"
+#include "gdata-private.h"
 
+static void gdata_gd_organization_dispose (GObject *object);
 static void gdata_gd_organization_finalize (GObject *object);
 static void gdata_gd_organization_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_gd_organization_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
@@ -54,6 +55,7 @@ struct _GDataGDOrganizationPrivate {
 	gchar *department;
 	gchar *job_description;
 	gchar *symbol;
+	GDataGDWhere *location;
 };
 
 enum {
@@ -64,7 +66,8 @@ enum {
 	PROP_IS_PRIMARY,
 	PROP_DEPARTMENT,
 	PROP_JOB_DESCRIPTION,
-	PROP_SYMBOL
+	PROP_SYMBOL,
+	PROP_LOCATION
 };
 
 G_DEFINE_TYPE (GDataGDOrganization, gdata_gd_organization, GDATA_TYPE_PARSABLE)
@@ -80,6 +83,7 @@ gdata_gd_organization_class_init (GDataGDOrganizationClass *klass)
 
 	gobject_class->get_property = gdata_gd_organization_get_property;
 	gobject_class->set_property = gdata_gd_organization_set_property;
+	gobject_class->dispose = gdata_gd_organization_dispose;
 	gobject_class->finalize = gdata_gd_organization_finalize;
 
 	parsable_class->pre_parse_xml = pre_parse_xml;
@@ -218,6 +222,22 @@ gdata_gd_organization_class_init (GDataGDOrganizationClass *klass)
 					"Symbol", "Symbol of the organization.",
 					NULL,
 					G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+	/**
+	 * GDataGDOrganization:location:
+	 *
+	 * A place associated with the organization, e.g. office location.
+	 *
+	 * For more information, see the
+	 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdOrganization";>GData specification</ulink>.
+	 *
+	 * Since: 0.6.0
+	 **/
+	g_object_class_install_property (gobject_class, PROP_LOCATION,
+				g_param_spec_object ("location",
+					"Location", "A place associated with the organization, e.g. office location.",
+					GDATA_TYPE_GD_WHERE,
+					G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -227,6 +247,18 @@ gdata_gd_organization_init (GDataGDOrganization *self)
 }
 
 static void
+gdata_gd_organization_dispose (GObject *object)
+{
+	GDataGDOrganizationPrivate *priv = GDATA_GD_ORGANIZATION (object)->priv;
+
+	if (priv->location != NULL)
+		g_object_unref (priv->location);
+
+	/* Chain up to the parent class */
+	G_OBJECT_CLASS (gdata_gd_organization_parent_class)->dispose (object);
+}
+
+static void
 gdata_gd_organization_finalize (GObject *object)
 {
 	GDataGDOrganizationPrivate *priv = GDATA_GD_ORGANIZATION (object)->priv;
@@ -273,6 +305,9 @@ gdata_gd_organization_get_property (GObject *object, guint property_id, GValue *
 		case PROP_SYMBOL:
 			g_value_set_string (value, priv->symbol);
 			break;
+		case PROP_LOCATION:
+			g_value_set_object (value, priv->location);
+			break;
 		default:
 			/* We don't have any other property... */
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -310,6 +345,9 @@ gdata_gd_organization_set_property (GObject *object, guint property_id, const GV
 		case PROP_SYMBOL:
 			gdata_gd_organization_set_symbol (self, g_value_get_string (value));
 			break;
+		case PROP_LOCATION:
+			gdata_gd_organization_set_location (self, g_value_get_object (value));
+			break;
 		default:
 			/* We don't have any other property... */
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -412,6 +450,18 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
 		symbol = xmlNodeListGetString (doc, node->children, TRUE);
 		priv->symbol = g_strdup ((gchar*) symbol);
 		xmlFree (symbol);
+	} else if (xmlStrcmp (node->name, (xmlChar*) "where") == 0) {
+		/* gd:where */
+		GDataGDWhere *location = GDATA_GD_WHERE (_gdata_parsable_new_from_xml_node (GDATA_TYPE_GD_WHERE, doc, node, NULL, error));
+		if (location == NULL)
+			return FALSE;
+
+		if (priv->location != NULL) {
+			g_object_unref (location);
+			return gdata_parser_error_duplicate_element (node, error);
+		}
+
+		priv->location = location;
 	} else if (GDATA_PARSABLE_CLASS (gdata_gd_organization_parent_class)->parse_xml (parsable, doc, node, user_data, error) == FALSE) {
 		/* Error! */
 		return FALSE;
@@ -451,6 +501,8 @@ get_xml (GDataParsable *parsable, GString *xml_string)
 		gdata_parser_string_append_escaped (xml_string, "<gd:orgJobDescription>", priv->job_description, "</gd:orgJobDescription>");
 	if (priv->symbol != NULL)
 		gdata_parser_string_append_escaped (xml_string, "<gd:orgSymbol>", priv->symbol, "</gd:orgSymbol>");
+	if (priv->location != NULL)
+		_gdata_parsable_get_xml (GDATA_PARSABLE (priv->location), xml_string, FALSE);
 }
 
 static void
@@ -813,3 +865,43 @@ gdata_gd_organization_set_symbol (GDataGDOrganization *self, const gchar *symbol
 	self->priv->symbol = g_strdup (symbol);
 	g_object_notify (G_OBJECT (self), "symbol");
 }
+
+/**
+ * gdata_gd_organization_get_location:
+ * @self: a #GDataGDOrganization
+ *
+ * Gets the #GDataGDOrganization:location property.
+ *
+ * Return value: the organization's location, or %NULL
+ *
+ * Since: 0.6.0
+ **/
+GDataGDWhere *
+gdata_gd_organization_get_location (GDataGDOrganization *self)
+{
+	g_return_val_if_fail (GDATA_IS_GD_ORGANIZATION (self), NULL);
+	return self->priv->location;
+}
+
+/**
+ * gdata_gd_organization_set_location:
+ * @self: a #GDataGDOrganization
+ * @location: the new location for the organization, or %NULL
+ *
+ * Sets the #GDataGDOrganization:location property to @location.
+ *
+ * Set @location to %NULL to unset the property in the organization.
+ *
+ * Since: 0.6.0
+ **/
+void
+gdata_gd_organization_set_location (GDataGDOrganization *self, GDataGDWhere *location)
+{
+	g_return_if_fail (GDATA_IS_GD_ORGANIZATION (self));
+	g_return_if_fail (location == NULL || GDATA_IS_GD_WHERE (location));
+
+	if (self->priv->location != NULL)
+		g_object_unref (self->priv->location);
+	self->priv->location = (location != NULL) ? g_object_ref (location) : NULL;
+	g_object_notify (G_OBJECT (self), "location");
+}
diff --git a/gdata/gd/gdata-gd-organization.h b/gdata/gd/gdata-gd-organization.h
index 1351ce8..8b3e6f3 100644
--- a/gdata/gd/gdata-gd-organization.h
+++ b/gdata/gd/gdata-gd-organization.h
@@ -24,6 +24,7 @@
 #include <glib-object.h>
 
 #include <gdata/gdata-parsable.h>
+#include <gdata/gd/gdata-gd-where.h>
 
 G_BEGIN_DECLS
 
@@ -88,6 +89,9 @@ void gdata_gd_organization_set_job_description (GDataGDOrganization *self, const
 const gchar *gdata_gd_organization_get_symbol (GDataGDOrganization *self);
 void gdata_gd_organization_set_symbol (GDataGDOrganization *self, const gchar *symbol);
 
+GDataGDWhere *gdata_gd_organization_get_location (GDataGDOrganization *self);
+void gdata_gd_organization_set_location (GDataGDOrganization *self, GDataGDWhere *location);
+
 G_END_DECLS
 
 #endif /* !GDATA_GD_ORGANIZATION_H */
diff --git a/gdata/gd/gdata-gd-postal-address.c b/gdata/gd/gdata-gd-postal-address.c
index 5dc222d..786c5ff 100644
--- a/gdata/gd/gdata-gd-postal-address.c
+++ b/gdata/gd/gdata-gd-postal-address.c
@@ -367,7 +367,6 @@ gdata_gd_postal_address_class_init (GDataGDPostalAddressClass *klass)
 					NULL,
 					G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
-	/* TODO: Should be an enum? */
 	/**
 	 * GDataGDPostalAddress:country-code:
 	 *
diff --git a/gdata/gd/gdata-gd-where.c b/gdata/gd/gdata-gd-where.c
index 12c8a60..7d4b205 100644
--- a/gdata/gd/gdata-gd-where.c
+++ b/gdata/gd/gdata-gd-where.c
@@ -38,9 +38,9 @@ static void gdata_gd_where_finalize (GObject *object);
 static void gdata_gd_where_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_gd_where_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static gboolean pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
+/*static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);*/
 static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
-static void get_xml (GDataParsable *parsable, GString *xml_string);
+/*static void get_xml (GDataParsable *parsable, GString *xml_string);*/
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 
 struct _GDataGDWherePrivate {
@@ -71,9 +71,9 @@ gdata_gd_where_class_init (GDataGDWhereClass *klass)
 	gobject_class->finalize = gdata_gd_where_finalize;
 
 	parsable_class->pre_parse_xml = pre_parse_xml;
-	parsable_class->parse_xml = parse_xml;
+	/*parsable_class->parse_xml = parse_xml;*/
 	parsable_class->pre_get_xml = pre_get_xml;
-	parsable_class->get_xml = get_xml;
+	/*parsable_class->get_xml = get_xml;*/
 	parsable_class->get_namespaces = get_namespaces;
 	parsable_class->element_name = "where";
 	parsable_class->element_namespace = "gd";
@@ -216,15 +216,15 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
 	return TRUE;
 }
 
-static gboolean
+/*static gboolean
 parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
 {
 	GDataGDWherePrivate *priv = GDATA_GD_WHERE (parsable)->priv;
 
-	/* TODO: deal with the entryLink */
+	TODO: deal with the entryLink
 
 	return TRUE;
-}
+}*/
 
 static void
 pre_get_xml (GDataParsable *parsable, GString *xml_string)
@@ -241,13 +241,13 @@ pre_get_xml (GDataParsable *parsable, GString *xml_string)
 		gdata_parser_string_append_escaped (xml_string, " valueString='", priv->value_string, "'");
 }
 
-static void
+/*static void
 get_xml (GDataParsable *parsable, GString *xml_string)
 {
 	GDataGDWherePrivate *priv = GDATA_GD_WHERE (parsable)->priv;
 
-	/* TODO: deal with the entryLink */
-}
+	TODO: deal with the entryLink
+}*/
 
 static void
 get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
diff --git a/gdata/gd/gdata-gd-who.c b/gdata/gd/gdata-gd-who.c
index 93693b6..8238378 100644
--- a/gdata/gd/gdata-gd-who.c
+++ b/gdata/gd/gdata-gd-who.c
@@ -38,9 +38,9 @@ static void gdata_gd_who_finalize (GObject *object);
 static void gdata_gd_who_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_gd_who_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static gboolean pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
+/*static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);*/
 static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
-static void get_xml (GDataParsable *parsable, GString *xml_string);
+/*static void get_xml (GDataParsable *parsable, GString *xml_string);*/
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 
 struct _GDataGDWhoPrivate {
@@ -71,9 +71,9 @@ gdata_gd_who_class_init (GDataGDWhoClass *klass)
 	gobject_class->finalize = gdata_gd_who_finalize;
 
 	parsable_class->pre_parse_xml = pre_parse_xml;
-	parsable_class->parse_xml = parse_xml;
+	/*parsable_class->parse_xml = parse_xml;*/
 	parsable_class->pre_get_xml = pre_get_xml;
-	parsable_class->get_xml = get_xml;
+	/*parsable_class->get_xml = get_xml;*/
 	parsable_class->get_namespaces = get_namespaces;
 	parsable_class->element_name = "who";
 	parsable_class->element_namespace = "gd";
@@ -221,15 +221,15 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
 	return TRUE;
 }
 
-static gboolean
+/*static gboolean
 parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
 {
 	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
 
-	/* TODO: deal with the attendeeType, attendeeStatus and entryLink */
+	TODO: deal with the attendeeType, attendeeStatus and entryLink
 
 	return TRUE;
-}
+}*/
 
 static void
 pre_get_xml (GDataParsable *parsable, GString *xml_string)
@@ -244,13 +244,13 @@ pre_get_xml (GDataParsable *parsable, GString *xml_string)
 		gdata_parser_string_append_escaped (xml_string, " valueString='", priv->value_string, "'");
 }
 
-static void
+/*static void
 get_xml (GDataParsable *parsable, GString *xml_string)
 {
 	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
 
-	/* TODO: deal with the attendeeType, attendeeStatus and entryLink */
-}
+	TODO: deal with the attendeeType, attendeeStatus and entryLink
+}*/
 
 static void
 get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index d5cb93f..2999a00 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -377,6 +377,8 @@ gdata_gd_organization_get_job_description
 gdata_gd_organization_set_job_description
 gdata_gd_organization_get_symbol
 gdata_gd_organization_set_symbol
+gdata_gd_organization_get_location
+gdata_gd_organization_set_location
 gdata_gd_when_get_type
 gdata_gd_when_new
 gdata_gd_when_compare
@@ -418,6 +420,8 @@ gdata_gd_email_address_get_label
 gdata_gd_email_address_set_label
 gdata_gd_email_address_is_primary
 gdata_gd_email_address_set_is_primary
+gdata_gd_email_address_get_display_name
+gdata_gd_email_address_set_display_name
 gdata_gd_im_address_get_type
 gdata_gd_im_address_new
 gdata_gd_im_address_compare
diff --git a/gdata/tests/general.c b/gdata/tests/general.c
index 036efe2..40400ad 100644
--- a/gdata/tests/general.c
+++ b/gdata/tests/general.c
@@ -1205,7 +1205,7 @@ test_gd_email_address (void)
 
 	email = GDATA_GD_EMAIL_ADDRESS (gdata_parsable_new_from_xml (GDATA_TYPE_GD_EMAIL_ADDRESS,
 		"<gd:email xmlns:gd='http://schemas.google.com/g/2005' label='Personal &amp; Private' rel='http://schemas.google.com/g/2005#home' "
-			"address='fubar gmail com' primary='true'/>", -1, &error));
+			"address='fubar gmail com' primary='true' displayName='&lt;John Smith&gt;'/>", -1, &error));
 	g_assert_no_error (error);
 	g_assert (GDATA_IS_GD_EMAIL_ADDRESS (email));
 	g_clear_error (&error);
@@ -1214,10 +1214,12 @@ test_gd_email_address (void)
 	g_assert_cmpstr (gdata_gd_email_address_get_address (email), ==, "fubar gmail com");
 	g_assert_cmpstr (gdata_gd_email_address_get_relation_type (email), ==, "http://schemas.google.com/g/2005#home";);
 	g_assert_cmpstr (gdata_gd_email_address_get_label (email), ==, "Personal & Private");
+	g_assert_cmpstr (gdata_gd_email_address_get_display_name (email), ==, "<John Smith>");
 	g_assert (gdata_gd_email_address_is_primary (email) == TRUE);
 
 	/* Compare it against another identical address */
 	email2 = gdata_gd_email_address_new ("fubar gmail com", "http://schemas.google.com/g/2005#home";, "Personal & Private", TRUE);
+	gdata_gd_email_address_set_display_name (email2, "<John Smith>");
 	g_assert_cmpint (gdata_gd_email_address_compare (email, email2), ==, 0);
 
 	/* â?¦and a different one */
@@ -1229,7 +1231,8 @@ test_gd_email_address (void)
 	xml = gdata_parsable_get_xml (GDATA_PARSABLE (email));
 	g_assert_cmpstr (xml, ==,
 			 "<gd:email xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' address='fubar gmail com' "
-				"rel='http://schemas.google.com/g/2005#home' label='Personal &amp; Private' primary='true'/>");
+				"rel='http://schemas.google.com/g/2005#home' label='Personal &amp; Private' displayName='&lt;John Smith&gt;' "
+				"primary='true'/>");
 	g_free (xml);
 	g_object_unref (email);
 
@@ -1244,6 +1247,7 @@ test_gd_email_address (void)
 	g_assert_cmpstr (gdata_gd_email_address_get_address (email), ==, "test example com");
 	g_assert (gdata_gd_email_address_get_relation_type (email) == NULL);
 	g_assert (gdata_gd_email_address_get_label (email) == NULL);
+	g_assert (gdata_gd_email_address_get_display_name (email) == NULL);
 	g_assert (gdata_gd_email_address_is_primary (email) == FALSE);
 
 	/* Check the outputted XML contains the unknown XML */
@@ -1400,6 +1404,7 @@ static void
 test_gd_organization (void)
 {
 	GDataGDOrganization *org, *org2;
+	GDataGDWhere *location;
 	gchar *xml;
 	GError *error = NULL;
 
@@ -1411,6 +1416,7 @@ test_gd_organization (void)
 			"<gd:orgDepartment>Finance</gd:orgDepartment>"
 			"<gd:orgJobDescription>Doing stuff.</gd:orgJobDescription>"
 			"<gd:orgSymbol>FOO</gd:orgSymbol>"
+			"<gd:where valueString='Test location'/>"
 		"</gd:organization>", -1, &error));
 	g_assert_no_error (error);
 	g_assert (GDATA_IS_GD_ORGANIZATION (org));
@@ -1424,11 +1430,14 @@ test_gd_organization (void)
 	g_assert_cmpstr (gdata_gd_organization_get_department (org), ==, "Finance");
 	g_assert_cmpstr (gdata_gd_organization_get_job_description (org), ==, "Doing stuff.");
 	g_assert_cmpstr (gdata_gd_organization_get_symbol (org), ==, "FOO");
+	location = gdata_gd_organization_get_location (org);
+	g_assert (GDATA_IS_GD_WHERE (location));
 	g_assert (gdata_gd_organization_is_primary (org) == TRUE);
 
 	/* Compare it against another identical organization */
 	org2 = gdata_gd_organization_new ("Google, Inc.", "<Angle Bracketeer>", "http://schemas.google.com/g/2005#work";, "Work & Occupation", TRUE);
 	gdata_gd_organization_set_department (org2, "Finance");
+	gdata_gd_organization_set_location (org2, location);
 	g_assert_cmpint (gdata_gd_organization_compare (org, org2), ==, 0);
 
 	/* â?¦and a different one */
@@ -1446,6 +1455,7 @@ test_gd_organization (void)
 				"<gd:orgDepartment>Finance</gd:orgDepartment>"
 				"<gd:orgJobDescription>Doing stuff.</gd:orgJobDescription>"
 				"<gd:orgSymbol>FOO</gd:orgSymbol>"
+				"<gd:where valueString='Test location'/>"
 			 "</gd:organization>");
 	g_free (xml);
 	g_object_unref (org);
@@ -1466,6 +1476,7 @@ test_gd_organization (void)
 	g_assert (gdata_gd_organization_get_department (org) == NULL);
 	g_assert (gdata_gd_organization_get_job_description (org) == NULL);
 	g_assert (gdata_gd_organization_get_symbol (org) == NULL);
+	g_assert (gdata_gd_organization_get_location (org) == NULL);
 
 	/* Check the outputted XML contains the unknown XML */
 	xml = gdata_parsable_get_xml (GDATA_PARSABLE (org));



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