Top |
Functions
Properties
gchar * | billing-information | Read / Write |
GDate * | birthday | Read / Write |
gboolean | birthday-has-year | Read / Write |
gboolean | deleted | Read |
gchar * | directory-server | Read / Write |
gint64 | edited | Read |
gchar * | file-as | Read / Write |
gchar * | gender | Read / Write |
gchar * | initials | Read / Write |
gchar * | maiden-name | Read / Write |
gchar * | mileage | Read / Write |
GDataGDName * | name | Read / Write |
gchar * | nickname | Read / Write |
gchar * | occupation | Read / Write |
gchar * | photo-etag | Read |
gchar * | priority | Read / Write |
gchar * | sensitivity | Read / Write |
gchar * | short-name | Read / Write |
gchar * | subject | Read / Write |
Types and Values
#define | GDATA_CONTACTS_GENDER_MALE |
#define | GDATA_CONTACTS_GENDER_FEMALE |
#define | GDATA_CONTACTS_PRIORITY_LOW |
#define | GDATA_CONTACTS_PRIORITY_NORMAL |
#define | GDATA_CONTACTS_PRIORITY_HIGH |
#define | GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL |
#define | GDATA_CONTACTS_SENSITIVITY_NORMAL |
#define | GDATA_CONTACTS_SENSITIVITY_PERSONAL |
#define | GDATA_CONTACTS_SENSITIVITY_PRIVATE |
GDataContactsContact | |
GDataContactsContactClass |
Description
GDataContactsContact is a subclass of GDataEntry to represent a contact from a Google address book.
For more details of Google Contacts' GData API, see the online documentation.
In addition to all the standard properties available for a contact, GDataContactsContact supports two kinds of additional property: extended
properties and user-defined fields. Extended properties, set with gdata_contacts_contact_set_extended_property()
and retrieved with
gdata_contacts_contact_get_extended_property()
, are provided as a method of storing client-specific data which shouldn't be seen or be editable
by the user, such as IDs and cache times. User-defined fields, set with gdata_contacts_contact_set_user_defined_field()
and retrieved with
gdata_contacts_contact_get_user_defined_field()
, store fields defined by the user, and editable by them in the interface (both the interface of
the appliation using libgdata, and the Google Contacts web interface).
Example 23. Getting a Contact's Photo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
GDataContactsService *service; GDataContactsContact *contact; guint8 *data; gchar *content_type = NULL; gsize length = 0; GError *error = NULL; /* Create a service and return the contact whose photo we're getting. */ service = create_contacts_service (); contact = query_user_for_contact (service); /* Get the photo. This should almost always be done asynchronously. */ data = gdata_contacts_contact_get_photo (contact, service, &length, &content_type, NULL, &error); g_object_unref (contact); g_object_unref (service); if (error != NULL) { g_error ("Error getting a contact's photo: %s", error->message); g_error_free (error); return; } /* Do something with the photo, stored in data, length and content_type. */ g_free (content_type); g_free (data); |
Example 24. Setting a Contact's Photo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
GDataContactsService *service; GDataContactsContact *contact; guint8 *data; gchar *content_type = NULL; gsize length = 0; GError *error = NULL; /* Create a service and return the contact whose photo we're getting, as well as the details of the new photo. */ service = create_contacts_service (); contact = query_user_for_contact (service); data = query_user_for_new_photo (contact, &content_type, &length); /* Set the photo. This should almost always be done asynchronously. To delete the photo, just pass NULL as the photo data. */ gdata_contacts_contact_set_photo (contact, service, data, length, content_type, NULL, &error); g_free (data); g_free (content_type); g_object_unref (contact); g_object_unref (service); if (error != NULL) { g_error ("Error setting a contact's photo: %s", error->message); g_error_free (error); return; } |
Example 25. Updating a Contact's Details
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
GDataContactsService *service; GDataContactsContact *contact, *updated_contact; GDataGDEmailAddress *email_address; GDataGDIMAddress *im_address; GError *error = NULL; /* Create a service and return the contact whose details we're updating. */ service = create_contacts_service (); contact = query_user_for_contact (service); /* Update the contact's details. We set their nickname to "Fat Tony", add a new e-mail address, and replace all their existing IM * addresses with a single new one. */ gdata_contacts_contact_set_nickname (contact, "Fat Tony"); email_address = gdata_gd_email_address_new ("tony@gmail.com", GDATA_GD_EMAIL_ADDRESS_HOME, NULL, FALSE); gdata_contacts_contact_add_email_address (contact, email_address); g_object_unref (email_address); gdata_contacts_contact_remove_all_im_addresses (contact); im_address = gdata_gd_im_address_new ("tony.work@gmail.com", GDATA_GD_IM_PROTOCOL_GOOGLE_TALK, GDATA_GD_IM_ADDRESS_WORK, NULL, TRUE); gdata_contacts_contact_add_im_address (contact, im_address); g_object_unref (im_address); /* Send the updated contact to the server */ updated_contact = GDATA_CONTACTS_CONTACT (gdata_service_update_entry (GDATA_SERVICE (service), GDATA_ENTRY (contact), NULL, &error)); g_object_unref (contact); g_object_unref (service); if (error != NULL) { g_error ("Error updating a contact's details: %s", error->message); g_error_free (error); return; } /* Do something with the updated contact, such as update them in the UI, or store their ID for future use. */ g_object_unref (updated_contact); |
Functions
gdata_contacts_contact_new ()
GDataContactsContact *
gdata_contacts_contact_new (const gchar *id
);
Creates a new GDataContactsContact with the given ID and default properties.
Since: 0.2.0
gdata_contacts_contact_get_name ()
GDataGDName *
gdata_contacts_contact_get_name (GDataContactsContact *self
);
Gets the “name” property.
Since: 0.5.0
gdata_contacts_contact_set_name ()
void gdata_contacts_contact_set_name (GDataContactsContact *self
,GDataGDName *name
);
Sets the “name” property to name
, and increments its reference count.
name
must not be NULL
, though all its properties may be NULL
.
Since: 0.7.0
gdata_contacts_contact_get_short_name ()
const gchar *
gdata_contacts_contact_get_short_name (GDataContactsContact *self
);
Gets the “short-name” property.
Since: 0.7.0
gdata_contacts_contact_set_short_name ()
void gdata_contacts_contact_set_short_name (GDataContactsContact *self
,const gchar *short_name
);
Sets the “short-name” property to short_name
.
If short_name
is NULL
, the contact's short name will be removed.
Since: 0.7.0
gdata_contacts_contact_get_initials ()
const gchar *
gdata_contacts_contact_get_initials (GDataContactsContact *self
);
Gets the “initials” property.
Since: 0.7.0
gdata_contacts_contact_set_initials ()
void gdata_contacts_contact_set_initials (GDataContactsContact *self
,const gchar *initials
);
Sets the “initials” property to initials
.
If initials
is NULL
, the contact's initials will be removed.
Since: 0.7.0
gdata_contacts_contact_get_maiden_name ()
const gchar *
gdata_contacts_contact_get_maiden_name
(GDataContactsContact *self
);
Gets the “maiden-name” property.
Since: 0.7.0
gdata_contacts_contact_set_maiden_name ()
void gdata_contacts_contact_set_maiden_name (GDataContactsContact *self
,const gchar *maiden_name
);
Sets the “maiden-name” property to maiden_name
.
If maiden_name
is NULL
, the contact's maiden name will be removed.
Since: 0.7.0
gdata_contacts_contact_get_nickname ()
const gchar *
gdata_contacts_contact_get_nickname (GDataContactsContact *self
);
Gets the “nickname” property.
Since: 0.7.0
gdata_contacts_contact_set_nickname ()
void gdata_contacts_contact_set_nickname (GDataContactsContact *self
,const gchar *nickname
);
Sets the “nickname” property to nickname
.
If nickname
is NULL
, the contact's nickname will be removed.
Since: 0.7.0
gdata_contacts_contact_get_file_as ()
const gchar *
gdata_contacts_contact_get_file_as (GDataContactsContact *self
);
Gets the “file-as” property.
Since: 0.11.0
gdata_contacts_contact_set_file_as ()
void gdata_contacts_contact_set_file_as (GDataContactsContact *self
,const gchar *file_as
);
Sets the “file-as” property to file_as
.
If file_as
is NULL
, the contact will be filed under their full name.
Since: 0.7.0
gdata_contacts_contact_get_birthday ()
gboolean gdata_contacts_contact_get_birthday (GDataContactsContact *self
,GDate *birthday
);
Gets the “birthday” and “birthday-has-year” properties. If birthday
is non-NULL
,
“birthday” is returned in it. The function returns the value of “birthday-has-year”,
which specifies whether the year in birthday
is meaningful. Contacts may not have the year of their birth set, in which
case, the function would return FALSE
, and the year in birthday
should be ignored.
Parameters
self |
||
birthday |
return location for the birthday, or |
[allow-none][out caller-allocates] |
Since: 0.7.0
gdata_contacts_contact_set_birthday ()
void gdata_contacts_contact_set_birthday (GDataContactsContact *self
,GDate *birthday
,gboolean birthday_has_year
);
Sets the “birthday” property to birthday
and the “birthday-has-year” property to birthday_has_year
.
See gdata_contacts_contact_get_birthday()
for an explanation of the interation between these two properties.
If birthday
is NULL
, the contact's birthday will be removed.
Since: 0.7.0
gdata_contacts_contact_get_gender ()
const gchar *
gdata_contacts_contact_get_gender (GDataContactsContact *self
);
Gets the “gender” property.
Since: 0.7.0
gdata_contacts_contact_set_gender ()
void gdata_contacts_contact_set_gender (GDataContactsContact *self
,const gchar *gender
);
Sets the “gender” property to gender
.
If gender
is NULL
, the contact's gender will be removed.
Since: 0.7.0
gdata_contacts_contact_get_mileage ()
const gchar *
gdata_contacts_contact_get_mileage (GDataContactsContact *self
);
Gets the “mileage” property.
Since: 0.7.0
gdata_contacts_contact_set_mileage ()
void gdata_contacts_contact_set_mileage (GDataContactsContact *self
,const gchar *mileage
);
Sets the “mileage” property to mileage
.
If mileage
is NULL
, the contact's mileage will be removed.
Since: 0.7.0
gdata_contacts_contact_get_occupation ()
const gchar *
gdata_contacts_contact_get_occupation (GDataContactsContact *self
);
Gets the “occupation” property.
Since: 0.7.0
gdata_contacts_contact_set_occupation ()
void gdata_contacts_contact_set_occupation (GDataContactsContact *self
,const gchar *occupation
);
Sets the “occupation” property to occupation
.
If occupation
is NULL
, the contact's occupation will be removed.
Since: 0.7.0
gdata_contacts_contact_get_subject ()
const gchar *
gdata_contacts_contact_get_subject (GDataContactsContact *self
);
Gets the “subject” property.
Since: 0.7.0
gdata_contacts_contact_set_subject ()
void gdata_contacts_contact_set_subject (GDataContactsContact *self
,const gchar *subject
);
Sets the “subject” property to subject
.
If subject
is NULL
, the contact's subject will be removed.
Since: 0.7.0
gdata_contacts_contact_get_priority ()
const gchar *
gdata_contacts_contact_get_priority (GDataContactsContact *self
);
Gets the “priority” property.
Since: 0.7.0
gdata_contacts_contact_set_priority ()
void gdata_contacts_contact_set_priority (GDataContactsContact *self
,const gchar *priority
);
Sets the “priority” property to priority
.
If priority
is NULL
, the contact's priority will be removed.
Since: 0.7.0
gdata_contacts_contact_get_sensitivity ()
const gchar *
gdata_contacts_contact_get_sensitivity
(GDataContactsContact *self
);
Gets the “sensitivity” property.
Since: 0.7.0
gdata_contacts_contact_set_sensitivity ()
void gdata_contacts_contact_set_sensitivity (GDataContactsContact *self
,const gchar *sensitivity
);
Sets the “sensitivity” property to sensitivity
.
If sensitivity
is NULL
, the contact's sensitivity will be removed.
Since: 0.7.0
gdata_contacts_contact_get_directory_server ()
const gchar *
gdata_contacts_contact_get_directory_server
(GDataContactsContact *self
);
Gets the “directory-server” property.
Since: 0.7.0
gdata_contacts_contact_set_directory_server ()
void gdata_contacts_contact_set_directory_server (GDataContactsContact *self
,const gchar *directory_server
);
Sets the “directory-server” property to directory_server
.
If directory_server
is NULL
, the contact's directory server will be removed.
Parameters
self |
||
directory_server |
the new name or address of a directory server associated with the contact, or |
[allow-none] |
Since: 0.7.0
gdata_contacts_contact_get_billing_information ()
const gchar *
gdata_contacts_contact_get_billing_information
(GDataContactsContact *self
);
Gets the “billing-information” property.
Since: 0.7.0
gdata_contacts_contact_set_billing_information ()
void gdata_contacts_contact_set_billing_information (GDataContactsContact *self
,const gchar *billing_information
);
Sets the “billing-information” property to billing_information
.
If billing_information
is NULL
, the contact's billing information will be removed.
Parameters
self |
||
billing_information |
the new billing information for the contact, or |
[allow-none] |
Since: 0.7.0
gdata_contacts_contact_get_email_addresses ()
GList *
gdata_contacts_contact_get_email_addresses
(GDataContactsContact *self
);
Gets a list of the e-mail addresses owned by the contact.
Returns
a GList of GDataGDEmailAddresses, or NULL
.
[element-type GData.GDEmailAddress][transfer none]
Since: 0.2.0
gdata_contacts_contact_get_primary_email_address ()
GDataGDEmailAddress *
gdata_contacts_contact_get_primary_email_address
(GDataContactsContact *self
);
Gets the contact's primary e-mail address, if one exists.
Since: 0.2.0
gdata_contacts_contact_add_email_address ()
void gdata_contacts_contact_add_email_address (GDataContactsContact *self
,GDataGDEmailAddress *email_address
);
Adds an e-mail address to the contact's list of e-mail addresses and increments its reference count.
Note that only one e-mail address per contact may be marked as "primary". Insertion and update operations
(with gdata_contacts_service_insert_contact()
) will return an error if more than one e-mail address
is marked as primary.
Duplicate e-mail addresses will not be added to the list.
Since: 0.2.0
gdata_contacts_contact_remove_all_email_addresses ()
void
gdata_contacts_contact_remove_all_email_addresses
(GDataContactsContact *self
);
Removes all e-mail addresses from the contact.
Since: 0.4.0
gdata_contacts_contact_get_im_addresses ()
GList *
gdata_contacts_contact_get_im_addresses
(GDataContactsContact *self
);
Gets a list of the IM addresses owned by the contact.
Since: 0.2.0
gdata_contacts_contact_get_primary_im_address ()
GDataGDIMAddress *
gdata_contacts_contact_get_primary_im_address
(GDataContactsContact *self
);
Gets the contact's primary IM address, if one exists.
Since: 0.2.0
gdata_contacts_contact_add_im_address ()
void gdata_contacts_contact_add_im_address (GDataContactsContact *self
,GDataGDIMAddress *im_address
);
Adds an IM (instant messaging) address to the contact's list of IM addresses and increments its reference count.
Note that only one IM address per contact may be marked as "primary". Insertion and update operations
(with gdata_contacts_service_insert_contact()
) will return an error if more than one IM address
is marked as primary.
Duplicate IM addresses will not be added to the list.
Since: 0.2.0
gdata_contacts_contact_remove_all_im_addresses ()
void
gdata_contacts_contact_remove_all_im_addresses
(GDataContactsContact *self
);
Removes all IM addresses from the contact.
Since: 0.4.0
gdata_contacts_contact_get_postal_addresses ()
GList *
gdata_contacts_contact_get_postal_addresses
(GDataContactsContact *self
);
Gets a list of the postal addresses owned by the contact.
Returns
a GList of GDataGDPostalAddresses, or NULL
.
[element-type GData.GDPostalAddress][transfer none]
Since: 0.2.0
gdata_contacts_contact_get_primary_postal_address ()
GDataGDPostalAddress *
gdata_contacts_contact_get_primary_postal_address
(GDataContactsContact *self
);
Gets the contact's primary postal address, if one exists.
Since: 0.2.0
gdata_contacts_contact_add_postal_address ()
void gdata_contacts_contact_add_postal_address (GDataContactsContact *self
,GDataGDPostalAddress *postal_address
);
Adds a postal address to the contact's list of postal addresses and increments its reference count.
Note that only one postal address per contact may be marked as "primary". Insertion and update operations
(with gdata_contacts_service_insert_contact()
) will return an error if more than one postal address
is marked as primary.
Duplicate postal addresses will not be added to the list.
Since: 0.2.0
gdata_contacts_contact_remove_all_postal_addresses ()
void
gdata_contacts_contact_remove_all_postal_addresses
(GDataContactsContact *self
);
Removes all postal addresses from the contact.
Since: 0.4.0
gdata_contacts_contact_get_phone_numbers ()
GList *
gdata_contacts_contact_get_phone_numbers
(GDataContactsContact *self
);
Gets a list of the phone numbers owned by the contact.
Since: 0.2.0
gdata_contacts_contact_get_primary_phone_number ()
GDataGDPhoneNumber *
gdata_contacts_contact_get_primary_phone_number
(GDataContactsContact *self
);
Gets the contact's primary phone number, if one exists.
Since: 0.2.0
gdata_contacts_contact_add_phone_number ()
void gdata_contacts_contact_add_phone_number (GDataContactsContact *self
,GDataGDPhoneNumber *phone_number
);
Adds a phone number to the contact's list of phone numbers and increments its reference count
Note that only one phone number per contact may be marked as "primary". Insertion and update operations
(with gdata_contacts_service_insert_contact()
) will return an error if more than one phone number
is marked as primary.
Duplicate phone numbers will not be added to the list.
Since: 0.2.0
gdata_contacts_contact_remove_all_phone_numbers ()
void
gdata_contacts_contact_remove_all_phone_numbers
(GDataContactsContact *self
);
Removes all phone numbers from the contact.
Since: 0.4.0
gdata_contacts_contact_get_organizations ()
GList *
gdata_contacts_contact_get_organizations
(GDataContactsContact *self
);
Gets a list of the organizations to which the contact belongs.
Returns
a GList of GDataGDOrganizations, or NULL
.
[element-type GData.GDOrganization][transfer none]
Since: 0.2.0
gdata_contacts_contact_get_primary_organization ()
GDataGDOrganization *
gdata_contacts_contact_get_primary_organization
(GDataContactsContact *self
);
Gets the contact's primary organization, if one exists.
Since: 0.2.0
gdata_contacts_contact_add_organization ()
void gdata_contacts_contact_add_organization (GDataContactsContact *self
,GDataGDOrganization *organization
);
Adds an organization to the contact's list of organizations (e.g. employers) and increments its reference count.
Note that only one organization per contact may be marked as "primary". Insertion and update operations
(with gdata_contacts_service_insert_contact()
) will return an error if more than one organization
is marked as primary.
Duplicate organizations will not be added to the list.
Since: 0.2.0
gdata_contacts_contact_remove_all_organizations ()
void
gdata_contacts_contact_remove_all_organizations
(GDataContactsContact *self
);
Removes all organizations from the contact.
Since: 0.4.0
gdata_contacts_contact_add_jot ()
void gdata_contacts_contact_add_jot (GDataContactsContact *self
,GDataGContactJot *jot
);
Adds a jot to the contact's list of jots and increments its reference count.
Duplicate jots will be added to the list, and multiple jots with the same relation type can be added to a single contact.
Since: 0.7.0
gdata_contacts_contact_get_jots ()
GList *
gdata_contacts_contact_get_jots (GDataContactsContact *self
);
Gets a list of the jots attached to the contact.
Since: 0.7.0
gdata_contacts_contact_remove_all_jots ()
void
gdata_contacts_contact_remove_all_jots
(GDataContactsContact *self
);
Removes all jots from the contact.
Since: 0.7.0
gdata_contacts_contact_add_relation ()
void gdata_contacts_contact_add_relation (GDataContactsContact *self
,GDataGContactRelation *relation
);
Adds a relation to the contact's list of relations and increments its reference count.
Duplicate relations will be added to the list, and multiple relations with the same relation type can be added to a single contact. Though it may not make sense for some relation types to be repeated, adding them is allowed.
Since: 0.7.0
gdata_contacts_contact_get_relations ()
GList *
gdata_contacts_contact_get_relations (GDataContactsContact *self
);
Gets a list of the relations of the contact.
Returns
a GList of GDataGContactRelations, or NULL
.
[element-type GData.GContactRelation][transfer none]
Since: 0.7.0
gdata_contacts_contact_remove_all_relations ()
void
gdata_contacts_contact_remove_all_relations
(GDataContactsContact *self
);
Removes all relations from the contact.
Since: 0.7.0
gdata_contacts_contact_add_website ()
void gdata_contacts_contact_add_website (GDataContactsContact *self
,GDataGContactWebsite *website
);
Adds a website to the contact's list of websites and increments its reference count.
Duplicate websites will not be added to the list, though the same URI may appear in several GDataGContactWebsites with different relation types or labels.
Since: 0.7.0
gdata_contacts_contact_get_websites ()
GList *
gdata_contacts_contact_get_websites (GDataContactsContact *self
);
Gets a list of the websites of the contact.
Returns
a GList of GDataGContactWebsites, or NULL
.
[element-type GData.GContactWebsite][transfer none]
Since: 0.7.0
gdata_contacts_contact_get_primary_website ()
GDataGContactWebsite *
gdata_contacts_contact_get_primary_website
(GDataContactsContact *self
);
Gets the contact's primary website, if one exists.
Since: 0.7.0
gdata_contacts_contact_remove_all_websites ()
void
gdata_contacts_contact_remove_all_websites
(GDataContactsContact *self
);
Removes all websites from the contact.
Since: 0.7.0
gdata_contacts_contact_add_event ()
void gdata_contacts_contact_add_event (GDataContactsContact *self
,GDataGContactEvent *event
);
Adds an event to the contact's list of events and increments its reference count.
Duplicate events will be added to the list, and multiple events with the same event type can be added to a single contact. Though it may not make sense for some event types to be repeated, adding them is allowed.
Since: 0.7.0
gdata_contacts_contact_get_events ()
GList *
gdata_contacts_contact_get_events (GDataContactsContact *self
);
Gets a list of the events of the contact.
Since: 0.7.0
gdata_contacts_contact_remove_all_events ()
void
gdata_contacts_contact_remove_all_events
(GDataContactsContact *self
);
Removes all events from the contact.
Since: 0.7.0
gdata_contacts_contact_add_calendar ()
void gdata_contacts_contact_add_calendar (GDataContactsContact *self
,GDataGContactCalendar *calendar
);
Adds a calendar to the contact's list of calendars and increments its reference count.
Duplicate calendars will not be added to the list, though the same URI may appear in several GDataGContactCalendars with different relation types or labels.
Since: 0.7.0
gdata_contacts_contact_get_calendars ()
GList *
gdata_contacts_contact_get_calendars (GDataContactsContact *self
);
Gets a list of the calendars of the contact.
Returns
a GList of GDataGContactCalendars, or NULL
.
[element-type GData.GContactCalendar][transfer none]
Since: 0.7.0
gdata_contacts_contact_get_primary_calendar ()
GDataGContactCalendar *
gdata_contacts_contact_get_primary_calendar
(GDataContactsContact *self
);
Gets the contact's primary calendar, if one exists.
Since: 0.7.0
gdata_contacts_contact_remove_all_calendars ()
void
gdata_contacts_contact_remove_all_calendars
(GDataContactsContact *self
);
Removes all calendars from the contact.
Since: 0.7.0
gdata_contacts_contact_add_external_id ()
void gdata_contacts_contact_add_external_id (GDataContactsContact *self
,GDataGContactExternalID *external_id
);
Adds an external ID to the contact's list of external IDs and increments its reference count.
Duplicate IDs will not be added to the list.
Since: 0.7.0
gdata_contacts_contact_get_external_ids ()
GList *
gdata_contacts_contact_get_external_ids
(GDataContactsContact *self
);
Gets a list of the external IDs of the contact.
Returns
a GList of GDataGContactExternalIDs, or NULL
.
[element-type GData.GContactExternalID][transfer none]
Since: 0.7.0
gdata_contacts_contact_remove_all_external_ids ()
void
gdata_contacts_contact_remove_all_external_ids
(GDataContactsContact *self
);
Removes all external IDs from the contact.
Since: 0.7.0
gdata_contacts_contact_add_hobby ()
void gdata_contacts_contact_add_hobby (GDataContactsContact *self
,const gchar *hobby
);
Adds a hobby to the contact's list of hobbies, copying it in the process.
Duplicate hobbies will not be added to the list.
Since: 0.7.0
gdata_contacts_contact_get_hobbies ()
GList *
gdata_contacts_contact_get_hobbies (GDataContactsContact *self
);
Gets a list of the hobbies of the contact.
Since: 0.7.0
gdata_contacts_contact_remove_all_hobbies ()
void
gdata_contacts_contact_remove_all_hobbies
(GDataContactsContact *self
);
Removes all hobbies from the contact.
Since: 0.7.0
gdata_contacts_contact_add_language ()
void gdata_contacts_contact_add_language (GDataContactsContact *self
,GDataGContactLanguage *language
);
Adds a language to the contact's list of languages and increments its reference count.
Duplicate languages will not be added to the list.
Since: 0.7.0
gdata_contacts_contact_get_languages ()
GList *
gdata_contacts_contact_get_languages (GDataContactsContact *self
);
Gets a list of the languages of the contact.
Returns
a GList of GDataGContactLanguages, or NULL
.
[element-type GData.GContactLanguage][transfer none]
Since: 0.7.0
gdata_contacts_contact_remove_all_languages ()
void
gdata_contacts_contact_remove_all_languages
(GDataContactsContact *self
);
Removes all languages from the contact.
Since: 0.7.0
gdata_contacts_contact_get_groups ()
GList *
gdata_contacts_contact_get_groups (GDataContactsContact *self
);
Gets a list of the groups to which the contact belongs.
Returns
a GList of constant group ID URIs, or NULL
; free with g_list_free()
.
[element-type utf8][transfer container]
Since: 0.2.0
gdata_contacts_contact_add_group ()
void gdata_contacts_contact_add_group (GDataContactsContact *self
,const gchar *href
);
Adds the contact to the given group. href
should be a URI.
Since: 0.2.0
gdata_contacts_contact_remove_group ()
void gdata_contacts_contact_remove_group (GDataContactsContact *self
,const gchar *href
);
Removes the contact from the given group. href
should be a URI.
Since: 0.2.0
gdata_contacts_contact_is_group_deleted ()
gboolean gdata_contacts_contact_is_group_deleted (GDataContactsContact *self
,const gchar *href
);
Returns whether the contact has recently been removed from the given group on the server. This
will always return FALSE
unless “show-deleted” has been set to
TRUE
for the query which returned the contact.
If you've just removed a contact from a group locally using gdata_contacts_contact_remove_group()
, FALSE
will still be returned by this function,
as the change hasn't been sent to the server.
Since: 0.2.0
gdata_contacts_contact_get_extended_property ()
const gchar * gdata_contacts_contact_get_extended_property (GDataContactsContact *self
,const gchar *name
);
Gets the value of an extended property of the contact. Each contact can have up to 10 client-set extended properties to store data of the client's choosing.
Since: 0.2.0
gdata_contacts_contact_get_extended_properties ()
GHashTable *
gdata_contacts_contact_get_extended_properties
(GDataContactsContact *self
);
Gets the full list of extended properties of the contact; a hash table mapping property name to value.
Since: 0.4.0
gdata_contacts_contact_set_extended_property ()
gboolean gdata_contacts_contact_set_extended_property (GDataContactsContact *self
,const gchar *name
,const gchar *value
);
Sets the value of a contact's extended property. Extended property names are unique (but of the client's choosing), and reusing the same property name will result in the old value of that property being overwritten.
To unset a property, set value
to NULL
or an empty string.
A contact may have up to 10 extended properties, and each should be reasonably small (i.e. not a photo or ringtone).
For more information, see the online documentation.
FALSE
will be returned if you attempt to add more than 10 extended properties.
Parameters
self |
||
name |
the property name; an arbitrary, unique string |
|
value |
the property value, or |
[allow-none] |
Since: 0.2.0
gdata_contacts_contact_get_user_defined_field ()
const gchar * gdata_contacts_contact_get_user_defined_field (GDataContactsContact *self
,const gchar *name
);
Gets the value of a user-defined field of the contact. User-defined fields are settable by the user through the Google Contacts web interface, in contrast to extended properties, which are visible and settable only through the GData interface.
The name
of the field may not be NULL
, but may be an empty string.
Since: 0.7.0
gdata_contacts_contact_get_user_defined_fields ()
GHashTable *
gdata_contacts_contact_get_user_defined_fields
(GDataContactsContact *self
);
Gets the full list of user-defined fields of the contact; a hash table mapping field name to value.
Since: 0.7.0
gdata_contacts_contact_set_user_defined_field ()
void gdata_contacts_contact_set_user_defined_field (GDataContactsContact *self
,const gchar *name
,const gchar *value
);
Sets the value of a contact's user-defined field. User-defined field names are unique (but of the client's choosing), and reusing the same field name will result in the old value of that field being overwritten.
The name
of the field may not be NULL
, but may be an empty string.
To unset a field, set value
to NULL
.
Parameters
self |
||
name |
the field name; an arbitrary, case-sensitive, unique string |
|
value |
the field value, or |
[allow-none] |
Since: 0.7.0
gdata_contacts_contact_get_edited ()
gint64
gdata_contacts_contact_get_edited (GDataContactsContact *self
);
Gets the “edited” property. If the property is unset, -1
will be returned.
Since: 0.2.0
gdata_contacts_contact_is_deleted ()
gboolean
gdata_contacts_contact_is_deleted (GDataContactsContact *self
);
Returns whether the contact has recently been deleted. This will always return
FALSE
unless “show-deleted” has been set to
TRUE
for the query which returned the contact; then this function will return
TRUE
only if the contact has been deleted.
If a contact has been deleted, no other information is available about it. This is designed to allow contacts to be deleted from local address books using incremental updates from the server (e.g. with “updated-min” and “show-deleted”).
Since: 0.2.0
gdata_contacts_contact_get_photo_etag ()
const gchar *
gdata_contacts_contact_get_photo_etag (GDataContactsContact *self
);
Returns the ETag for the contact's attached photo, if it exists. If it does exist, the contact's photo can be retrieved using
gdata_contacts_contact_get_photo()
. If it doesn't exist, NULL
will be returned, and the contact doesn't have a photo (so calling
gdata_contacts_contact_get_photo()
will also return NULL
)
Since: 0.9.0
gdata_contacts_contact_get_photo ()
guint8 * gdata_contacts_contact_get_photo (GDataContactsContact *self
,GDataContactsService *service
,gsize *length
,gchar **content_type
,GCancellable *cancellable
,GError **error
);
Downloads and returns the contact's photo, if they have one. If the contact doesn't
have a photo (i.e. gdata_contacts_contact_get_photo_etag()
returns NULL
), NULL
is returned, but
no error is set in error
.
If cancellable
is not NULL
, then the operation can be cancelled by triggering the cancellable
object from another thread.
If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If there is an error getting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned.
Parameters
Since: 0.8.0
gdata_contacts_contact_get_photo_async ()
void gdata_contacts_contact_get_photo_async (GDataContactsContact *self
,GDataContactsService *service
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Downloads and returns the contact's photo, if they have one, asynchronously. self
and service
are both reffed when this function is called, so
can safely be unreffed after this function returns.
When the operation is finished, callback
will be called. You can then call gdata_contacts_contact_get_photo_finish()
to get the results of the
operation.
For more details, see gdata_contacts_contact_get_photo()
, which is the synchronous version of this function.
If cancellable
is not NULL
, then the operation can be cancelled by triggering the cancellable
object from another thread.
If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned by gdata_contacts_contact_get_photo_finish()
.
If there is an error getting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned by gdata_contacts_contact_get_photo_finish()
.
Parameters
Since: 0.8.0
gdata_contacts_contact_get_photo_finish ()
guint8 * gdata_contacts_contact_get_photo_finish (GDataContactsContact *self
,GAsyncResult *async_result
,gsize *length
,gchar **content_type
,GError **error
);
Finishes an asynchronous contact photo retrieval operation started with gdata_contacts_contact_get_photo_async()
. If the contact doesn't have a
photo (i.e. gdata_contacts_contact_get_photo_etag()
returns NULL
), NULL
is returned, but no error is set in error
.
If there is an error getting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned. length
will be set to
0
and content_type
will be set to NULL
.
Parameters
Since: 0.8.0
gdata_contacts_contact_set_photo ()
gboolean gdata_contacts_contact_set_photo (GDataContactsContact *self
,GDataContactsService *service
,const guint8 *data
,gsize length
,const gchar *content_type
,GCancellable *cancellable
,GError **error
);
Sets the contact's photo to data
or, if data
is NULL
, deletes the contact's photo. content_type
must be specified if data
is non-NULL
.
If cancellable
is not NULL
, then the operation can be cancelled by triggering the cancellable
object from another thread.
If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If there is an error setting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned.
Parameters
Since: 0.8.0
gdata_contacts_contact_set_photo_async ()
void gdata_contacts_contact_set_photo_async (GDataContactsContact *self
,GDataContactsService *service
,const guint8 *data
,gsize length
,const gchar *content_type
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Sets the contact's photo to data
or, if data
is NULL
, deletes the contact's photo. content_type
must be specified if data
is non-NULL
. self
,
service
, data
and content_type
are all reffed and copied when this function is called, so can safely be unreffed after this function returns.
When the operation is finished, callback
will be called. You can then call gdata_contacts_contact_set_photo_finish()
to get the results of the
operation.
For more details, see gdata_contacts_contact_set_photo()
, which is the synchronous version of this function.
If cancellable
is not NULL
, then the operation can be cancelled by triggering the cancellable
object from another thread.
If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned by gdata_contacts_contact_set_photo_finish()
.
If there is an error setting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned by gdata_contacts_contact_set_photo_finish()
.
Parameters
self |
||
service |
||
data |
the image data, or |
[allow-none] |
length |
the image length, in bytes |
|
content_type |
the content type of the image, or |
[allow-none] |
cancellable |
optional GCancellable object, or |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the photo has been set, or |
|
user_data |
data to pass to the |
[closure] |
Since: 0.8.0
gdata_contacts_contact_set_photo_finish ()
gboolean gdata_contacts_contact_set_photo_finish (GDataContactsContact *self
,GAsyncResult *async_result
,GError **error
);
Finishes an asynchronous contact photo setting operation started with gdata_contacts_contact_set_photo_async()
.
If there is an error setting the photo, a GDATA_SERVICE_ERROR_PROTOCOL_ERROR
error will be returned.
Since: 0.8.0
Types and Values
GDATA_CONTACTS_GENDER_MALE
#define GDATA_CONTACTS_GENDER_MALE "male"
The contact is male.
Since: 0.7.0
GDATA_CONTACTS_GENDER_FEMALE
#define GDATA_CONTACTS_GENDER_FEMALE "female"
The contact is female.
Since: 0.7.0
GDATA_CONTACTS_PRIORITY_LOW
#define GDATA_CONTACTS_PRIORITY_LOW "low"
The contact is of low importance.
Since: 0.7.0
GDATA_CONTACTS_PRIORITY_NORMAL
#define GDATA_CONTACTS_PRIORITY_NORMAL "normal"
The contact is of normal importance.
Since: 0.7.0
GDATA_CONTACTS_PRIORITY_HIGH
#define GDATA_CONTACTS_PRIORITY_HIGH "high"
The contact is of high importance.
Since: 0.7.0
GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL
#define GDATA_CONTACTS_SENSITIVITY_CONFIDENTIAL "confidential"
The contact's data is confidential.
Since: 0.7.0
GDATA_CONTACTS_SENSITIVITY_NORMAL
#define GDATA_CONTACTS_SENSITIVITY_NORMAL "normal"
The contact's data is of normal sensitivity.
Since: 0.7.0
GDATA_CONTACTS_SENSITIVITY_PERSONAL
#define GDATA_CONTACTS_SENSITIVITY_PERSONAL "personal"
The contact's data is personal.
Since: 0.7.0
GDATA_CONTACTS_SENSITIVITY_PRIVATE
#define GDATA_CONTACTS_SENSITIVITY_PRIVATE "private"
The contact's data is private.
Since: 0.7.0
GDataContactsContact
typedef struct _GDataContactsContact GDataContactsContact;
All the fields in the GDataContactsContact structure are private and should never be accessed directly.
Since: 0.2.0
GDataContactsContactClass
typedef struct { } GDataContactsContactClass;
All the fields in the GDataContactsContactClass structure are private and should never be accessed directly.
Since: 0.2.0
Property Details
The “billing-information”
property
“billing-information” gchar *
Billing information for the contact, such as their billing name and address.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “birthday-has-year”
property
“birthday-has-year” gboolean
Whether the contact's birthday includes their year of birth.
Flags: Read / Write
Default value: FALSE
Since: 0.7.0
The “deleted”
property
“deleted” gboolean
Whether the entry has been deleted.
Flags: Read
Default value: FALSE
Since: 0.2.0
The “directory-server”
property
“directory-server” gchar *
The name or address of a directory server associated with the contact.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “edited”
property
“edited” gint64
The last time the contact was edited. If the contact has not been edited yet, the content indicates the time it was created.
For more information, see the Atom Publishing Protocol specification.
Flags: Read
Allowed values: >= -1
Default value: -1
Since: 0.2.0
The “file-as”
property
“file-as” gchar *
The name to file the contact under for sorting purposes.
Flags: Read / Write
Default value: NULL
Since: 0.11.0
The “gender”
property
“gender” gchar *
The gender of the contact. For example: GDATA_CONTACTS_GENDER_MALE
or GDATA_CONTACTS_GENDER_FEMALE
.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “initials”
property
“initials” gchar *
The initials of the contact.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “maiden-name”
property
“maiden-name” gchar *
The maiden name of the contact.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “mileage”
property
“mileage” gchar *
A mileage associated with the contact, such as one for reimbursement purposes. It can be in any format.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “name”
property
“name” GDataGDName *
The contact's name in a structured representation.
Flags: Read / Write
Since: 0.5.0
The “nickname”
property
“nickname” gchar *
The contact's chosen nickname.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “occupation”
property
“occupation” gchar *
The contact's occupation.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “photo-etag”
property
“photo-etag” gchar *
The ETag of the contact's photo, if the contact has a photo; NULL
otherwise.
Flags: Read
Default value: NULL
Since: 0.9.0
The “priority”
property
“priority” gchar *
The contact's importance. For example: GDATA_CONTACTS_PRIORITY_NORMAL
or GDATA_CONTACTS_PRIORITY_HIGH
.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “sensitivity”
property
“sensitivity” gchar *
The sensitivity of the contact's data. For example: GDATA_CONTACTS_SENSITIVITY_NORMAL
or GDATA_CONTACTS_SENSITIVITY_PRIVATE
.
Flags: Read / Write
Default value: NULL
Since: 0.7.0
The “short-name”
property
“short-name” gchar *
A short name for the contact. This should be used for contracted versions of the contact's actual name, whereas “nickname” should be used for nicknames.
Flags: Read / Write
Default value: NULL
Since: 0.7.0