37
37
* gdata_contacts_group_get_extended_property(), are provided as a method of storing client-specific data which shouldn't be seen or be editable
38
38
* by the user, such as IDs and cache times.
41
* <title>Adding a New Group</title>
43
* GDataContactsService *service;
44
* GDataContactsGroup *group, *updated_group;
45
* GDataContactsContact *contact, *updated_contact;
46
* GError *error = NULL;
48
* /<!-- -->* Create a service and return a contact to add to the new group. *<!-- -->/
49
* service = create_contacts_service ();
50
* contact = query_user_for_contact (service);
52
* /<!-- -->* Create the new group *<!-- -->/
53
* group = gdata_contacts_group_new (NULL);
54
* gdata_entry_set_title (GDATA_ENTRY (group), "Group Name");
56
* /<!-- -->* Insert the group on the server *<!-- -->/
57
* updated_group = gdata_contacts_service_insert_group (service, group, NULL, &error);
59
* g_object_unref (group);
61
* if (error != NULL) {
62
* g_error ("Error adding a group: %s", error->message);
63
* g_error_free (error);
64
* g_object_unref (contact);
65
* g_object_unref (service);
69
* /<!-- -->* Add the contact to the new group. *<!-- -->/
70
* gdata_contacts_contact_add_group (contact, gdata_entry_get_id (GDATA_ENTRY (updated_group)));
72
* g_object_unref (updated_group);
74
* /<!-- -->* Update the contact on the server *<!-- -->/
75
* updated_contact = GDATA_CONTACTS_CONTACT (gdata_service_update_entry (GDATA_SERVICE (service), GDATA_ENTRY (contact), NULL, &error));
77
* g_object_unref (contact);
78
* g_object_unref (service);
80
* if (error != NULL) {
81
* g_error ("Error updating contact: %s", error->message);
82
* g_error_free (error);
86
* /<!-- -->* Do something with the updated contact, such as update them in the UI, or store their ID for future use. *<!-- -->/
88
* g_object_unref (updated_contact);
355
407
get_extended_property_xml_cb (const gchar *name, const gchar *value, GString *xml_string)
358
g_string_append_printf (xml_string, "<gd:extendedProperty name='%s'>%s</gd:extendedProperty>", name, value);
409
/* Note that the value *isn't* escaped (see http://code.google.com/apis/gdata/docs/2.0/elements.html#gdExtendedProperty) */
410
gdata_parser_string_append_escaped (xml_string, "<gd:extendedProperty name='", name, "'>");
411
g_string_append_printf (xml_string, "%s</gd:extendedProperty>", value);