Blame gdata/gd/gdata-gd-who.c

Packit 4b6dd7
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
Packit 4b6dd7
/*
Packit 4b6dd7
 * GData Client
Packit 4b6dd7
 * Copyright (C) Philip Withnall 2009–2010 <philip@tecnocode.co.uk>
Packit 4b6dd7
 *
Packit 4b6dd7
 * GData Client is free software; you can redistribute it and/or
Packit 4b6dd7
 * modify it under the terms of the GNU Lesser General Public
Packit 4b6dd7
 * License as published by the Free Software Foundation; either
Packit 4b6dd7
 * version 2.1 of the License, or (at your option) any later version.
Packit 4b6dd7
 *
Packit 4b6dd7
 * GData Client is distributed in the hope that it will be useful,
Packit 4b6dd7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4b6dd7
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 4b6dd7
 * Lesser General Public License for more details.
Packit 4b6dd7
 *
Packit 4b6dd7
 * You should have received a copy of the GNU Lesser General Public
Packit 4b6dd7
 * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
Packit 4b6dd7
 */
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * SECTION:gdata-gd-who
Packit 4b6dd7
 * @short_description: GData who element
Packit 4b6dd7
 * @stability: Stable
Packit 4b6dd7
 * @include: gdata/gd/gdata-gd-who.h
Packit 4b6dd7
 *
Packit 4b6dd7
 * #GDataGDWho represents an "who" element from the
Packit 4b6dd7
 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdWho">GData specification</ulink>.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
Packit 4b6dd7
#include <glib.h>
Packit 4b6dd7
#include <libxml/parser.h>
Packit 4b6dd7
Packit 4b6dd7
#include "gdata-gd-who.h"
Packit 4b6dd7
#include "gdata-parsable.h"
Packit 4b6dd7
#include "gdata-parser.h"
Packit 4b6dd7
#include "gdata-comparable.h"
Packit 4b6dd7
Packit 4b6dd7
static void gdata_gd_who_comparable_init (GDataComparableIface *iface);
Packit 4b6dd7
static void gdata_gd_who_finalize (GObject *object);
Packit 4b6dd7
static void gdata_gd_who_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
Packit 4b6dd7
static void gdata_gd_who_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
Packit 4b6dd7
static gboolean pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
Packit 4b6dd7
/*static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);*/
Packit 4b6dd7
static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
Packit 4b6dd7
/*static void get_xml (GDataParsable *parsable, GString *xml_string);*/
Packit 4b6dd7
static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
Packit 4b6dd7
Packit 4b6dd7
struct _GDataGDWhoPrivate {
Packit 4b6dd7
	gchar *relation_type;
Packit 4b6dd7
	gchar *value_string;
Packit 4b6dd7
	gchar *email_address;
Packit 4b6dd7
};
Packit 4b6dd7
Packit 4b6dd7
enum {
Packit 4b6dd7
	PROP_RELATION_TYPE = 1,
Packit 4b6dd7
	PROP_VALUE_STRING,
Packit 4b6dd7
	PROP_EMAIL_ADDRESS
Packit 4b6dd7
};
Packit 4b6dd7
Packit 4b6dd7
G_DEFINE_TYPE_WITH_CODE (GDataGDWho, gdata_gd_who, GDATA_TYPE_PARSABLE,
Packit 4b6dd7
                         G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_who_comparable_init))
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_class_init (GDataGDWhoClass *klass)
Packit 4b6dd7
{
Packit 4b6dd7
	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
Packit 4b6dd7
	GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass);
Packit 4b6dd7
Packit 4b6dd7
	g_type_class_add_private (klass, sizeof (GDataGDWhoPrivate));
Packit 4b6dd7
Packit 4b6dd7
	gobject_class->get_property = gdata_gd_who_get_property;
Packit 4b6dd7
	gobject_class->set_property = gdata_gd_who_set_property;
Packit 4b6dd7
	gobject_class->finalize = gdata_gd_who_finalize;
Packit 4b6dd7
Packit 4b6dd7
	parsable_class->pre_parse_xml = pre_parse_xml;
Packit 4b6dd7
	/*parsable_class->parse_xml = parse_xml;*/
Packit 4b6dd7
	parsable_class->pre_get_xml = pre_get_xml;
Packit 4b6dd7
	/*parsable_class->get_xml = get_xml;*/
Packit 4b6dd7
	parsable_class->get_namespaces = get_namespaces;
Packit 4b6dd7
	parsable_class->element_name = "who";
Packit 4b6dd7
	parsable_class->element_namespace = "gd";
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDWho:relation-type:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Specifies the relationship between the containing entity and the contained person. For example: %GDATA_GD_WHO_EVENT_PERFORMER or
Packit 4b6dd7
	 * %GDATA_GD_WHO_EVENT_ATTENDEE.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * For more information, see the
Packit 4b6dd7
	 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdWho">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_RELATION_TYPE,
Packit 4b6dd7
	                                 g_param_spec_string ("relation-type",
Packit 4b6dd7
	                                                      "Relation type", "Specifies the relationship between the container and the containee.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDWho:value-string:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * A simple string representation of this person.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * For more information, see the
Packit 4b6dd7
	 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdWho">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_VALUE_STRING,
Packit 4b6dd7
	                                 g_param_spec_string ("value-string",
Packit 4b6dd7
	                                                      "Value string", "A simple string representation of this person.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDWho:email-address:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The e-mail address of the person represented by the #GDataGDWho.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * For more information, see the
Packit 4b6dd7
	 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdWho">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_EMAIL_ADDRESS,
Packit 4b6dd7
	                                 g_param_spec_string ("email-address",
Packit 4b6dd7
	                                                      "E-mail address", "The e-mail address of the person represented by the #GDataGDWho.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static gint
Packit 4b6dd7
compare_with (GDataComparable *self, GDataComparable *other)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *a = ((GDataGDWho*) self)->priv, *b = ((GDataGDWho*) other)->priv;
Packit 4b6dd7
Packit 4b6dd7
	if (g_strcmp0 (a->value_string, b->value_string) == 0 && g_strcmp0 (a->email_address, b->email_address) == 0)
Packit 4b6dd7
		return 0;
Packit 4b6dd7
	return 1;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_comparable_init (GDataComparableIface *iface)
Packit 4b6dd7
{
Packit 4b6dd7
	iface->compare_with = compare_with;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_init (GDataGDWho *self)
Packit 4b6dd7
{
Packit 4b6dd7
	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_WHO, GDataGDWhoPrivate);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_finalize (GObject *object)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (object)->priv;
Packit 4b6dd7
Packit 4b6dd7
	g_free (priv->relation_type);
Packit 4b6dd7
	g_free (priv->value_string);
Packit 4b6dd7
	g_free (priv->email_address);
Packit 4b6dd7
Packit 4b6dd7
	/* Chain up to the parent class */
Packit 4b6dd7
	G_OBJECT_CLASS (gdata_gd_who_parent_class)->finalize (object);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (object)->priv;
Packit 4b6dd7
Packit 4b6dd7
	switch (property_id) {
Packit 4b6dd7
		case PROP_RELATION_TYPE:
Packit 4b6dd7
			g_value_set_string (value, priv->relation_type);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_VALUE_STRING:
Packit 4b6dd7
			g_value_set_string (value, priv->value_string);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_EMAIL_ADDRESS:
Packit 4b6dd7
			g_value_set_string (value, priv->email_address);
Packit 4b6dd7
			break;
Packit 4b6dd7
		default:
Packit 4b6dd7
			/* We don't have any other property... */
Packit 4b6dd7
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
Packit 4b6dd7
			break;
Packit 4b6dd7
	}
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_who_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWho *self = GDATA_GD_WHO (object);
Packit 4b6dd7
Packit 4b6dd7
	switch (property_id) {
Packit 4b6dd7
		case PROP_RELATION_TYPE:
Packit 4b6dd7
			gdata_gd_who_set_relation_type (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_VALUE_STRING:
Packit 4b6dd7
			gdata_gd_who_set_value_string (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_EMAIL_ADDRESS:
Packit 4b6dd7
			gdata_gd_who_set_email_address (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		default:
Packit 4b6dd7
			/* We don't have any other property... */
Packit 4b6dd7
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
Packit 4b6dd7
			break;
Packit 4b6dd7
	}
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static gboolean
Packit 4b6dd7
pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error)
Packit 4b6dd7
{
Packit 4b6dd7
	xmlChar *rel, *email;
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	rel = xmlGetProp (root_node, (xmlChar*) "rel");
Packit 4b6dd7
	if (rel != NULL && *rel == '\0') {
Packit 4b6dd7
		xmlFree (rel);
Packit 4b6dd7
		return gdata_parser_error_required_property_missing (root_node, "rel", error);
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
	email = xmlGetProp (root_node, (xmlChar*) "email");
Packit 4b6dd7
	if (email != NULL && *email == '\0') {
Packit 4b6dd7
		xmlFree (rel);
Packit 4b6dd7
		xmlFree (email);
Packit 4b6dd7
		return gdata_parser_error_required_property_missing (root_node, "email", error);
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
	priv->relation_type = (gchar*) rel;
Packit 4b6dd7
	priv->value_string = (gchar*) xmlGetProp (root_node, (xmlChar*) "valueString");
Packit 4b6dd7
	priv->email_address = (gchar*) email;
Packit 4b6dd7
Packit 4b6dd7
	return TRUE;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/*static gboolean
Packit 4b6dd7
parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	TODO: deal with the attendeeType, attendeeStatus and entryLink
Packit 4b6dd7
Packit 4b6dd7
	return TRUE;
Packit 4b6dd7
}*/
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
pre_get_xml (GDataParsable *parsable, GString *xml_string)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	if (priv->email_address != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " email='", priv->email_address, "'");
Packit 4b6dd7
	if (priv->relation_type != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " rel='", priv->relation_type, "'");
Packit 4b6dd7
	if (priv->value_string != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " valueString='", priv->value_string, "'");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/*static void
Packit 4b6dd7
get_xml (GDataParsable *parsable, GString *xml_string)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	TODO: deal with the attendeeType, attendeeStatus and entryLink
Packit 4b6dd7
}*/
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
Packit 4b6dd7
{
Packit 4b6dd7
	g_hash_table_insert (namespaces, (gchar*) "gd", (gchar*) "http://schemas.google.com/g/2005");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_new:
Packit 4b6dd7
 * @relation_type: (allow-none): the relationship between the item and this person, or %NULL
Packit 4b6dd7
 * @value_string: (allow-none): a string to represent the person, or %NULL
Packit 4b6dd7
 * @email_address: (allow-none): the person's e-mail address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Creates a new #GDataGDWho. More information is available in the 
Packit 4b6dd7
 * url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdWho">GData specification</ulink>.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Currently, entryLink functionality is not implemented in #GDataGDWho.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: a new #GDataGDWho; unref with g_object_unref()
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.2.0
Packit 4b6dd7
 */
Packit 4b6dd7
GDataGDWho *
Packit 4b6dd7
gdata_gd_who_new (const gchar *relation_type, const gchar *value_string, const gchar *email_address)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (relation_type == NULL || *relation_type != '\0', NULL);
Packit 4b6dd7
	g_return_val_if_fail (email_address == NULL || *email_address != '\0', NULL);
Packit 4b6dd7
	return g_object_new (GDATA_TYPE_GD_WHO, "relation-type", relation_type, "value-string", value_string, "email-address", email_address, NULL);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_get_relation_type:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDWho:relation-type property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the relation type, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_who_get_relation_type (GDataGDWho *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_WHO (self), NULL);
Packit 4b6dd7
	return self->priv->relation_type;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_set_relation_type:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 * @relation_type: (allow-none): the new relation type, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDWho:relation-type property to @relation_type.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @relation_type to %NULL to unset the property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_who_set_relation_type (GDataGDWho *self, const gchar *relation_type)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_WHO (self));
Packit 4b6dd7
	g_return_if_fail (relation_type == NULL || *relation_type != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->relation_type);
Packit 4b6dd7
	self->priv->relation_type = g_strdup (relation_type);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "relation-type");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_get_value_string:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDWho:value-string property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the value string, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_who_get_value_string (GDataGDWho *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_WHO (self), NULL);
Packit 4b6dd7
	return self->priv->value_string;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_set_value_string:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 * @value_string: (allow-none): the new value string, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDWho:value-string property to @value_string.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @value_string to %NULL to unset the property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_who_set_value_string (GDataGDWho *self, const gchar *value_string)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_WHO (self));
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->value_string);
Packit 4b6dd7
	self->priv->value_string = g_strdup (value_string);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "value-string");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_get_email_address:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDWho:email-address property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the e-mail address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_who_get_email_address (GDataGDWho *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_WHO (self), NULL);
Packit 4b6dd7
	return self->priv->email_address;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_who_set_email_address:
Packit 4b6dd7
 * @self: a #GDataGDWho
Packit 4b6dd7
 * @email_address: (allow-none): the new e-mail address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDWho:email-address property to @email_address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @email_address to %NULL to unset the property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_who_set_email_address (GDataGDWho *self, const gchar *email_address)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_WHO (self));
Packit 4b6dd7
	g_return_if_fail (email_address == NULL || *email_address != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->email_address);
Packit 4b6dd7
	self->priv->email_address = g_strdup (email_address);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "email-address");
Packit 4b6dd7
}