Blame gdata/gd/gdata-gd-postal-address.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-postal-address
Packit 4b6dd7
 * @short_description: GData postal address element
Packit 4b6dd7
 * @stability: Stable
Packit 4b6dd7
 * @include: gdata/gd/gdata-gd-postal-address.h
Packit 4b6dd7
 *
Packit 4b6dd7
 * #GDataGDPostalAddress represents a "structuredPostalAddress" element from the
Packit 4b6dd7
 * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
 * Note that it does not represent a simple "postalAddress" element, as "structuredPostalAddress" is now used wherever possible in the GData API.
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
#include <string.h>
Packit 4b6dd7
Packit 4b6dd7
#include "gdata-gd-postal-address.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_postal_address_comparable_init (GDataComparableIface *iface);
Packit 4b6dd7
static void gdata_gd_postal_address_finalize (GObject *object);
Packit 4b6dd7
static void gdata_gd_postal_address_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
Packit 4b6dd7
static void gdata_gd_postal_address_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 *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 _GDataGDPostalAddressPrivate {
Packit 4b6dd7
	gchar *formatted_address;
Packit 4b6dd7
	gchar *relation_type;
Packit 4b6dd7
	gchar *label;
Packit 4b6dd7
	gboolean is_primary;
Packit 4b6dd7
	gchar *mail_class;
Packit 4b6dd7
	gchar *usage;
Packit 4b6dd7
	gchar *agent;
Packit 4b6dd7
	gchar *house_name;
Packit 4b6dd7
	gchar *street;
Packit 4b6dd7
	gchar *po_box;
Packit 4b6dd7
	gchar *neighborhood;
Packit 4b6dd7
	gchar *city;
Packit 4b6dd7
	gchar *subregion;
Packit 4b6dd7
	gchar *region;
Packit 4b6dd7
	gchar *postcode;
Packit 4b6dd7
	gchar *country;
Packit 4b6dd7
	gchar *country_code;
Packit 4b6dd7
};
Packit 4b6dd7
Packit 4b6dd7
enum {
Packit 4b6dd7
	PROP_FORMATTED_ADDRESS = 1,
Packit 4b6dd7
	PROP_RELATION_TYPE,
Packit 4b6dd7
	PROP_LABEL,
Packit 4b6dd7
	PROP_IS_PRIMARY,
Packit 4b6dd7
	PROP_MAIL_CLASS,
Packit 4b6dd7
	PROP_USAGE,
Packit 4b6dd7
	PROP_AGENT,
Packit 4b6dd7
	PROP_HOUSE_NAME,
Packit 4b6dd7
	PROP_STREET,
Packit 4b6dd7
	PROP_PO_BOX,
Packit 4b6dd7
	PROP_NEIGHBORHOOD,
Packit 4b6dd7
	PROP_CITY,
Packit 4b6dd7
	PROP_SUBREGION,
Packit 4b6dd7
	PROP_REGION,
Packit 4b6dd7
	PROP_POSTCODE,
Packit 4b6dd7
	PROP_COUNTRY,
Packit 4b6dd7
	PROP_COUNTRY_CODE
Packit 4b6dd7
};
Packit 4b6dd7
Packit 4b6dd7
G_DEFINE_TYPE_WITH_CODE (GDataGDPostalAddress, gdata_gd_postal_address, GDATA_TYPE_PARSABLE,
Packit 4b6dd7
                         G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_postal_address_comparable_init))
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_postal_address_class_init (GDataGDPostalAddressClass *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 (GDataGDPostalAddressPrivate));
Packit 4b6dd7
Packit 4b6dd7
	gobject_class->get_property = gdata_gd_postal_address_get_property;
Packit 4b6dd7
	gobject_class->set_property = gdata_gd_postal_address_set_property;
Packit 4b6dd7
	gobject_class->finalize = gdata_gd_postal_address_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 = "structuredPostalAddress";
Packit 4b6dd7
	parsable_class->element_namespace = "gd";
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:address:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The postal address itself, formatted and unstructured. It is preferred to use the other, structured properties rather than this one.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_FORMATTED_ADDRESS,
Packit 4b6dd7
	                                 g_param_spec_string ("address",
Packit 4b6dd7
	                                                      "Address", "The postal address itself.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:relation-type:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * A programmatic value that identifies the type of postal address. For example: %GDATA_GD_POSTAL_ADDRESS_WORK or
Packit 4b6dd7
	 * %GDATA_GD_POSTAL_ADDRESS_OTHER.
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#gdStructuredPostalAddress">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", "A programmatic value that identifies the type of postal address.",
Packit 4b6dd7
	                                                      GDATA_GD_POSTAL_ADDRESS_WORK,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:label:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * A simple string value used to name this postal address. It allows UIs to display a label such as "Work", "Personal", "Preferred", etc.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_LABEL,
Packit 4b6dd7
	                                 g_param_spec_string ("label",
Packit 4b6dd7
	                                                      "Label", "A simple string value used to name this postal address.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:is-primary:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Indicates which postal address out of a group is primary.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.4.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_IS_PRIMARY,
Packit 4b6dd7
	                                 g_param_spec_boolean ("is-primary",
Packit 4b6dd7
	                                                       "Primary?", "Indicates which postal address out of a group is primary.",
Packit 4b6dd7
	                                                       FALSE,
Packit 4b6dd7
	                                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:mail-class:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Classes of mail accepted at this address. For example: %GDATA_GD_MAIL_CLASS_LETTERS or %GDATA_GD_MAIL_CLASS_BOTH.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_MAIL_CLASS,
Packit 4b6dd7
	                                 g_param_spec_string ("mail-class",
Packit 4b6dd7
	                                                      "Mail class", "Classes of mail accepted at this address.",
Packit 4b6dd7
	                                                      GDATA_GD_MAIL_CLASS_BOTH,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:usage:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The context in which this addess can be used. For example: %GDATA_GD_ADDRESS_USAGE_GENERAL or %GDATA_GD_ADDRESS_USAGE_LOCAL.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_USAGE,
Packit 4b6dd7
	                                 g_param_spec_string ("usage",
Packit 4b6dd7
	                                                      "Usage", "The context in which this addess can be used.",
Packit 4b6dd7
	                                                      GDATA_GD_ADDRESS_USAGE_GENERAL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:agent:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The agent who actually receives the mail. Used in work addresses. Also for "in care of" or "c/o".
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_AGENT,
Packit 4b6dd7
	                                 g_param_spec_string ("agent",
Packit 4b6dd7
	                                                      "Agent", "The agent who actually receives the mail.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:house-name:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Used in places where houses or buildings have names (and not necessarily numbers).
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_HOUSE_NAME,
Packit 4b6dd7
	                                 g_param_spec_string ("house-name",
Packit 4b6dd7
	                                                      "House name", "Used in places where houses or buildings have names (and not numbers).",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:street:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Can be street, avenue, road, etc. This element also includes the house number and room/apartment/flat/floor number.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_STREET,
Packit 4b6dd7
	                                 g_param_spec_string ("street",
Packit 4b6dd7
	                                                      "Street", "Can be street, avenue, road, etc.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:po-box:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Covers actual P.O. boxes, drawers, locked bags, etc. This is usually but not always mutually exclusive with #GDataGDPostalAddress:street.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_PO_BOX,
Packit 4b6dd7
	                                 g_param_spec_string ("po-box",
Packit 4b6dd7
	                                                      "PO box", "Covers actual P.O. boxes, drawers, locked bags, etc.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:neighborhood:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * This is used to disambiguate a street address when a city contains more than one street with the same name, or to specify a small place
Packit 4b6dd7
	 * whose mail is routed through a larger postal town. In China it could be a county or a minor city.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_NEIGHBORHOOD,
Packit 4b6dd7
	                                 g_param_spec_string ("neighborhood",
Packit 4b6dd7
	                                                      "Neighborhood", "This is used to disambiguate a street address.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:city:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Can be city, village, town, borough, etc. This is the postal town and not necessarily the place of residence or place of business.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_CITY,
Packit 4b6dd7
	                                 g_param_spec_string ("city",
Packit 4b6dd7
	                                                      "City", "Can be city, village, town, borough, etc.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:subregion:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Handles administrative districts such as U.S. or U.K. counties that are not used for mail addressing purposes.
Packit 4b6dd7
	 * Subregion is not intended for delivery addresses.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_SUBREGION,
Packit 4b6dd7
	                                 g_param_spec_string ("subregion",
Packit 4b6dd7
	                                                      "Subregion", "Handles administrative districts such as U.S. or U.K. counties.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:region:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * A state, province, county (in Ireland), Land (in Germany), departement (in France), etc.
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_REGION,
Packit 4b6dd7
	                                 g_param_spec_string ("region",
Packit 4b6dd7
	                                                      "Region", "A state, province, county, Land, departement, etc.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:postcode:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Postal code. Usually country-wide, but sometimes specific to the city (e.g. "2" in "Dublin 2, Ireland" addresses).
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_POSTCODE,
Packit 4b6dd7
	                                 g_param_spec_string ("postcode",
Packit 4b6dd7
	                                                      "Postcode", "Postal code.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:country:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The name of the country. Since this is paired with #GDataGDPostalAddress:country-code, they must both be set with
Packit 4b6dd7
	 * gdata_gd_postal_address_set_country().
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#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_COUNTRY,
Packit 4b6dd7
	                                 g_param_spec_string ("country",
Packit 4b6dd7
	                                                      "Country", "The name of the country.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
Packit 4b6dd7
	/**
Packit 4b6dd7
	 * GDataGDPostalAddress:country-code:
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * The ISO 3166-1 alpha-2 country code for the country in #GDataGDPostalAddress:country. Since this is paired with
Packit 4b6dd7
	 * #GDataGDPostalAddress:country, they must both be set with gdata_gd_postal_address_set_country().
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#gdStructuredPostalAddress">GData specification</ulink>
Packit 4b6dd7
	 * or <ulink type="http" url="http://www.iso.org/iso/iso-3166-1_decoding_table">ISO 3166-1 alpha-2</ulink>.
Packit 4b6dd7
	 *
Packit 4b6dd7
	 * Since: 0.5.0
Packit 4b6dd7
	 */
Packit 4b6dd7
	g_object_class_install_property (gobject_class, PROP_COUNTRY_CODE,
Packit 4b6dd7
	                                 g_param_spec_string ("country-code",
Packit 4b6dd7
	                                                      "Country code", "The ISO 3166-1 alpha-2 country code for the country.",
Packit 4b6dd7
	                                                      NULL,
Packit 4b6dd7
	                                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static gint
Packit 4b6dd7
compare_with (GDataComparable *self, GDataComparable *other)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddressPrivate *a = ((GDataGDPostalAddress*) self)->priv, *b = ((GDataGDPostalAddress*) other)->priv;
Packit 4b6dd7
Packit 4b6dd7
	if (g_strcmp0 (a->street, b->street) == 0 && g_strcmp0 (a->po_box, b->po_box) == 0 &&
Packit 4b6dd7
	    g_strcmp0 (a->city, b->city) == 0 && g_strcmp0 (a->postcode, b->postcode) == 0)
Packit 4b6dd7
		return 0;
Packit 4b6dd7
	return 1;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_postal_address_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_postal_address_init (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_POSTAL_ADDRESS, GDataGDPostalAddressPrivate);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_postal_address_finalize (GObject *object)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (object)->priv;
Packit 4b6dd7
Packit 4b6dd7
	g_free (priv->formatted_address);
Packit 4b6dd7
	g_free (priv->relation_type);
Packit 4b6dd7
	g_free (priv->label);
Packit 4b6dd7
	g_free (priv->mail_class);
Packit 4b6dd7
	g_free (priv->usage);
Packit 4b6dd7
	g_free (priv->agent);
Packit 4b6dd7
	g_free (priv->house_name);
Packit 4b6dd7
	g_free (priv->street);
Packit 4b6dd7
	g_free (priv->po_box);
Packit 4b6dd7
	g_free (priv->neighborhood);
Packit 4b6dd7
	g_free (priv->city);
Packit 4b6dd7
	g_free (priv->subregion);
Packit 4b6dd7
	g_free (priv->region);
Packit 4b6dd7
	g_free (priv->postcode);
Packit 4b6dd7
	g_free (priv->country);
Packit 4b6dd7
	g_free (priv->country_code);
Packit 4b6dd7
Packit 4b6dd7
	/* Chain up to the parent class */
Packit 4b6dd7
	G_OBJECT_CLASS (gdata_gd_postal_address_parent_class)->finalize (object);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_gd_postal_address_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (object)->priv;
Packit 4b6dd7
Packit 4b6dd7
	switch (property_id) {
Packit 4b6dd7
		case PROP_FORMATTED_ADDRESS:
Packit 4b6dd7
			g_value_set_string (value, priv->formatted_address);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_RELATION_TYPE:
Packit 4b6dd7
			g_value_set_string (value, priv->relation_type);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_LABEL:
Packit 4b6dd7
			g_value_set_string (value, priv->label);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_IS_PRIMARY:
Packit 4b6dd7
			g_value_set_boolean (value, priv->is_primary);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_MAIL_CLASS:
Packit 4b6dd7
			g_value_set_string (value, priv->mail_class);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_USAGE:
Packit 4b6dd7
			g_value_set_string (value, priv->usage);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_AGENT:
Packit 4b6dd7
			g_value_set_string (value, priv->agent);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_HOUSE_NAME:
Packit 4b6dd7
			g_value_set_string (value, priv->house_name);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_STREET:
Packit 4b6dd7
			g_value_set_string (value, priv->street);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_PO_BOX:
Packit 4b6dd7
			g_value_set_string (value, priv->po_box);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_NEIGHBORHOOD:
Packit 4b6dd7
			g_value_set_string (value, priv->neighborhood);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_CITY:
Packit 4b6dd7
			g_value_set_string (value, priv->city);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_SUBREGION:
Packit 4b6dd7
			g_value_set_string (value, priv->subregion);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_REGION:
Packit 4b6dd7
			g_value_set_string (value, priv->region);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_POSTCODE:
Packit 4b6dd7
			g_value_set_string (value, priv->postcode);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_COUNTRY:
Packit 4b6dd7
			g_value_set_string (value, priv->country);
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_COUNTRY_CODE:
Packit 4b6dd7
			g_value_set_string (value, priv->country_code);
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_postal_address_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddress *self = GDATA_GD_POSTAL_ADDRESS (object);
Packit 4b6dd7
Packit 4b6dd7
	switch (property_id) {
Packit 4b6dd7
		case PROP_FORMATTED_ADDRESS:
Packit 4b6dd7
			gdata_gd_postal_address_set_address (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_RELATION_TYPE:
Packit 4b6dd7
			gdata_gd_postal_address_set_relation_type (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_LABEL:
Packit 4b6dd7
			gdata_gd_postal_address_set_label (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_IS_PRIMARY:
Packit 4b6dd7
			gdata_gd_postal_address_set_is_primary (self, g_value_get_boolean (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_MAIL_CLASS:
Packit 4b6dd7
			gdata_gd_postal_address_set_mail_class (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_USAGE:
Packit 4b6dd7
			gdata_gd_postal_address_set_usage (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_AGENT:
Packit 4b6dd7
			gdata_gd_postal_address_set_agent (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_HOUSE_NAME:
Packit 4b6dd7
			gdata_gd_postal_address_set_house_name (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_STREET:
Packit 4b6dd7
			gdata_gd_postal_address_set_street (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_PO_BOX:
Packit 4b6dd7
			gdata_gd_postal_address_set_po_box (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_NEIGHBORHOOD:
Packit 4b6dd7
			gdata_gd_postal_address_set_neighborhood (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_CITY:
Packit 4b6dd7
			gdata_gd_postal_address_set_city (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_SUBREGION:
Packit 4b6dd7
			gdata_gd_postal_address_set_subregion (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_REGION:
Packit 4b6dd7
			gdata_gd_postal_address_set_region (self, g_value_get_string (value));
Packit 4b6dd7
			break;
Packit 4b6dd7
		case PROP_POSTCODE:
Packit 4b6dd7
			gdata_gd_postal_address_set_postcode (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;
Packit 4b6dd7
	gboolean primary_bool;
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	/* Is it the primary postal address? */
Packit 4b6dd7
	if (gdata_parser_boolean_from_property (root_node, "primary", &primary_bool, 0, error) == FALSE)
Packit 4b6dd7
		return FALSE;
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
	priv->relation_type = (gchar*) rel;
Packit 4b6dd7
	priv->label = (gchar*) xmlGetProp (root_node, (xmlChar*) "label");
Packit 4b6dd7
	priv->mail_class = (gchar*) xmlGetProp (root_node, (xmlChar*) "mailClass");
Packit 4b6dd7
	priv->usage = (gchar*) xmlGetProp (root_node, (xmlChar*) "usage");
Packit 4b6dd7
	priv->is_primary = primary_bool;
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
	gboolean success;
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	if (gdata_parser_is_namespace (node, "http://schemas.google.com/g/2005") == TRUE) {
Packit 4b6dd7
		if (gdata_parser_string_from_element (node, "agent", P_NO_DUPES, &(priv->agent), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "housename", P_NO_DUPES, &(priv->house_name), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "pobox", P_NO_DUPES, &(priv->po_box), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "street", P_NO_DUPES, &(priv->street), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "neighborhood", P_NO_DUPES, &(priv->neighborhood), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "city", P_NO_DUPES, &(priv->city), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "subregion", P_NO_DUPES, &(priv->subregion), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "region", P_NO_DUPES, &(priv->region), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "postcode", P_NO_DUPES, &(priv->postcode), &success, error) == TRUE ||
Packit 4b6dd7
		    gdata_parser_string_from_element (node, "formattedAddress", P_NO_DUPES, &(priv->formatted_address), &success, error) == TRUE) {
Packit 4b6dd7
			return success;
Packit 4b6dd7
		} else if (xmlStrcmp (node->name, (xmlChar*) "country") == 0) {
Packit 4b6dd7
			/* gd:country */
Packit 4b6dd7
			priv->country_code = (gchar*) xmlGetProp (node, (xmlChar*) "code");
Packit 4b6dd7
			priv->country = (gchar*) xmlNodeListGetString (doc, node->children, TRUE);
Packit 4b6dd7
Packit 4b6dd7
			return TRUE;
Packit 4b6dd7
		}
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
	return GDATA_PARSABLE_CLASS (gdata_gd_postal_address_parent_class)->parse_xml (parsable, doc, node, user_data, error);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
pre_get_xml (GDataParsable *parsable, GString *xml_string)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
	if (priv->relation_type != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " rel='", priv->relation_type, "'");
Packit 4b6dd7
	if (priv->label != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " label='", priv->label, "'");
Packit 4b6dd7
	if (priv->mail_class != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " mailClass='", priv->mail_class, "'");
Packit 4b6dd7
	if (priv->usage != NULL)
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, " usage='", priv->usage, "'");
Packit 4b6dd7
Packit 4b6dd7
	if (priv->is_primary == TRUE)
Packit 4b6dd7
		g_string_append (xml_string, " primary='true'");
Packit 4b6dd7
	else
Packit 4b6dd7
		g_string_append (xml_string, " primary='false'");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
get_xml (GDataParsable *parsable, GString *xml_string)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataGDPostalAddressPrivate *priv = GDATA_GD_POSTAL_ADDRESS (parsable)->priv;
Packit 4b6dd7
Packit 4b6dd7
#define OUTPUT_STRING_ELEMENT(E,F)									\
Packit 4b6dd7
	if (priv->F != NULL)										\
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, "<gd:" E ">", priv->F, "</gd:" E ">");
Packit 4b6dd7
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("agent", agent)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("housename", house_name)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("street", street)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("pobox", po_box)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("neighborhood", neighborhood)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("city", city)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("subregion", subregion)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("region", region)
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("postcode", postcode)
Packit 4b6dd7
Packit 4b6dd7
	if (priv->country != NULL) {
Packit 4b6dd7
		if (priv->country_code != NULL)
Packit 4b6dd7
			gdata_parser_string_append_escaped (xml_string, "<gd:country code='", priv->country_code, "'>");
Packit 4b6dd7
		else
Packit 4b6dd7
			g_string_append (xml_string, "<gd:country>");
Packit 4b6dd7
		gdata_parser_string_append_escaped (xml_string, NULL, priv->country, "</gd:country>");
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
	OUTPUT_STRING_ELEMENT ("formattedAddress", formatted_address)
Packit 4b6dd7
Packit 4b6dd7
#undef OUTPUT_STRING_ELEMENT
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_postal_address_new:
Packit 4b6dd7
 * @relation_type: (allow-none): the relationship between the address and its owner, or %NULL
Packit 4b6dd7
 * @label: (allow-none): a human-readable label for the address, or %NULL
Packit 4b6dd7
 * @is_primary: %TRUE if this phone number is its owner's primary number, %FALSE otherwise
Packit 4b6dd7
 *
Packit 4b6dd7
 * Creates a new #GDataGDPostalAddress. More information is available in the 
Packit 4b6dd7
 * url="http://code.google.com/apis/gdata/docs/2.0/elements.html#gdStructuredPostalAddress">GData specification</ulink>.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: a new #GDataGDPostalAddress, or %NULL; unref with g_object_unref()
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.2.0
Packit 4b6dd7
 */
Packit 4b6dd7
GDataGDPostalAddress *
Packit 4b6dd7
gdata_gd_postal_address_new (const gchar *relation_type, const gchar *label, gboolean is_primary)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (relation_type == NULL || *relation_type != '\0', NULL);
Packit 4b6dd7
	return g_object_new (GDATA_TYPE_GD_POSTAL_ADDRESS, "relation-type", relation_type, "label", label, "is-primary", is_primary, NULL);
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_address:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:address property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address itself, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_address (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->formatted_address;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_address:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @address: (allow-none): the new postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:address property to @address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_address (GDataGDPostalAddress *self, const gchar *address)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
Packit 4b6dd7
	/* Trim leading and trailing whitespace from the address.
Packit 4b6dd7
	 * See here: http://code.google.com/apis/gdata/docs/1.0/elements.html#gdPostalAddress */
Packit 4b6dd7
	g_free (self->priv->formatted_address);
Packit 4b6dd7
	self->priv->formatted_address = gdata_parser_utf8_trim_whitespace (address);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "address");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_relation_type:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:relation-type property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' relation type, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_relation_type (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->relation_type;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_relation_type:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @relation_type: (allow-none): the new relation type for the postal_address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:relation-type property to @relation_type.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @relation_type to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_relation_type (GDataGDPostalAddress *self, const gchar *relation_type)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (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_postal_address_get_label:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:label property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' label, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_label (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->label;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_label:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @label: (allow-none): the new label for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:label property to @label.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @label to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_label (GDataGDPostalAddress *self, const gchar *label)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->label);
Packit 4b6dd7
	self->priv->label = g_strdup (label);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "label");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_is_primary:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:is-primary property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: %TRUE if this is the primary postal address, %FALSE otherwise
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
gboolean
Packit 4b6dd7
gdata_gd_postal_address_is_primary (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), FALSE);
Packit 4b6dd7
	return self->priv->is_primary;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_is_primary:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @is_primary: %TRUE if this is the primary postal address, %FALSE otherwise
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:is-primary property to @is_primary.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.4.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_is_primary (GDataGDPostalAddress *self, gboolean is_primary)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
Packit 4b6dd7
	self->priv->is_primary = is_primary;
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "is-primary");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_mail_class:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:mail-class property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' mail class, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_mail_class (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->mail_class;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_mail_class:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @mail_class: (allow-none): the new mail class for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:mail-class property to @mail_class.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @mail_class to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_mail_class (GDataGDPostalAddress *self, const gchar *mail_class)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (mail_class == NULL || *mail_class != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->mail_class);
Packit 4b6dd7
	self->priv->mail_class = g_strdup (mail_class);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "mail-class");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_usage:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:usage property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' usage, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_usage (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->usage;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_usage:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @usage: (allow-none): the new usage for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:usage property to @usage.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @usage to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_usage (GDataGDPostalAddress *self, const gchar *usage)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (usage == NULL || *usage != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->usage);
Packit 4b6dd7
	self->priv->usage = g_strdup (usage);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "usage");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_agent:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:agent property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' agent, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_agent (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->agent;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_agent:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @agent: (allow-none): the new agent for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:agent property to @agent.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @agent to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_agent (GDataGDPostalAddress *self, const gchar *agent)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (agent == NULL || *agent != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->agent);
Packit 4b6dd7
	self->priv->agent = g_strdup (agent);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "agent");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_house_name:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:house-name property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' house name, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_house_name (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->house_name;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_house_name:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @house_name: (allow-none): the new house name for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:house-name property to @house_name.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @house_name to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_house_name (GDataGDPostalAddress *self, const gchar *house_name)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (house_name == NULL || *house_name != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->house_name);
Packit 4b6dd7
	self->priv->house_name = g_strdup (house_name);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "house-name");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_street:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:street property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' street, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_street (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->street;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_street:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @street: (allow-none): the new street for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:street property to @street.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @street to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_street (GDataGDPostalAddress *self, const gchar *street)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (street == NULL || *street != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->street);
Packit 4b6dd7
	self->priv->street = g_strdup (street);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "street");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_po_box:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:po-box property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' P.O. box, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_po_box (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->po_box;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_po_box:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @po_box: (allow-none): the new P.O. box for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:po-box property to @po_box.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @po_box to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_po_box (GDataGDPostalAddress *self, const gchar *po_box)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (po_box == NULL || *po_box != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->po_box);
Packit 4b6dd7
	self->priv->po_box = g_strdup (po_box);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "po-box");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_neighborhood:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:neighborhood property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' neighborhood, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_neighborhood (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->neighborhood;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_neighborhood:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @neighborhood: (allow-none): the new neighborhood for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:neighborhood property to @neighborhood.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @neighborhood to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_neighborhood (GDataGDPostalAddress *self, const gchar *neighborhood)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (neighborhood == NULL || *neighborhood != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->neighborhood);
Packit 4b6dd7
	self->priv->neighborhood = g_strdup (neighborhood);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "neighborhood");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_city:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:city property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' city, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_city (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->city;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_city:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @city: (allow-none): the new city for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:city property to @city.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @city to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_city (GDataGDPostalAddress *self, const gchar *city)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (city == NULL || *city != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->city);
Packit 4b6dd7
	self->priv->city = g_strdup (city);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "city");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_subregion:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:subregion property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' subregion, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_subregion (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->subregion;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_subregion:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @subregion: (allow-none): the new subregion for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:subregion property to @subregion.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @subregion to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_subregion (GDataGDPostalAddress *self, const gchar *subregion)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (subregion == NULL || *subregion != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->subregion);
Packit 4b6dd7
	self->priv->subregion = g_strdup (subregion);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "subregion");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_region:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:region property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' region, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_region (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->region;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_region:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @region: (allow-none): the new region for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:region property to @region.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @region to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_region (GDataGDPostalAddress *self, const gchar *region)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (region == NULL || *region != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->region);
Packit 4b6dd7
	self->priv->region = g_strdup (region);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "region");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_postcode:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:postcode property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' postcode, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_postcode (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->postcode;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_postcode:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @postcode: (allow-none): the new postcode for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:postcode property to @postcode.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @postcode to %NULL to unset the property in the postal address.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_postcode (GDataGDPostalAddress *self, const gchar *postcode)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (postcode == NULL || *postcode != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->postcode);
Packit 4b6dd7
	self->priv->postcode = g_strdup (postcode);
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "postcode");
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_country:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:country property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' country, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_country (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->country;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_get_country_code:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 *
Packit 4b6dd7
 * Gets the #GDataGDPostalAddress:country-code property.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Return value: the postal address' ISO 3166-1 alpha-2 country code, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
const gchar *
Packit 4b6dd7
gdata_gd_postal_address_get_country_code (GDataGDPostalAddress *self)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_val_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self), NULL);
Packit 4b6dd7
	return self->priv->country_code;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * gdata_gd_postal_address_set_country:
Packit 4b6dd7
 * @self: a #GDataGDPostalAddress
Packit 4b6dd7
 * @country: (allow-none): the new country for the postal address, or %NULL
Packit 4b6dd7
 * @country_code: (allow-none): the new country code for the postal address, or %NULL
Packit 4b6dd7
 *
Packit 4b6dd7
 * Sets the #GDataGDPostalAddress:country property to @country, and #GDataGDPostalAddress:country-code to @country_code.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Set @country or @country_code to %NULL to unset the relevant property in the postal address. If a @country_code is provided, a @country must
Packit 4b6dd7
 * also be provided.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.5.0
Packit 4b6dd7
 */
Packit 4b6dd7
void
Packit 4b6dd7
gdata_gd_postal_address_set_country (GDataGDPostalAddress *self, const gchar *country, const gchar *country_code)
Packit 4b6dd7
{
Packit 4b6dd7
	g_return_if_fail (GDATA_IS_GD_POSTAL_ADDRESS (self));
Packit 4b6dd7
	g_return_if_fail (country != NULL || country_code == NULL);
Packit 4b6dd7
	g_return_if_fail (country == NULL || *country != '\0');
Packit 4b6dd7
	g_return_if_fail (country_code == NULL || *country_code != '\0');
Packit 4b6dd7
Packit 4b6dd7
	g_free (self->priv->country);
Packit 4b6dd7
	g_free (self->priv->country_code);
Packit 4b6dd7
	self->priv->country = g_strdup (country);
Packit 4b6dd7
	self->priv->country_code = g_strdup (country_code);
Packit 4b6dd7
Packit 4b6dd7
	g_object_freeze_notify (G_OBJECT (self));
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "country");
Packit 4b6dd7
	g_object_notify (G_OBJECT (self), "country-code");
Packit 4b6dd7
	g_object_thaw_notify (G_OBJECT (self));
Packit 4b6dd7
}