[libgdata] [contacts] Add support for more gContact namespace elements
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] [contacts] Add support for more gContact namespace elements
- Date: Tue, 6 Apr 2010 15:32:50 +0000 (UTC)
commit e82c804128fa775d26dad7a39acd09c1b0603b6a
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue Apr 6 15:51:10 2010 +0100
[contacts] Add support for more gContact namespace elements
The following elements are now supported:
* billingInformation
* directoryServer
* gender
* initials
* maidenName
* mileage
* occupation
* priority
* sensitivity
* shortName
* subject
Helps: bgo#613551
docs/reference/gdata-sections.txt | 31 +
gdata/gdata.symbols | 22 +
gdata/services/contacts/gdata-contacts-contact.c | 771 +++++++++++++++++++++-
gdata/services/contacts/gdata-contacts-contact.h | 114 ++++
gdata/tests/contacts.c | 152 +++++-
5 files changed, 1086 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index daedd01..42b64bd 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -312,15 +312,46 @@ GDataContactsQueryPrivate
<SECTION>
<FILE>gdata-contacts-contact</FILE>
<TITLE>GDataContactsContact</TITLE>
+GDATA_CONTACTS_GENDER_MALE
+GDATA_CONTACTS_GENDER_FEMALE
+GDATA_CONTACTS_PRIORITY_LOW
+GDATA_CONTACTS_PRIORITY_NORMAL
+GDATA_CONTACTS_PRIORITY_HIGH
+GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL
+GDATA_CONTACTS_SENSITIVITY_NORMAL
+GDATA_CONTACTS_SENSITIVITY_PERSONAL
+GDATA_CONTACTS_SENSITIVITY_PRIVATE
GDataContactsContact
GDataContactsContactClass
gdata_contacts_contact_new
gdata_contacts_contact_get_name
gdata_contacts_contact_set_name
+gdata_contacts_contact_get_short_name
+gdata_contacts_contact_set_short_name
+gdata_contacts_contact_get_initials
+gdata_contacts_contact_set_initials
+gdata_contacts_contact_get_maiden_name
+gdata_contacts_contact_set_maiden_name
gdata_contacts_contact_get_nickname
gdata_contacts_contact_set_nickname
gdata_contacts_contact_get_birthday
gdata_contacts_contact_set_birthday
+gdata_contacts_contact_get_gender
+gdata_contacts_contact_set_gender
+gdata_contacts_contact_get_mileage
+gdata_contacts_contact_set_mileage
+gdata_contacts_contact_get_occupation
+gdata_contacts_contact_set_occupation
+gdata_contacts_contact_get_subject
+gdata_contacts_contact_set_subject
+gdata_contacts_contact_get_priority
+gdata_contacts_contact_set_priority
+gdata_contacts_contact_get_sensitivity
+gdata_contacts_contact_set_sensitivity
+gdata_contacts_contact_get_directory_server
+gdata_contacts_contact_set_directory_server
+gdata_contacts_contact_get_billing_information
+gdata_contacts_contact_set_billing_information
gdata_contacts_contact_get_email_addresses
gdata_contacts_contact_get_primary_email_address
gdata_contacts_contact_add_email_address
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 0ecc4ef..caee9da 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -780,3 +780,25 @@ gdata_contacts_contact_add_calendar
gdata_contacts_contact_get_calendars
gdata_contacts_contact_get_primary_calendar
gdata_contacts_contact_remove_all_calendars
+gdata_contacts_contact_get_directory_server
+gdata_contacts_contact_set_directory_server
+gdata_contacts_contact_get_gender
+gdata_contacts_contact_set_gender
+gdata_contacts_contact_get_initials
+gdata_contacts_contact_set_initials
+gdata_contacts_contact_get_maiden_name
+gdata_contacts_contact_set_maiden_name
+gdata_contacts_contact_get_mileage
+gdata_contacts_contact_set_mileage
+gdata_contacts_contact_get_occupation
+gdata_contacts_contact_set_occupation
+gdata_contacts_contact_get_priority
+gdata_contacts_contact_set_priority
+gdata_contacts_contact_get_sensitivity
+gdata_contacts_contact_set_sensitivity
+gdata_contacts_contact_get_short_name
+gdata_contacts_contact_set_short_name
+gdata_contacts_contact_get_subject
+gdata_contacts_contact_set_subject
+gdata_contacts_contact_get_billing_information
+gdata_contacts_contact_set_billing_information
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 8f083b3..81837f4 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -77,6 +77,17 @@ struct _GDataContactsContactPrivate {
GList *websites; /* GDataGContactWebsite */
GList *events; /* GDataGContactEvent */
GList *calendars; /* GDataGContactCalendar */
+ gchar *billing_information;
+ gchar *directory_server;
+ gchar *gender;
+ gchar *initials;
+ gchar *maiden_name;
+ gchar *mileage;
+ gchar *occupation;
+ gchar *priority;
+ gchar *sensitivity;
+ gchar *short_name;
+ gchar *subject;
};
enum {
@@ -86,7 +97,18 @@ enum {
PROP_NAME,
PROP_NICKNAME,
PROP_BIRTHDAY,
- PROP_BIRTHDAY_HAS_YEAR
+ PROP_BIRTHDAY_HAS_YEAR,
+ PROP_BILLING_INFORMATION,
+ PROP_DIRECTORY_SERVER,
+ PROP_GENDER,
+ PROP_INITIALS,
+ PROP_MAIDEN_NAME,
+ PROP_MILEAGE,
+ PROP_OCCUPATION,
+ PROP_PRIORITY,
+ PROP_SENSITIVITY,
+ PROP_SHORT_NAME,
+ PROP_SUBJECT
};
G_DEFINE_TYPE (GDataContactsContact, gdata_contacts_contact, GDATA_TYPE_ENTRY)
@@ -204,6 +226,150 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass)
"Birthday has year?", "Whether the contact's birthday includes the year of their birth.",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:billing-information:
+ *
+ * Billing information for the contact, such as their billing name and address.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_BILLING_INFORMATION,
+ g_param_spec_string ("billing-information",
+ "Billing information", "Billing information for the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:directory-server:
+ *
+ * The name or address of a directory server associated with the contact.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_DIRECTORY_SERVER,
+ g_param_spec_string ("directory-server",
+ "Directory server", "The name or address of a directory server associated with the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:gender:
+ *
+ * The gender of the contact. For example: %GDATA_CONTACTS_GENDER_MALE or %GDATA_CONTACTS_GENDER_FEMALE.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_GENDER,
+ g_param_spec_string ("gender",
+ "Gender", "The gender of the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:initials:
+ *
+ * The initials of the contact.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_INITIALS,
+ g_param_spec_string ("initials",
+ "Initials", "The initials of the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:maiden-name:
+ *
+ * The maiden name of the contact.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_MAIDEN_NAME,
+ g_param_spec_string ("maiden-name",
+ "Maiden name", "The maiden name of the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:mileage:
+ *
+ * A mileage associated with the contact, such as one for reimbursement purposes. It can be in any format.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_MILEAGE,
+ g_param_spec_string ("mileage",
+ "Mileage", "A mileage associated with the contact, such as one for reimbursement purposes.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:occupation:
+ *
+ * The contact's occupation.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_OCCUPATION,
+ g_param_spec_string ("occupation",
+ "Occupation", "The contact's occupation.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:priority:
+ *
+ * The contact's importance. For example: %GDATA_CONTACTS_PRIORITY_NORMAL or %GDATA_CONTACTS_PRIORITY_HIGH.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_PRIORITY,
+ g_param_spec_string ("priority",
+ "Priority", "The contact's importance.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:sensitivity:
+ *
+ * The sensitivity of the contact's data. For example: %GDATA_CONTACTS_SENSITIVITY_NORMAL or %GDATA_CONTACTS_SENSITIVITY_PRIVATE.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_SENSITIVITY,
+ g_param_spec_string ("sensitivity",
+ "Sensitivity", "The sensitivity of the contact's data.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:short-name:
+ *
+ * A short name for the contact. This should be used for contracted versions of the contact's actual name,
+ * whereas #GDataContactsContact:nickname should be used for nicknames.
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_SHORT_NAME,
+ g_param_spec_string ("short-name",
+ "Short name", "A short name for the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GDataContactsContact:subject:
+ *
+ * The subject of the contact. (i.e. The contact's relevance to the address book.)
+ *
+ * Since: 0.7.0
+ **/
+ g_object_class_install_property (gobject_class, PROP_SUBJECT,
+ g_param_spec_string ("subject",
+ "Subject", "The subject of the contact.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void notify_full_name_cb (GObject *gobject, GParamSpec *pspec, GDataContactsContact *self);
@@ -284,6 +450,17 @@ gdata_contacts_contact_finalize (GObject *object)
g_hash_table_destroy (priv->groups);
g_free (priv->photo_etag);
g_free (priv->nickname);
+ g_free (priv->billing_information);
+ g_free (priv->directory_server);
+ g_free (priv->gender);
+ g_free (priv->initials);
+ g_free (priv->maiden_name);
+ g_free (priv->mileage);
+ g_free (priv->occupation);
+ g_free (priv->priority);
+ g_free (priv->sensitivity);
+ g_free (priv->short_name);
+ g_free (priv->subject);
/* Chain up to the parent class */
G_OBJECT_CLASS (gdata_contacts_contact_parent_class)->finalize (object);
@@ -316,6 +493,39 @@ gdata_contacts_contact_get_property (GObject *object, guint property_id, GValue
case PROP_BIRTHDAY_HAS_YEAR:
g_value_set_boolean (value, priv->birthday_has_year);
break;
+ case PROP_BILLING_INFORMATION:
+ g_value_set_string (value, priv->billing_information);
+ break;
+ case PROP_DIRECTORY_SERVER:
+ g_value_set_string (value, priv->directory_server);
+ break;
+ case PROP_GENDER:
+ g_value_set_string (value, priv->gender);
+ break;
+ case PROP_INITIALS:
+ g_value_set_string (value, priv->initials);
+ break;
+ case PROP_MAIDEN_NAME:
+ g_value_set_string (value, priv->maiden_name);
+ break;
+ case PROP_MILEAGE:
+ g_value_set_string (value, priv->mileage);
+ break;
+ case PROP_OCCUPATION:
+ g_value_set_string (value, priv->occupation);
+ break;
+ case PROP_PRIORITY:
+ g_value_set_string (value, priv->priority);
+ break;
+ case PROP_SENSITIVITY:
+ g_value_set_string (value, priv->sensitivity);
+ break;
+ case PROP_SHORT_NAME:
+ g_value_set_string (value, priv->short_name);
+ break;
+ case PROP_SUBJECT:
+ g_value_set_string (value, priv->subject);
+ break;
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -341,6 +551,39 @@ gdata_contacts_contact_set_property (GObject *object, guint property_id, const G
case PROP_BIRTHDAY_HAS_YEAR:
gdata_contacts_contact_set_birthday (self, &(self->priv->birthday), g_value_get_boolean (value));
break;
+ case PROP_BILLING_INFORMATION:
+ gdata_contacts_contact_set_billing_information (self, g_value_get_string (value));
+ break;
+ case PROP_DIRECTORY_SERVER:
+ gdata_contacts_contact_set_directory_server (self, g_value_get_string (value));
+ break;
+ case PROP_GENDER:
+ gdata_contacts_contact_set_gender (self, g_value_get_string (value));
+ break;
+ case PROP_INITIALS:
+ gdata_contacts_contact_set_initials (self, g_value_get_string (value));
+ break;
+ case PROP_MAIDEN_NAME:
+ gdata_contacts_contact_set_maiden_name (self, g_value_get_string (value));
+ break;
+ case PROP_MILEAGE:
+ gdata_contacts_contact_set_mileage (self, g_value_get_string (value));
+ break;
+ case PROP_OCCUPATION:
+ gdata_contacts_contact_set_occupation (self, g_value_get_string (value));
+ break;
+ case PROP_PRIORITY:
+ gdata_contacts_contact_set_priority (self, g_value_get_string (value));
+ break;
+ case PROP_SENSITIVITY:
+ gdata_contacts_contact_set_sensitivity (self, g_value_get_string (value));
+ break;
+ case PROP_SHORT_NAME:
+ gdata_contacts_contact_set_short_name (self, g_value_get_string (value));
+ break;
+ case PROP_SUBJECT:
+ gdata_contacts_contact_set_subject (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);
@@ -414,8 +657,63 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
gdata_contacts_contact_add_website, self, &success, error) == TRUE ||
gdata_parser_object_from_element_setter (node, "calendarLink", P_REQUIRED, GDATA_TYPE_GCONTACT_CALENDAR,
gdata_contacts_contact_add_calendar, self, &success, error) == TRUE ||
- gdata_parser_string_from_element (node, "nickname", P_REQUIRED | P_NO_DUPES, &(self->priv->nickname), &success, error) == TRUE) {
+ gdata_parser_string_from_element (node, "nickname", P_REQUIRED | P_NO_DUPES, &(self->priv->nickname), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "billingInformation", P_REQUIRED | P_NO_DUPES | P_NON_EMPTY,
+ &(self->priv->billing_information), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "directoryServer", P_REQUIRED | P_NO_DUPES | P_NON_EMPTY,
+ &(self->priv->directory_server), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "initials", P_REQUIRED | P_NO_DUPES, &(self->priv->initials), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "maidenName", P_REQUIRED | P_NO_DUPES,
+ &(self->priv->maiden_name), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "mileage", P_REQUIRED | P_NO_DUPES, &(self->priv->mileage), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "occupation", P_REQUIRED | P_NO_DUPES,
+ &(self->priv->occupation), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "shortName", P_REQUIRED | P_NO_DUPES,
+ &(self->priv->short_name), &success, error) == TRUE ||
+ gdata_parser_string_from_element (node, "subject", P_REQUIRED | P_NO_DUPES, &(self->priv->subject), &success, error) == TRUE) {
return success;
+ } else if (xmlStrcmp (node->name, (xmlChar*) "gender") == 0) {
+ /* gContact:gender */
+ xmlChar *value;
+
+ if (self->priv->gender != NULL)
+ return gdata_parser_error_duplicate_element (node, error);
+
+ value = xmlGetProp (node, (xmlChar*) "value");
+ if (value == NULL || *value == '\0') {
+ xmlFree (value);
+ return gdata_parser_error_required_content_missing (node, error);
+ }
+
+ self->priv->gender = (gchar*) value;
+ } else if (xmlStrcmp (node->name, (xmlChar*) "priority") == 0) {
+ /* gContact:priority */
+ xmlChar *rel;
+
+ if (self->priv->priority != NULL)
+ return gdata_parser_error_duplicate_element (node, error);
+
+ rel = xmlGetProp (node, (xmlChar*) "rel");
+ if (rel == NULL || *rel == '\0') {
+ xmlFree (rel);
+ return gdata_parser_error_required_content_missing (node, error);
+ }
+
+ self->priv->priority = (gchar*) rel;
+ } else if (xmlStrcmp (node->name, (xmlChar*) "sensitivity") == 0) {
+ /* gContact:sensitivity */
+ xmlChar *rel;
+
+ if (self->priv->sensitivity != NULL)
+ return gdata_parser_error_duplicate_element (node, error);
+
+ rel = xmlGetProp (node, (xmlChar*) "rel");
+ if (rel == NULL || *rel == '\0') {
+ xmlFree (rel);
+ return gdata_parser_error_required_content_missing (node, error);
+ }
+
+ self->priv->sensitivity = (gchar*) rel;
} else if (xmlStrcmp (node->name, (xmlChar*) "groupMembershipInfo") == 0) {
/* gContact:groupMembershipInfo */
xmlChar *href;
@@ -547,6 +845,52 @@ get_xml (GDataParsable *parsable, GString *xml_string)
}
}
+ /* gContact:billingInformation */
+ if (priv->billing_information != NULL) {
+ gdata_parser_string_append_escaped (xml_string,
+ "<gContact:billingInformation>", priv->billing_information, "</gContact:billingInformation>");
+ }
+
+ /* gContact:directoryServer */
+ if (priv->directory_server != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:directoryServer>", priv->directory_server, "</gContact:directoryServer>");
+
+ /* gContact:gender */
+ if (priv->gender != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:gender value='", priv->gender, "'/>");
+
+ /* gContact:initials */
+ if (priv->initials != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:initials>", priv->initials, "</gContact:initials>");
+
+ /* gContact:maidenName */
+ if (priv->maiden_name != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:maidenName>", priv->maiden_name, "</gContact:maidenName>");
+
+ /* gContact:mileage */
+ if (priv->mileage != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:mileage>", priv->mileage, "</gContact:mileage>");
+
+ /* gContact:occupation */
+ if (priv->occupation != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:occupation>", priv->occupation, "</gContact:occupation>");
+
+ /* gContact:priority */
+ if (priv->priority != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:priority rel='", priv->priority, "'/>");
+
+ /* gContact:sensitivity */
+ if (priv->sensitivity != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:sensitivity rel='", priv->sensitivity, "'/>");
+
+ /* gContact:shortName */
+ if (priv->short_name != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:shortName>", priv->short_name, "</gContact:shortName>");
+
+ /* gContact:subject */
+ if (priv->subject != NULL)
+ gdata_parser_string_append_escaped (xml_string, "<gContact:subject>", priv->subject, "</gContact:subject>");
+
/* TODO:
* - Finish supporting all tags
* - Check things are escaped (or not) as appropriate
@@ -757,6 +1101,429 @@ gdata_contacts_contact_set_birthday (GDataContactsContact *self, GDate *birthday
}
/**
+ * gdata_contacts_contact_get_billing_information:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:billing-information property.
+ *
+ * Return value: the contact's billing information, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_billing_information (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->billing_information;
+}
+
+/**
+ * gdata_contacts_contact_set_billing_information:
+ * @self: a #GDataContactsContact
+ * @billing_information: the new billing information for the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:billing-information property to @billing_information.
+ *
+ * If @billing_information is %NULL, the contact's billing information will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_billing_information (GDataContactsContact *self, const gchar *billing_information)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+ g_return_if_fail (billing_information == NULL || *billing_information != '\0');
+
+ g_free (self->priv->billing_information);
+ self->priv->billing_information = g_strdup (billing_information);
+ g_object_notify (G_OBJECT (self), "billing-information");
+}
+
+/**
+ * gdata_contacts_contact_get_directory_server:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:directory-server property.
+ *
+ * Return value: the name or address of a directory server associated with the contact, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_directory_server (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->directory_server;
+}
+
+/**
+ * gdata_contacts_contact_set_directory_server:
+ * @self: a #GDataContactsContact
+ * @directory_server: the new name or address of a directory server associated with the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:directory-server property to @directory_server.
+ *
+ * If @directory_server is %NULL, the contact's directory server will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_directory_server (GDataContactsContact *self, const gchar *directory_server)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+ g_return_if_fail (directory_server == NULL || *directory_server != '\0');
+
+ g_free (self->priv->directory_server);
+ self->priv->directory_server = g_strdup (directory_server);
+ g_object_notify (G_OBJECT (self), "directory-server");
+}
+
+/**
+ * gdata_contacts_contact_get_gender:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:gender property.
+ *
+ * Return value: the gender of the contact, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_gender (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->gender;
+}
+
+/**
+ * gdata_contacts_contact_set_gender:
+ * @self: a #GDataContactsContact
+ * @gender: the new gender of the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:gender property to @gender.
+ *
+ * If @gender is %NULL, the contact's gender will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_gender (GDataContactsContact *self, const gchar *gender)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+ g_return_if_fail (gender == NULL || *gender != '\0');
+
+ g_free (self->priv->gender);
+ self->priv->gender = g_strdup (gender);
+ g_object_notify (G_OBJECT (self), "gender");
+}
+
+/**
+ * gdata_contacts_contact_get_initials:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:initials property.
+ *
+ * Return value: the initials of the contact, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_initials (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->initials;
+}
+
+/**
+ * gdata_contacts_contact_set_initials:
+ * @self: a #GDataContactsContact
+ * @initials: the new initials of the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:initials property to @initials.
+ *
+ * If @initials is %NULL, the contact's initials will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_initials (GDataContactsContact *self, const gchar *initials)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->initials);
+ self->priv->initials = g_strdup (initials);
+ g_object_notify (G_OBJECT (self), "initials");
+}
+
+/**
+ * gdata_contacts_contact_get_maiden_name:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:maiden-name property.
+ *
+ * Return value: the maiden name of the contact, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_maiden_name (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->maiden_name;
+}
+
+/**
+ * gdata_contacts_contact_set_maiden_name:
+ * @self: a #GDataContactsContact
+ * @maiden_name: the new maiden name of the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:maiden-name property to @maiden_name.
+ *
+ * If @maiden_name is %NULL, the contact's maiden name will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_maiden_name (GDataContactsContact *self, const gchar *maiden_name)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->maiden_name);
+ self->priv->maiden_name = g_strdup (maiden_name);
+ g_object_notify (G_OBJECT (self), "maiden-name");
+}
+
+/**
+ * gdata_contacts_contact_get_mileage:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:mileage property.
+ *
+ * Return value: a mileage associated with the contact, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_mileage (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->mileage;
+}
+
+/**
+ * gdata_contacts_contact_set_mileage:
+ * @self: a #GDataContactsContact
+ * @mileage: the new mileage associated with the contact, or %NULL
+ *
+ * Sets the #GDataContactsContact:mileage property to @mileage.
+ *
+ * If @mileage is %NULL, the contact's mileage will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_mileage (GDataContactsContact *self, const gchar *mileage)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->mileage);
+ self->priv->mileage = g_strdup (mileage);
+ g_object_notify (G_OBJECT (self), "mileage");
+}
+
+/**
+ * gdata_contacts_contact_get_occupation:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:occupation property.
+ *
+ * Return value: the contact's occupation, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_occupation (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->occupation;
+}
+
+/**
+ * gdata_contacts_contact_set_occupation:
+ * @self: a #GDataContactsContact
+ * @occupation: the contact's new occupation, or %NULL
+ *
+ * Sets the #GDataContactsContact:occupation property to @occupation.
+ *
+ * If @occupation is %NULL, the contact's occupation will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_occupation (GDataContactsContact *self, const gchar *occupation)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->occupation);
+ self->priv->occupation = g_strdup (occupation);
+ g_object_notify (G_OBJECT (self), "occupation");
+}
+
+/**
+ * gdata_contacts_contact_get_priority:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:priority property.
+ *
+ * Return value: the contact's priority, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_priority (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->priority;
+}
+
+/**
+ * gdata_contacts_contact_set_priority:
+ * @self: a #GDataContactsContact
+ * @priority: the contact's new priority, or %NULL
+ *
+ * Sets the #GDataContactsContact:priority property to @priority.
+ *
+ * If @priority is %NULL, the contact's priority will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_priority (GDataContactsContact *self, const gchar *priority)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+ g_return_if_fail (priority == NULL || *priority != '\0');
+
+ g_free (self->priv->priority);
+ self->priv->priority = g_strdup (priority);
+ g_object_notify (G_OBJECT (self), "priority");
+}
+
+/**
+ * gdata_contacts_contact_get_sensitivity:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:sensitivity property.
+ *
+ * Return value: the contact's sensitivity, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_sensitivity (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->sensitivity;
+}
+
+/**
+ * gdata_contacts_contact_set_sensitivity:
+ * @self: a #GDataContactsContact
+ * @sensitivity: the contact's new sensitivity, or %NULL
+ *
+ * Sets the #GDataContactsContact:sensitivity property to @sensitivity.
+ *
+ * If @sensitivity is %NULL, the contact's sensitivity will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_sensitivity (GDataContactsContact *self, const gchar *sensitivity)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+ g_return_if_fail (sensitivity == NULL || *sensitivity != '\0');
+
+ g_free (self->priv->sensitivity);
+ self->priv->sensitivity = g_strdup (sensitivity);
+ g_object_notify (G_OBJECT (self), "sensitivity");
+}
+
+/**
+ * gdata_contacts_contact_get_short_name:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:short-name property.
+ *
+ * Return value: the contact's short name, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_short_name (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->short_name;
+}
+
+/**
+ * gdata_contacts_contact_set_short_name:
+ * @self: a #GDataContactsContact
+ * @short_name: the contact's new short name, or %NULL
+ *
+ * Sets the #GDataContactsContact:short-name property to @short_name.
+ *
+ * If @short_name is %NULL, the contact's short name will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_short_name (GDataContactsContact *self, const gchar *short_name)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->short_name);
+ self->priv->short_name = g_strdup (short_name);
+ g_object_notify (G_OBJECT (self), "short-name");
+}
+
+/**
+ * gdata_contacts_contact_get_subject:
+ * @self: a #GDataContactsContact
+ *
+ * Gets the #GDataContactsContact:subject property.
+ *
+ * Return value: the contact's subject, or %NULL
+ *
+ * Since: 0.7.0
+ **/
+const gchar *
+gdata_contacts_contact_get_subject (GDataContactsContact *self)
+{
+ g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), NULL);
+ return self->priv->subject;
+}
+
+/**
+ * gdata_contacts_contact_set_subject:
+ * @self: a #GDataContactsContact
+ * @subject: the contact's new subject, or %NULL
+ *
+ * Sets the #GDataContactsContact:subject property to @subject.
+ *
+ * If @subject is %NULL, the contact's subject will be removed.
+ *
+ * Since: 0.7.0
+ **/
+void
+gdata_contacts_contact_set_subject (GDataContactsContact *self, const gchar *subject)
+{
+ g_return_if_fail (GDATA_IS_CONTACTS_CONTACT (self));
+
+ g_free (self->priv->subject);
+ self->priv->subject = g_strdup (subject);
+ g_object_notify (G_OBJECT (self), "subject");
+}
+
+/**
* gdata_contacts_contact_add_email_address:
* @self: a #GDataContactsContact
* @email_address: a #GDataGDEmailAddress to add
diff --git a/gdata/services/contacts/gdata-contacts-contact.h b/gdata/services/contacts/gdata-contacts-contact.h
index e0f362b..66bdc73 100644
--- a/gdata/services/contacts/gdata-contacts-contact.h
+++ b/gdata/services/contacts/gdata-contacts-contact.h
@@ -38,6 +38,87 @@
G_BEGIN_DECLS
+/**
+ * GDATA_CONTACTS_GENDER_MALE:
+ *
+ * The contact is male.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_GENDER_MALE "male"
+
+/**
+ * GDATA_CONTACTS_GENDER_FEMALE:
+ *
+ * The contact is female.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_GENDER_FEMALE "female"
+
+/**
+ * GDATA_CONTACTS_PRIORITY_LOW:
+ *
+ * The contact is of low importance.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_PRIORITY_LOW "low"
+
+/**
+ * GDATA_CONTACTS_PRIORITY_NORMAL:
+ *
+ * The contact is of normal importance.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_PRIORITY_NORMAL "normal"
+
+/**
+ * GDATA_CONTACTS_PRIORITY_HIGH:
+ *
+ * The contact is of high importance.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_PRIORITY_HIGH "high"
+
+/**
+ * GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL:
+ *
+ * The contact's data is confidential.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL "confidential"
+
+/**
+ * GDATA_CONTACTS_SENSITIVITY_NORMAL:
+ *
+ * The contact's data is of normal sensitivity.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_SENSITIVITY_NORMAL "normal"
+
+/**
+ * GDATA_CONTACTS_SENSITIVITY_PERSONAL:
+ *
+ * The contact's data is personal.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_SENSITIVITY_PERSONAL "personal"
+
+/**
+ * GDATA_CONTACTS_SENSITIVITY_PRIVATE:
+ *
+ * The contact's data is private.
+ *
+ * Since: 0.7.0
+ **/
+#define GDATA_CONTACTS_SENSITIVITY_PRIVATE "private"
+
#define GDATA_TYPE_CONTACTS_CONTACT (gdata_contacts_contact_get_type ())
#define GDATA_CONTACTS_CONTACT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_CONTACTS_CONTACT, GDataContactsContact))
#define GDATA_CONTACTS_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_CONTACTS_CONTACT, GDataContactsContactClass))
@@ -87,6 +168,39 @@ void gdata_contacts_contact_set_nickname (GDataContactsContact *self, const gcha
gboolean gdata_contacts_contact_get_birthday (GDataContactsContact *self, GDate *birthday);
void gdata_contacts_contact_set_birthday (GDataContactsContact *self, GDate *birthday, gboolean birthday_has_year);
+const gchar *gdata_contacts_contact_get_billing_information (GDataContactsContact *self);
+void gdata_contacts_contact_set_billing_information (GDataContactsContact *self, const gchar *billing_information);
+
+const gchar *gdata_contacts_contact_get_directory_server (GDataContactsContact *self);
+void gdata_contacts_contact_set_directory_server (GDataContactsContact *self, const gchar *directory_server);
+
+const gchar *gdata_contacts_contact_get_gender (GDataContactsContact *self);
+void gdata_contacts_contact_set_gender (GDataContactsContact *self, const gchar *gender);
+
+const gchar *gdata_contacts_contact_get_initials (GDataContactsContact *self);
+void gdata_contacts_contact_set_initials (GDataContactsContact *self, const gchar *initials);
+
+const gchar *gdata_contacts_contact_get_maiden_name (GDataContactsContact *self);
+void gdata_contacts_contact_set_maiden_name (GDataContactsContact *self, const gchar *maiden_name);
+
+const gchar *gdata_contacts_contact_get_mileage (GDataContactsContact *self);
+void gdata_contacts_contact_set_mileage (GDataContactsContact *self, const gchar *mileage);
+
+const gchar *gdata_contacts_contact_get_occupation (GDataContactsContact *self);
+void gdata_contacts_contact_set_occupation (GDataContactsContact *self, const gchar *occupation);
+
+const gchar *gdata_contacts_contact_get_priority (GDataContactsContact *self);
+void gdata_contacts_contact_set_priority (GDataContactsContact *self, const gchar *priority);
+
+const gchar *gdata_contacts_contact_get_sensitivity (GDataContactsContact *self);
+void gdata_contacts_contact_set_sensitivity (GDataContactsContact *self, const gchar *sensitivity);
+
+const gchar *gdata_contacts_contact_get_short_name (GDataContactsContact *self);
+void gdata_contacts_contact_set_short_name (GDataContactsContact *self, const gchar *short_name);
+
+const gchar *gdata_contacts_contact_get_subject (GDataContactsContact *self);
+void gdata_contacts_contact_set_subject (GDataContactsContact *self, const gchar *subject);
+
void gdata_contacts_contact_add_email_address (GDataContactsContact *self, GDataGDEmailAddress *email_address);
GList *gdata_contacts_contact_get_email_addresses (GDataContactsContact *self);
GDataGDEmailAddress *gdata_contacts_contact_get_primary_email_address (GDataContactsContact *self);
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index 6b14bbf..4c18fba 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -160,7 +160,8 @@ test_insert_simple (gconstpointer service)
GDataGContactWebsite *website;
GDataGContactEvent *event;
GDataGContactCalendar *calendar;
- gchar *xml, *nickname;
+ gchar *xml, *nickname, *billing_information, *directory_server, *gender, *initials, *maiden_name, *mileage, *occupation;
+ gchar *priority, *sensitivity, *short_name, *subject;
GList *list;
GDate date, *date2;
GHashTable *properties;
@@ -192,6 +193,17 @@ test_insert_simple (gconstpointer service)
g_date_set_dmy (&date, 1, 1, 1900);
gdata_contacts_contact_set_birthday (contact, &date, FALSE);
gdata_entry_set_content (GDATA_ENTRY (contact), "Notes");
+ gdata_contacts_contact_set_billing_information (contact, "Big J Enterprises, Ltd.");
+ gdata_contacts_contact_set_directory_server (contact, "This is a server");
+ gdata_contacts_contact_set_gender (contact, GDATA_CONTACTS_GENDER_MALE);
+ gdata_contacts_contact_set_initials (contact, "A. B. C.");
+ gdata_contacts_contact_set_maiden_name (contact, "Smith");
+ gdata_contacts_contact_set_mileage (contact, "12km");
+ gdata_contacts_contact_set_occupation (contact, "Professional bum");
+ gdata_contacts_contact_set_priority (contact, GDATA_CONTACTS_PRIORITY_HIGH);
+ gdata_contacts_contact_set_sensitivity (contact, GDATA_CONTACTS_SENSITIVITY_PERSONAL);
+ gdata_contacts_contact_set_short_name (contact, "Jon");
+ gdata_contacts_contact_set_subject (contact, "Charity work");
email_address1 = gdata_gd_email_address_new ("liz gmail com", GDATA_GD_EMAIL_ADDRESS_WORK, NULL, FALSE);
gdata_contacts_contact_add_email_address (contact, email_address1);
@@ -256,6 +268,17 @@ test_insert_simple (gconstpointer service)
"nickname", &nickname,
"birthday", &date2,
"birthday-has-year", &birthday_has_year,
+ "billing-information", &billing_information,
+ "directory-server", &directory_server,
+ "gender", &gender,
+ "initials", &initials,
+ "maiden-name", &maiden_name,
+ "mileage", &mileage,
+ "occupation", &occupation,
+ "priority", &priority,
+ "sensitivity", &sensitivity,
+ "short-name", &short_name,
+ "subject", &subject,
NULL);
g_assert_cmpint (edited->tv_sec, ==, creation_time.tv_sec);
@@ -268,10 +291,32 @@ test_insert_simple (gconstpointer service)
g_assert_cmpuint (g_date_get_month (date2), ==, 1);
g_assert_cmpuint (g_date_get_day (date2), ==, 1);
g_assert (birthday_has_year == FALSE);
+ g_assert_cmpstr (billing_information, ==, "Big J Enterprises, Ltd.");
+ g_assert_cmpstr (directory_server, ==, "This is a server");
+ g_assert_cmpstr (gender, ==, GDATA_CONTACTS_GENDER_MALE);
+ g_assert_cmpstr (initials, ==, "A. B. C.");
+ g_assert_cmpstr (maiden_name, ==, "Smith");
+ g_assert_cmpstr (mileage, ==, "12km");
+ g_assert_cmpstr (occupation, ==, "Professional bum");
+ g_assert_cmpstr (priority, ==, GDATA_CONTACTS_PRIORITY_HIGH);
+ g_assert_cmpstr (sensitivity, ==, GDATA_CONTACTS_SENSITIVITY_PERSONAL);
+ g_assert_cmpstr (short_name, ==, "Jon");
+ g_assert_cmpstr (subject, ==, "Charity work");
g_object_unref (name2);
g_free (date2);
g_free (nickname);
+ g_free (billing_information);
+ g_free (directory_server);
+ g_free (gender);
+ g_free (initials);
+ g_free (maiden_name);
+ g_free (mileage);
+ g_free (occupation);
+ g_free (priority);
+ g_free (sensitivity);
+ g_free (short_name);
+ g_free (subject);
/* Check the XML */
xml = gdata_parsable_get_xml (GDATA_PARSABLE (contact));
@@ -309,6 +354,17 @@ test_insert_simple (gconstpointer service)
"<gd:extendedProperty name='CALURI'>http://example.com/</gd:extendedProperty>"
"<gContact:nickname>Big J</gContact:nickname>"
"<gContact:birthday when='--01-01'/>"
+ "<gContact:billingInformation>Big J Enterprises, Ltd.</gContact:billingInformation>"
+ "<gContact:directoryServer>This is a server</gContact:directoryServer>"
+ "<gContact:gender value='male'/>"
+ "<gContact:initials>A. B. C.</gContact:initials>"
+ "<gContact:maidenName>Smith</gContact:maidenName>"
+ "<gContact:mileage>12km</gContact:mileage>"
+ "<gContact:occupation>Professional bum</gContact:occupation>"
+ "<gContact:priority rel='high'/>"
+ "<gContact:sensitivity rel='personal'/>"
+ "<gContact:shortName>Jon</gContact:shortName>"
+ "<gContact:subject>Charity work</gContact:subject>"
"</entry>");
g_free (xml);
@@ -323,12 +379,23 @@ test_insert_simple (gconstpointer service)
gdata_contacts_contact_get_edited (new_contact, &creation_time);
g_assert_cmpint (creation_time.tv_sec, >=, edited->tv_sec);
- /* Nickname and birthday */
+ /* Various properties */
g_assert_cmpstr (gdata_contacts_contact_get_nickname (new_contact), ==, "Big J");
g_assert (gdata_contacts_contact_get_birthday (new_contact, &date) == FALSE);
g_assert (g_date_valid (&date) == TRUE);
g_assert_cmpuint (g_date_get_month (&date), ==, 1);
g_assert_cmpuint (g_date_get_day (&date), ==, 1);
+ g_assert_cmpstr (gdata_contacts_contact_get_billing_information (new_contact), ==, "Big J Enterprises, Ltd.");
+ g_assert_cmpstr (gdata_contacts_contact_get_directory_server (new_contact), ==, "This is a server");
+ g_assert_cmpstr (gdata_contacts_contact_get_gender (new_contact), ==, GDATA_CONTACTS_GENDER_MALE);
+ g_assert_cmpstr (gdata_contacts_contact_get_initials (new_contact), ==, "A. B. C.");
+ g_assert_cmpstr (gdata_contacts_contact_get_maiden_name (new_contact), ==, "Smith");
+ g_assert_cmpstr (gdata_contacts_contact_get_mileage (new_contact), ==, "12km");
+ g_assert_cmpstr (gdata_contacts_contact_get_occupation (new_contact), ==, "Professional bum");
+ g_assert_cmpstr (gdata_contacts_contact_get_priority (new_contact), ==, GDATA_CONTACTS_PRIORITY_HIGH);
+ g_assert_cmpstr (gdata_contacts_contact_get_sensitivity (new_contact), ==, GDATA_CONTACTS_SENSITIVITY_PERSONAL);
+ g_assert_cmpstr (gdata_contacts_contact_get_short_name (new_contact), ==, "Jon");
+ g_assert_cmpstr (gdata_contacts_contact_get_subject (new_contact), ==, "Charity work");
/* E-mail addresses */
list = gdata_contacts_contact_get_email_addresses (new_contact);
@@ -601,6 +668,17 @@ test_parser_minimal (gconstpointer service)
g_assert (gdata_contacts_contact_get_nickname (contact) == NULL);
g_assert (gdata_contacts_contact_get_birthday (contact, &birthday) == FALSE);
g_assert (g_date_valid (&birthday) == FALSE);
+ g_assert (gdata_contacts_contact_get_billing_information (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_directory_server (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_gender (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_initials (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_maiden_name (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_mileage (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_occupation (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_priority (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_sensitivity (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_short_name (contact) == NULL);
+ g_assert (gdata_contacts_contact_get_subject (contact) == NULL);
g_assert (gdata_contacts_contact_get_jots (contact) == NULL);
g_assert (gdata_contacts_contact_get_relations (contact) == NULL);
g_assert (gdata_contacts_contact_get_websites (contact) == NULL);
@@ -642,6 +720,17 @@ test_parser_normal (gconstpointer service)
"<gd:deleted/>"
"<gContact:nickname>Agent Smith</gContact:nickname>"
"<gContact:birthday when='2010-12-03'/>"
+ "<gContact:billingInformation>Foo & Bar Inc.</gContact:billingInformation>"
+ "<gContact:directoryServer>Directory & server</gContact:directoryServer>"
+ "<gContact:gender value='female'/>"
+ "<gContact:initials>X. Y. Z.</gContact:initials>"
+ "<gContact:maidenName>Foo</gContact:maidenName>"
+ "<gContact:mileage>15km</gContact:mileage>"
+ "<gContact:occupation>Occupied</gContact:occupation>"
+ "<gContact:priority rel='low'/>"
+ "<gContact:sensitivity rel='confidential'/>"
+ "<gContact:shortName>Smith</gContact:shortName>"
+ "<gContact:subject>Film buddy</gContact:subject>"
"<gContact:jot rel='home'>Moved house on 2010-02-14 to the North Pole.</gContact:jot>"
"<gContact:jot rel='user'>Owes me ten pounds.</gContact:jot>"
"<gContact:jot rel='other'></gContact:jot>" /* Empty on purpose */
@@ -664,6 +753,17 @@ test_parser_normal (gconstpointer service)
/* TODO: Check the other properties */
g_assert_cmpstr (gdata_contacts_contact_get_nickname (contact), ==, "Agent Smith");
+ g_assert_cmpstr (gdata_contacts_contact_get_billing_information (contact), ==, "Foo & Bar Inc.");
+ g_assert_cmpstr (gdata_contacts_contact_get_directory_server (contact), ==, "Directory & server");
+ g_assert_cmpstr (gdata_contacts_contact_get_gender (contact), ==, GDATA_CONTACTS_GENDER_FEMALE);
+ g_assert_cmpstr (gdata_contacts_contact_get_initials (contact), ==, "X. Y. Z.");
+ g_assert_cmpstr (gdata_contacts_contact_get_maiden_name (contact), ==, "Foo");
+ g_assert_cmpstr (gdata_contacts_contact_get_mileage (contact), ==, "15km");
+ g_assert_cmpstr (gdata_contacts_contact_get_occupation (contact), ==, "Occupied");
+ g_assert_cmpstr (gdata_contacts_contact_get_priority (contact), ==, GDATA_CONTACTS_PRIORITY_LOW);
+ g_assert_cmpstr (gdata_contacts_contact_get_sensitivity (contact), ==, GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL);
+ g_assert_cmpstr (gdata_contacts_contact_get_short_name (contact), ==, "Smith");
+ g_assert_cmpstr (gdata_contacts_contact_get_subject (contact), ==, "Film buddy");
/* Birthday */
g_assert (gdata_contacts_contact_get_birthday (contact, &date) == TRUE);
@@ -837,6 +937,54 @@ test_parser_error_handling (gconstpointer service)
TEST_XML_ERROR_HANDLING ("<gContact:birthday when='foobar'/>"); /* invalid date */
TEST_XML_ERROR_HANDLING ("<gContact:birthday when='2000-01-01'/><gContact:birthday when='--01-01'/>"); /* duplicate */
+ /* gContact:billingInformation */
+ TEST_XML_ERROR_HANDLING ("<gContact:billingInformation/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:billingInformation>foo</gContact:billingInformation>"
+ "<gContact:billingInformation>Dupe!</gContact:billingInformation>"); /* duplicate */
+
+ /* gContact:directoryServer */
+ TEST_XML_ERROR_HANDLING ("<gContact:directoryServer/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:directoryServer>foo</gContact:directoryServer>"
+ "<gContact:directoryServer>Dupe!</gContact:directoryServer>"); /* duplicate */
+
+ /* gContact:gender */
+ TEST_XML_ERROR_HANDLING ("<gContact:gender/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:gender value='male'/><gContact:gender value='female'/>"); /* duplicate */
+
+ /* gContact:initials */
+ TEST_XML_ERROR_HANDLING ("<gContact:initials/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:initials>A</gContact:initials><gContact:initials>B</gContact:initials>"); /* duplicate */
+
+ /* gContact:maidenName */
+ TEST_XML_ERROR_HANDLING ("<gContact:maidenName/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:maidenName>A</gContact:maidenName><gContact:maidenName>B</gContact:maidenName>"); /* duplicate */
+
+ /* gContact:mileage */
+ TEST_XML_ERROR_HANDLING ("<gContact:mileage/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:mileage>12 mi</gContact:mileage><gContact:mileage>12 mi</gContact:mileage>"); /* duplicate */
+
+ /* gContact:occupation */
+ TEST_XML_ERROR_HANDLING ("<gContact:occupation/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:occupation>Foo</gContact:occupation><gContact:occupation>Bar</gContact:occupation>"); /* duplicate */
+
+ /* gContact:priority */
+ TEST_XML_ERROR_HANDLING ("<gContact:priority/>"); /* missing rel param */
+ TEST_XML_ERROR_HANDLING ("<gContact:priority rel=''/>"); /* empty rel param */
+ TEST_XML_ERROR_HANDLING ("<gContact:priority rel='high'/><gContact:priority rel='low'/>"); /* duplicate */
+
+ /* gContact:sensitivity */
+ TEST_XML_ERROR_HANDLING ("<gContact:sensitivity/>"); /* missing rel param */
+ TEST_XML_ERROR_HANDLING ("<gContact:sensitivity rel=''/>"); /* empty rel param */
+ TEST_XML_ERROR_HANDLING ("<gContact:sensitivity rel='private'/><gContact:sensitivity rel='normal'/>"); /* duplicate */
+
+ /* gContact:shortName */
+ TEST_XML_ERROR_HANDLING ("<gContact:shortName/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:shortName>Foo</gContact:shortName><gContact:shortName>Bar</gContact:shortName>"); /* duplicate */
+
+ /* gContact:subject */
+ TEST_XML_ERROR_HANDLING ("<gContact:subject/>"); /* missing content */
+ TEST_XML_ERROR_HANDLING ("<gContact:subject>Foo</gContact:subject><gContact:subject>Bar</gContact:subject>"); /* duplicate */
+
/* gContact:jot */
TEST_XML_ERROR_HANDLING ("<gContact:jot/>");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]