<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>maemo.org wiki - User contributions [en]</title>
		<link>http://bugs.maemo.com/Special:Contributions/107.22.227.93</link>
		<description>From maemo.org wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Sat, 04 Apr 2026 22:39:31 GMT</lastBuildDate>
		<item>
			<title>Documentation/Maemo 5 Developer Guide/Using Generic Platform Components/Using Address Book API</title>
			<link>http://bugs.maemo.com/Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Using_Address_Book_API</link>
			<guid>http://bugs.maemo.com/Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Using_Address_Book_API</guid>
			<description>&lt;p&gt;107.22.227.93:&amp;#32;/* Roster Contact List Handling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Open development/Maemo roadmap/Fremantle|Maemo 5]] Address Book is a fully-featured address book software stack. This includes the Contacts application (process name [http://maemo.org/packages/view/osso-addressbook/ osso-addressbook]), a support library which implements most of its functionality ([http://maemo.org/packages/view/libosso-abook/ libosso-abook]), and contact storage via Evolution Data Server ([http://maemo.org/packages/view/evolution-data-server-addressbook/ EDS]). As with any address book program, the Contacts application allows you to add, edit and delete contacts. But beyond basic contacts, the Address Book supports browsing and importing SIM card contacts and tightly integrates VoIP and IM contacts provided by the Telepathy communications framework.&lt;br /&gt;
&lt;br /&gt;
This allows Contacts and your application to automatically add IM contacts to your account when adding an IM username to a contact or add a dialog to initiate phone calls, VoIP calls, text messages, emails, or chats with a single tap, and much more.&lt;br /&gt;
&lt;br /&gt;
This tutorial is focused on using Address Book functionality within third-party applications. It does not cover all classes nor does it cover any classes exhaustively. For information on the classes, see the [http://maemo.org/api_refs/5.0/5.0-final/libosso-abook/ reference documentation].&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
&lt;br /&gt;
The main components in the Maemo Address Book stack are the Contacts application (osso-addressbook), support library (libosso-abook), and Evolution Data Server.&lt;br /&gt;
&lt;br /&gt;
[[Image:abook-components.png|frame|center|alt=Diagram of address book components|Address book components]]&lt;br /&gt;
&lt;br /&gt;
=== The Contacts application (osso-addressbook) ===&lt;br /&gt;
&lt;br /&gt;
As you might expect, the Contacts application provides a convenient user interface for manipulating the contacts in the Maemo 5 system. And by design, nearly all the functionality within Contacts (including widgets) is actually located within libosso-abook, so that it can be reused by other applications (such as Phone and Conversations, or your own).&lt;br /&gt;
&lt;br /&gt;
Since this document is intended to be a quick introduction to libosso-abook for developers who would like to include address book functionality in their application, we will not cover Contacts in detail.&lt;br /&gt;
&lt;br /&gt;
=== libosso-abook ===&lt;br /&gt;
&lt;br /&gt;
The libosso-abook library is the highest-level entry point into the address book contents and implements most of the functionality exposed by osso-addressbook. Its main tasks are:&lt;br /&gt;
&lt;br /&gt;
# Aggregate &amp;quot;plain&amp;quot; contacts with any associated chat (&amp;quot;roster&amp;quot;) contacts&lt;br /&gt;
# Determine which attribute values to present for aggregated contacts in case of conflict&lt;br /&gt;
# Handle adding, removing, and editing contacts stored in the different Evolution Data Server back-ends&lt;br /&gt;
# Provide a number of high-level widgets for adding contacts, presenting contact avatars and online presence, and more&lt;br /&gt;
# Support intelligently merging contacts and their fields&lt;br /&gt;
&lt;br /&gt;
=== Evolution Data Server ===&lt;br /&gt;
&lt;br /&gt;
Evolution Data Server (EDS) is a software stack that performs most basic addressbook functionality (including storing contacts, calendar events, and so on). In Maemo 5, EDS is used to store contacts which are presented to applications via libosso-abook.&lt;br /&gt;
&lt;br /&gt;
EDS supports multiple back-ends for storing and retrieving contacts from multiple sources. Normally, EDS uses the &amp;quot;file&amp;quot; backend, which simply stores contacts as vCards in the local database. New in Maemo 5, EDS adds the SIM and Telepathy backends for accessing contacts stored on a SIM card and on chat rosters.&lt;br /&gt;
&lt;br /&gt;
The back-ends all provide slightly different functionality, but libosso-abook abstracts them to appear as a single, coherent contact store.&lt;br /&gt;
&lt;br /&gt;
==== libebook ====&lt;br /&gt;
&lt;br /&gt;
The libebook library provides access to the contacts stored in Evolution Data Server. The higher-level libosso-abook library uses libebook extensively internally, and you will not likely need to use libebook directly. For more advanced contact manipulation, libebook's EVCard class may be useful (since the main libosso-abook contact class, &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; is a subclass of it).&lt;br /&gt;
&lt;br /&gt;
N.B. Developers are discouraged from using the &amp;lt;code&amp;gt;EBook&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EBookView&amp;lt;/code&amp;gt; classes of libebook because they do not provide libosso-abook's features of contact aggregation, presence abstraction, and so on.&lt;br /&gt;
&lt;br /&gt;
=== Contacts Home Applet (osso-abook-home-applet) ===&lt;br /&gt;
&lt;br /&gt;
In order to minimize the number of taps required to contact your favorite contacts, Contacts provides a way to add shortcuts to specific contacts on your home views. The Contacts Home Applet is the process that draws these shortcuts on the home view.&lt;br /&gt;
&lt;br /&gt;
== Non-Widget Classes ==&lt;br /&gt;
&lt;br /&gt;
=== OssoABookAvatar ===&lt;br /&gt;
&lt;br /&gt;
Contacts may have an associated image, called their &amp;quot;avatar&amp;quot;. An avatar may be retrieved from a corresponding contact on an IM account or from a user-set local image.&lt;br /&gt;
&lt;br /&gt;
Master contacts select their avatar image in order of priority:&lt;br /&gt;
&lt;br /&gt;
# Any user-set image&lt;br /&gt;
# The most-recently-changed avatar amongst all attached roster contacts (i.e., on IM servers)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookAvatar&amp;lt;/code&amp;gt; is implemented by &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;OssoABookAvatar&amp;lt;/code&amp;gt; functions are used directly upon &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
The most important part of a contact's avatar is the image it contains, so this example focuses on that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;glib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
static void&lt;br /&gt;
avatar_save_image_to_file (OssoABookContact *contact,&lt;br /&gt;
                           const char       *filename)&lt;br /&gt;
{&lt;br /&gt;
        OssoABookAvatar *avatar = OSSO_ABOOK_AVATAR (contact);&lt;br /&gt;
        /* To get the image in a different size, use osso_abook_avatar_get_image_scaled() (this may affect image quality) */&lt;br /&gt;
        GdkPixbuf *pixbuf = osso_abook_avatar_get_image (avatar);&lt;br /&gt;
        &lt;br /&gt;
        if (pixbuf) {&lt;br /&gt;
                /* In a real application, you would do more careful error checking here */&lt;br /&gt;
                if (gdk_pixbuf_save (pixbuf, filename, &amp;quot;png&amp;quot;, NULL, NULL)) {&lt;br /&gt;
                        g_warning (&amp;quot;failed to save the avatar image '%s'&amp;quot;, filename);&lt;br /&gt;
                }&lt;br /&gt;
        } else {&lt;br /&gt;
                g_warning (&amp;quot;no avatar image to save&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the Additional API section for tips on caching avatar images.&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
Because images can take a relatively long time to process and are inconvenient to compare, it's often easiest to compare simple, unique values to determine image equality. This is especially useful when caching avatar images. In this snippet, &amp;lt;code&amp;gt;image_token&amp;lt;/code&amp;gt; is a hashable value:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
gpointer image_token = osso_abook_avatar_get_image_token (OSSO_ABOOK_AVATAR (contact));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Notable Signals ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::avatar-image&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/5.0-final/libosso-abook/libosso-abook-osso-abook-avatar.html reference documentation for OssoABookAvatar].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookCaps ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt; may possess a number of different capabilities, so the &amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt; interface (which &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt; implements) provides a simple means to detect these capabilities.&lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
The core of &amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt; is the &amp;lt;code&amp;gt;OssoABookCapsFlags&amp;lt;/code&amp;gt; enumeration, accessible by &amp;lt;code&amp;gt;osso_abook_caps_get_capabilities()&amp;lt;/code&amp;gt;. Its values are orthogonal and may be bitwise-ORed or -ANDed together for more detailed capabilities checks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void&lt;br /&gt;
contact_print_caps_details (OssoABookContact *contact)&lt;br /&gt;
{&lt;br /&gt;
        OssoABookCaps *caps = OSSO_ABOOK_CAPS (contact);&lt;br /&gt;
        OssoABookCapsFlags caps_flags = osso_abook_caps_get_capabilities (caps);&lt;br /&gt;
        &lt;br /&gt;
        g_print (&amp;quot;   Can receive email?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Can chat?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Can receive phone calls?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Can receive multimedia voice calls?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Can receive multimedia video calls?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Can receive calls of some type?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;\n&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; OSSO_ABOOK_CAPS_EMAIL ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; OSSO_ABOOK_CAPS_CHAT  ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; OSSO_ABOOK_CAPS_PHONE ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; OSSO_ABOOK_CAPS_VOICE ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; OSSO_ABOOK_CAPS_VIDEO ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 caps_flags &amp;amp; (OSSO_ABOOK_CAPS_PHONE | OSSO_ABOOK_CAPS_VOICE | OSSO_ABOOK_CAPS_VIDEO) ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt; also contains a convenience function for getting the capabilities of our own accounts (of type &amp;lt;code&amp;gt;McAccount*&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
OssoABookCapsFlags caps_flags = osso_abook_caps_from_account (account);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Notable Signals ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::capabilities&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/libosso-abook-osso-abook-caps.html reference documentation for OssoABookCaps].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookContact ===&lt;br /&gt;
&lt;br /&gt;
The central class in libosso-abook is &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt;, which is used in a few different ways:&lt;br /&gt;
&lt;br /&gt;
* as a master contact, which acts as an authoritative source of contact attributes for itself and any number of roster contacts. This use is further broken into:&lt;br /&gt;
** a persistent master contact, which is stored locally and may have zero or more attached roster contacts; OR:&lt;br /&gt;
** a temporary master contact, which is not stored at all and serves as a &amp;quot;placeholder&amp;quot; master for roster contacts which exist on the VoIP/IM server but whose username is not an attribute of a persistent master contact&lt;br /&gt;
* as a roster contact, which corresponds to exactly one (VoIP/IM username, VoIP/IM account) pair. All roster contacts are attached to one or more master contacts, and their details are cached locally but not stored in persistent master contact database&lt;br /&gt;
&lt;br /&gt;
In most cases, you will only be interested in master contacts (in general) because they aggregate all of the attributes of their own and their roster contacts. Every master contact is the authoritative source of a person's displayable name, avatar, presence, status message, etc. If a master contact and its roster contact(s) have multiple values for a single-instance attribute (e.g., avatar), the master contact will automatically pick an authoritative value.&lt;br /&gt;
&lt;br /&gt;
So if you just wish to display all of your contacts' names and IM availability, you would simply use the appropriate &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; functions on the list of master contacts and the master contacts will automatically report their &amp;quot;most-online&amp;quot; presence amongst their attached roster contacts (if any).&lt;br /&gt;
&lt;br /&gt;
In addition to its own functionality, &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; implements the &amp;lt;code&amp;gt;OssoABookAvatar&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt; interfaces. So &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt; can be used in their functions and will emit their signals. See their documentation for more details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; inherits from &amp;lt;code&amp;gt;EContact&amp;lt;/code&amp;gt; (which itself inherits from &amp;lt;code&amp;gt;EVCard&amp;lt;/code&amp;gt;). At its core, &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; is based around the vCard format for storing contact attributes. We recommend against manipulating and accessing contacts at the vCard level, since it's more complicated and error-prone than using the &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; functionality. Note that the Maemo Address Book adds some vCard attributes (e.g., &amp;lt;code&amp;gt;gender/X-GENDER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Skype username/X-SKYPE&amp;lt;/code&amp;gt;) that are not accessible at the EContact level, since they are not defined in &amp;lt;code&amp;gt;EContactField&amp;lt;/code&amp;gt;. So we recommend using the &amp;lt;code&amp;gt;EVCard&amp;lt;/code&amp;gt; functions over similar &amp;lt;code&amp;gt;EContact&amp;lt;/code&amp;gt; functions whenever possible. See the &amp;lt;code&amp;gt;EContact&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EVCard&amp;lt;/code&amp;gt; documentation for more details on their API.&lt;br /&gt;
&lt;br /&gt;
As with any &amp;lt;code&amp;gt;EContact&amp;lt;/code&amp;gt;, changes to an &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; are not permanently stored until they are explicitly committed. See the example and explanation of &amp;lt;code&amp;gt;osso_abook_contact_commit()&amp;lt;/code&amp;gt; below.&lt;br /&gt;
&lt;br /&gt;
==== Basic Examples ====&lt;br /&gt;
&lt;br /&gt;
===== Printing out basic contact details =====&lt;br /&gt;
&lt;br /&gt;
This example is meant to show off a few functions that you may want to use to get specific, basic Contact details. If you would like to get its avatar, see the documentation on &amp;lt;code&amp;gt;OssoABookAvatar&amp;lt;/code&amp;gt;; for its IM presence or capabilities, see &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Also note that, for most cases of displaying an avatar, presence icon, etc., libosso-abook provides widgets. See &amp;lt;code&amp;gt;OssoABookAvatarImage&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OssoABookPresenceIcon&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OssoABookTouchContactStarter&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;glib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
static void&lt;br /&gt;
contact_print_details (OssoABookContact *contact)&lt;br /&gt;
{&lt;br /&gt;
        g_print (&amp;quot;   UID: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Is a roster contact?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Is a master contact?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Has roster contacts?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Is a temporary (master) contact?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Is a SIM contact?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;\n&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_get_uid (contact),&lt;br /&gt;
                 osso_abook_contact_get_display_name (contact),&lt;br /&gt;
                 osso_abook_contact_is_roster_contact (contact)   ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_is_roster_contact (contact)   ? &amp;quot;no&amp;quot;  : &amp;quot;yes&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_has_roster_contacts (contact) ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_is_temporary (contact)        ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_is_sim_contact (contact)      ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
There are many ways to use an &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt;, and a significant portion of that lay in its parent classes and implemented interfaces (&amp;lt;code&amp;gt;OssoABookAvatar&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OssoABookCaps&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt;). See the appropriate documentation for more details.&lt;br /&gt;
&lt;br /&gt;
Here are some highlights of additional API for &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== General Functions =====&lt;br /&gt;
&lt;br /&gt;
Sometimes it can be handy to get a full listing of a contact's contents. In that case, you may wish to print out the low-level vCard representation of the contact. Note that this will not include the contents of any roster contacts, in the case of a master contact. Set the last argument to &amp;lt;code&amp;gt;TRUE&amp;lt;/code&amp;gt; if you wish to include the contact's avatar data (this can be very long).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
osso_abook_contact_to_string (contact, EVC_FORMAT_VCARD_30, FALSE);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you need to sort some contacts, &amp;lt;code&amp;gt;osso_abook_contact_collate()&amp;lt;/code&amp;gt; is a &amp;lt;code&amp;gt;strcmp()&amp;lt;/code&amp;gt;-like function that does just that. So, to sort a &amp;lt;code&amp;gt;GList&amp;lt;/code&amp;gt; of contacts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* To sort by presence, use OSSO_ABOOK_CONTACT_ORDER_PRESENCE instead */&lt;br /&gt;
g_list_sort_with_data (contacts, osso_abook_contact_collate, OSSO_ABOOK_CONTACT_ORDER_NAME);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I will be ptutnig this dazzling insight to good use in no time.&lt;br /&gt;
&lt;br /&gt;
===== Roster Contacts =====&lt;br /&gt;
&lt;br /&gt;
There are a number of useful functions for accessing roster contact details. This example shows off the basic ones:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;glib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
static void&lt;br /&gt;
roster_contact_print_details (OssoABookContact *contact)&lt;br /&gt;
{&lt;br /&gt;
        g_print (&amp;quot;      UID: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      Name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      McAccount: %p\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      McProfile: %p\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      vCard field: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      Bound name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      Has an invalid username: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;\n&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_get_uid (contact),&lt;br /&gt;
                 osso_abook_contact_get_display_name (contact),&lt;br /&gt;
                 osso_abook_contact_get_account (contact),&lt;br /&gt;
                 osso_abook_contact_get_profile (contact),&lt;br /&gt;
                 osso_abook_contact_get_vcard_field (contact),&lt;br /&gt;
                 osso_abook_contact_get_bound_name (contact),&lt;br /&gt;
                 osso_abook_contact_has_invalid_username (contact) ?  &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;);                    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Attribute Convenience Functions =====&lt;br /&gt;
&lt;br /&gt;
If you need a hashable key (to temporarily use) for contacts, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
const char *key = osso_abook_contact_get_uid (contact);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if you need a persistent hashable key (such as for an on-disk cache, database, etc.), use the following function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
const char *key = osso_abook_contact_get_persistent_uid (contact);&lt;br /&gt;
&lt;br /&gt;
if (!key) {&lt;br /&gt;
        g_print (&amp;quot;This contact isn't persistent!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sometimes it can be useful to add vCard attributes to a contact for custom applications. Say you have a networked game called Foo Bar Tetris, and you want to associate someone's username on the network with their contact:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;glib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* By convention, any arbitrary vCard files not in the specification should begin with &amp;quot;X-&amp;quot; */&lt;br /&gt;
#define VCARD_FIELD_USERNAME &amp;quot;X-FOO-BAR-TETRIS-USERNAME&amp;quot;&lt;br /&gt;
&lt;br /&gt;
/* Pass in NULL for username to simply remove the attribute */&lt;br /&gt;
static void&lt;br /&gt;
contact_set_game_username (OssoABookContact *contact,&lt;br /&gt;
                           const char       *username)&lt;br /&gt;
{&lt;br /&gt;
        char *current_username;&lt;br /&gt;
        &lt;br /&gt;
        /* Cast contact to EContact since this function takes an EContact argument */&lt;br /&gt;
        current_username = osso_abook_contact_get_value (E_CONTACT (contact), VCARD_FIELD_USERNAME);&lt;br /&gt;
&lt;br /&gt;
        g_print (&amp;quot;current username: %s&amp;quot;, current_username);&lt;br /&gt;
&lt;br /&gt;
        /* Set the new value; if there already were value(s), they will be removed before adding this new one */&lt;br /&gt;
        osso_abook_contact_set_value (E_CONTACT (contact), VCARD_FIELD_USERNAME, username);&lt;br /&gt;
        &lt;br /&gt;
        g_free (current_username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Notable Signals ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;reset&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;contact-attached&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;contact-detached&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/5.0-final/libosso-abook/OssoABookContact.html reference documentation for OssoABookContact].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookPresence ===&lt;br /&gt;
&lt;br /&gt;
A contact's &amp;quot;presence&amp;quot; is comprised of a few elements, including:&lt;br /&gt;
&lt;br /&gt;
;status&lt;br /&gt;
: a well-known string describing the contact's availability. In Maemo 5, this string is always one of {&amp;quot;available&amp;quot;, &amp;quot;away&amp;quot;, &amp;quot;dnd&amp;quot; (do not disturb), &amp;quot;offline&amp;quot;, and &amp;quot;unknown&amp;quot;}. The &amp;quot;type&amp;quot; (see below) is the preferred element for determining a contact's availability. &lt;br /&gt;
;status message&lt;br /&gt;
: the string set by your contact (e.g., &amp;quot;I'm running outside&amp;quot;)&lt;br /&gt;
;type&lt;br /&gt;
: an integer representing the contact's availability. This is more fine-grained than &amp;quot;status&amp;quot; (see above) and the preferred way to determine a contact's availability&lt;br /&gt;
&lt;br /&gt;
An &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; master contact has the aggregated presence of all its roster contact(s). In the case of status, the master contact will have the &amp;quot;most-online&amp;quot; status amongst its roster contacts. For example, given a master contact with roster contacts having statuses &amp;quot;away&amp;quot; and &amp;quot;offline&amp;quot;, the master contact's status will be &amp;quot;away&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt; is implemented by &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt; functions are used directly upon &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
This example shows off some of the more useful basic functions in &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt;. Note that you will always be using &amp;lt;code&amp;gt;OssoABookPresence&amp;lt;/code&amp;gt; functions on &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt;, since they're the only class that implements the interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;glib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;telepathy-glib/connection.h&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
static void&lt;br /&gt;
self_account_print_details (McAccount *account)&lt;br /&gt;
{&lt;br /&gt;
        const char *current_status;&lt;br /&gt;
        const char *current_message;&lt;br /&gt;
        const char *requested_status;&lt;br /&gt;
        const char *requested_message;&lt;br /&gt;
&lt;br /&gt;
        mc_account_get_current_presence (account, NULL, &amp;amp;current_status, &amp;amp;current_message);&lt;br /&gt;
        mc_account_get_requested_presence (account, NULL, &amp;amp;requested_status, &amp;amp;requested_message);&lt;br /&gt;
&lt;br /&gt;
        g_print (&amp;quot;   Normalized name (unique ID): %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Display name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Has been online?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Current presence:\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      status:  %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      message: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Requested presence:\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      status:  %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;      message: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;\n&amp;quot;,&lt;br /&gt;
                 account-&amp;gt;name,&lt;br /&gt;
                 mc_account_get_display_name (account),&lt;br /&gt;
                 mc_account_has_been_online (account) ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 current_status,&lt;br /&gt;
                 current_message,&lt;br /&gt;
                 requested_status,&lt;br /&gt;
                 requested_message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void&lt;br /&gt;
contact_print_presence_details (OssoABookContact *contact)&lt;br /&gt;
{&lt;br /&gt;
        OssoABookPresence *presence = OSSO_ABOOK_PRESENCE (contact);&lt;br /&gt;
        TpConnectionPresenceType type;&lt;br /&gt;
&lt;br /&gt;
        type = osso_abook_presence_get_presence_type (presence);&lt;br /&gt;
&lt;br /&gt;
        g_print (&amp;quot;   Contact name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Status type: %d\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Is online?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Status: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Display Status: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Status Message: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Location: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Icon name: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Presence Is Invalid?: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Blocked state:    %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Published state:  %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;   Subscribed state: %s\n&amp;quot;&lt;br /&gt;
                 &amp;quot;\n&amp;quot;,&lt;br /&gt;
                 osso_abook_contact_get_display_name (contact),&lt;br /&gt;
                 type,&lt;br /&gt;
                 (tp_connection_presence_type_cmp_availability (type, TP_CONNECTION_PRESENCE_TYPE_HIDDEN) &amp;gt; 0) ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 osso_abook_presence_get_presence_status (presence),&lt;br /&gt;
                 osso_abook_presence_get_display_status (presence),&lt;br /&gt;
                 osso_abook_presence_get_presence_status_message (presence),&lt;br /&gt;
                 osso_abook_presence_get_location_string (presence),&lt;br /&gt;
                 osso_abook_presence_get_icon_name (presence),&lt;br /&gt;
                 osso_abook_presence_is_invalid (presence) ? &amp;quot;yes&amp;quot; : &amp;quot;no&amp;quot;,&lt;br /&gt;
                 osso_abook_presence_state_get_nick (osso_abook_presence_get_blocked (presence)),&lt;br /&gt;
                 osso_abook_presence_state_get_nick (osso_abook_presence_get_published (presence)),&lt;br /&gt;
                 osso_abook_presence_state_get_nick (osso_abook_presence_get_subscribed (presence)));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
The example above shows how to compare the basic &amp;lt;code&amp;gt;TpConnectionPresenceType&amp;lt;/code&amp;gt; return value of &amp;lt;code&amp;gt;osso_abook_presence_get_presence_type()&amp;lt;/code&amp;gt;. At a higher level, if you want to compare the relative availability of two &amp;lt;code&amp;gt;OssoABookPresences&amp;lt;/code&amp;gt; (e.g., &amp;lt;code&amp;gt;OssoABookContacts&amp;lt;/code&amp;gt;), you can use the convenience function &amp;lt;code&amp;gt;osso_abook_presence_compare()&amp;lt;/code&amp;gt;. It works like most &amp;lt;code&amp;gt;strcmp()&amp;lt;/code&amp;gt;-like functions, except that it returns a value &amp;lt; 0 is the first presence is more online than the other, and vice versa.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* Sort the contacts in order of decreasing availability */&lt;br /&gt;
contacts = g_list_sort (contacts, (GCompareFunc) osso_abook_presence_compare);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Notable Signals ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::presence-location-string&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::presence-status&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::presence-status-message&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;notify::presence-type&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/libosso-abook-osso-abook-presence.html reference documentation for OssoABookPresence].&lt;br /&gt;
&lt;br /&gt;
== Widget Classes ==&lt;br /&gt;
&lt;br /&gt;
=== OssoABookContactChooser ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookContactChooser&amp;lt;/code&amp;gt; is a widget that allows you to present a selectable list of contacts to the user. The contact chooser is relatively flexible so that it&lt;br /&gt;
can be used in many different situations.  &lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
The following is a simple example of the use of &amp;lt;code&amp;gt;OssoABookContactChooser&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static void&lt;br /&gt;
test_contact_chooser (void)&lt;br /&gt;
{&lt;br /&gt;
        GtkWidget *chooser;&lt;br /&gt;
        GList *selection;&lt;br /&gt;
&lt;br /&gt;
        chooser = osso_abook_contact_chooser_new (NULL, &amp;quot;Choose a contact&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        /* uncomment this to allow user to select more than a single contact&lt;br /&gt;
        osso_abook_contact_chooser_set_minimum_selection&lt;br /&gt;
                (OSSO_ABOOK_CONTACT_CHOOSER (chooser), 2);&lt;br /&gt;
        osso_abook_contact_chooser_set_maximum_selection&lt;br /&gt;
                (OSSO_ABOOK_CONTACT_CHOOSER (chooser), G_MAXINT);&lt;br /&gt;
        */&lt;br /&gt;
&lt;br /&gt;
        gtk_dialog_run (GTK_DIALOG (chooser));&lt;br /&gt;
        gtk_widget_hide (chooser);&lt;br /&gt;
&lt;br /&gt;
        /* print the names of the selected contact to the command line */&lt;br /&gt;
        selection = osso_abook_contact_chooser_get_selection&lt;br /&gt;
                (OSSO_ABOOK_CONTACT_CHOOSER (chooser));&lt;br /&gt;
&lt;br /&gt;
        if (selection) {&lt;br /&gt;
                GList *l;&lt;br /&gt;
&lt;br /&gt;
                g_printf (&amp;quot;Selected Contacts:\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                for (l = selection; l; l = l-&amp;gt;next) {&lt;br /&gt;
                        g_printf (&amp;quot;%s\n&amp;quot;, osso_abook_contact_get_display_name(l-&amp;gt;data));&lt;br /&gt;
                }&lt;br /&gt;
        } else {&lt;br /&gt;
                g_printf (&amp;quot;Nothing selected&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        g_list_free (selection);&lt;br /&gt;
&lt;br /&gt;
        gtk_widget_destroy (chooser);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
The contacts shown in the list can be customized in several ways.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_contact_chooser_set_capabilities()&amp;lt;/code&amp;gt; allows you to limit the contacts shown in the list to only those that have certain capabilities. For example, to&lt;br /&gt;
show only those contacts that have an associated email address:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
osso_abook_contact_chooser_set_capabilities (chooser, OSSO_ABOOK_CAPS_EMAIL);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can show only those contacts whose presence status indicates that they are&lt;br /&gt;
online, which may be useful for applications that want to interact with another&lt;br /&gt;
contact over a messaging protocol:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
osso_abook_contact_chooser_set_hide_offline_contacts (chooser, TRUE);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are specific contacts that you wish to exclude from the chooser, you&lt;br /&gt;
can specify them explicitly.  For example, consider an email application: when&lt;br /&gt;
choosing recipients for a message, it might be useful to exclude the contacts&lt;br /&gt;
that are already present in the &amp;quot;To:&amp;quot; field.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
OssoABookContact *john_doe; /* reference to a contact from the addressbook */&lt;br /&gt;
&lt;br /&gt;
GList *contacts = NULL;&lt;br /&gt;
contacts = g_list_prepend (contacts, john_doe);&lt;br /&gt;
osso_abook_contact_chooser_set_excluded_contacts (chooser, contacts);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If an application needs even more control,&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_contact_chooser_set_visible_func()&amp;lt;/code&amp;gt; provides a way for the application to supply a predicate function that will determine whether the contact should be&lt;br /&gt;
shown in the chooser.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
gboolean custom_visible_func(OssoABookContactChooser *chooser,&lt;br /&gt;
                             OssoABookContact *contact,&lt;br /&gt;
                             gpointer user_data)&lt;br /&gt;
{&lt;br /&gt;
        const char *needle = (const char*)user_data;&lt;br /&gt;
        const char *name = osso_abook_contact_get_display_name (contact);&lt;br /&gt;
&lt;br /&gt;
        if (strstr (name, needle) != NULL) {&lt;br /&gt;
                return TRUE;&lt;br /&gt;
        return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
/* only show contacts that contain the string 'foo' in their name */&lt;br /&gt;
osso_abook_contact_chooser_set_visible_func (chooser, custom_visible_func,&lt;br /&gt;
                                             &amp;quot;foo&amp;quot;, NULL);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the ability to customize the contacts that are shown in the&lt;br /&gt;
chooser, the appearance and behavior can also be customized.  The chooser can&lt;br /&gt;
operate in either single-selection or multi-selection mode, it allows an&lt;br /&gt;
application to specify the ordering of the contacts in the list, and provides&lt;br /&gt;
functions to programmatically select and deselect items from the list.&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/OssoABookContactChooser.html reference documentation for OssoABookContactChooser].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookTreeView ===&lt;br /&gt;
&lt;br /&gt;
Although &amp;lt;code&amp;gt;OssoABookTreeView&amp;lt;/code&amp;gt;'s name might imply that it inherits from &amp;lt;code&amp;gt;GtkTreeView&amp;lt;/code&amp;gt;, it is actually an ancestor of &amp;lt;code&amp;gt;GtkVBox&amp;lt;/code&amp;gt; that contains a &amp;lt;code&amp;gt;GtkTreeView&amp;lt;/code&amp;gt; inside of a &amp;lt;code&amp;gt;HildonPannableArea&amp;lt;/code&amp;gt;. It provides a convenient way to display a list of contacts and sets up the &amp;lt;code&amp;gt;GtkTreeView&amp;lt;/code&amp;gt; columns automatically. It can show the contacts' name, Telephone number, presence status, and avatar image. These details can be&lt;br /&gt;
selectively enabled or disabled according to an application's requirements.&lt;br /&gt;
&lt;br /&gt;
It is unlikely that an application will need or want to instantiate an&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookTreeView&amp;lt;/code&amp;gt; object directly. Most of the time, applications will deal&lt;br /&gt;
with &amp;lt;code&amp;gt;OssoABookContactView&amp;lt;/code&amp;gt; objects, which inherits from this class and does most of the setup work for you.&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookTreeView&amp;lt;/code&amp;gt; is an aggregate widget, but it provides direct access to the underlying widgets as well (e.g. &amp;lt;code&amp;gt;osso_abook_tree_view_get_tree_view()&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_tree_view_get_pannable_area()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
An application can filter the list of contacts that gets displayed in the tree&lt;br /&gt;
view by using &amp;lt;code&amp;gt;osso_abook_tree_view_set_filter_model()&amp;lt;/code&amp;gt;.  The following example shows how to display only those contacts whose names contain a certain string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
OssoABookTreeView *view;&lt;br /&gt;
OssoABookListStore *base_model;&lt;br /&gt;
OssoABookFilterModel *filter_model;&lt;br /&gt;
&lt;br /&gt;
base_model = osso_abook_contact_model_get_default ();&lt;br /&gt;
&lt;br /&gt;
filter_model = osso_abook_filter_model_new (base_model);&lt;br /&gt;
&lt;br /&gt;
/* only display contacts whose names contain the string &amp;quot;foo&amp;quot; */&lt;br /&gt;
osso_abook_filter_model_set_text (filter_model, &amp;quot;foo&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
osso_abook_tree_view_set_base_model (view, base_model);&lt;br /&gt;
osso_abook_tree_view_set_filter_model (view, filter_model);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, if you only want to display those contacts associated with a particular VoIP or IM account, use the function&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_tree_view_set_aggregation_account()&amp;lt;/code&amp;gt;.  In addition to limiting the contacts to only those specified by those accounts, it will also display the&lt;br /&gt;
presence status and avatar image for that particular account regardless of the&lt;br /&gt;
contact's status on other VoIP or IM accounts.&lt;br /&gt;
&lt;br /&gt;
The details shown in the tree view can be controlled with the following&lt;br /&gt;
properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;show-contact-avatar&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;show-contact-name&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;show-contact-presence&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;show-contact-telephone&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/OssoABookTreeView.html reference documentation for OssoABookTreeView].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookContactView ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookContactView&amp;lt;/code&amp;gt; provides a convenient widget for displaying a list of&lt;br /&gt;
contacts in a list. It builds upon &amp;lt;code&amp;gt;OssoABookTreeView&amp;lt;/code&amp;gt; and adds a bit of&lt;br /&gt;
convenience API.&lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
The following example shows how to display all contacts from the Address Book in&lt;br /&gt;
a list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
        osso_context_t *osso_cxt;&lt;br /&gt;
        OssoABookContactModel *default_model;&lt;br /&gt;
        GtkWidget *view, *window;&lt;br /&gt;
&lt;br /&gt;
        osso_cxt = osso_initialize (argv[0], &amp;quot;1.0&amp;quot;, FALSE, NULL);&lt;br /&gt;
        osso_abook_init (&amp;amp;argc, &amp;amp;argv, osso_cxt);&lt;br /&gt;
&lt;br /&gt;
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);&lt;br /&gt;
&lt;br /&gt;
        default_model = osso_abook_contact_model_get_default ();&lt;br /&gt;
        view = osso_abook_contact_view_new_basic (HILDON_UI_MODE_NORMAL,&lt;br /&gt;
                        default_model);&lt;br /&gt;
&lt;br /&gt;
        gtk_container_add (GTK_CONTAINER (window), view);&lt;br /&gt;
&lt;br /&gt;
        gtk_widget_show (view);&lt;br /&gt;
        gtk_widget_show (window);&lt;br /&gt;
        gtk_main ();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookContactView&amp;lt;/code&amp;gt; has some additional convenience API that allows you to get the contact (or properties of the contact) that currently has input focus:&lt;br /&gt;
* &amp;lt;code&amp;gt;osso_abook_contact_view_get_focus()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;osso_abook_contact_view_get_focus_avatar()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;osso_abook_contact_view_get_focus_presence()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;osso_abook_contact_view_get_focus_caps()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Contact view can support both single- and multiple-selection modes.&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_contact_view_set_minimum_selection()&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_contact_view_set_maximum_selection()&amp;lt;/code&amp;gt; allow fine-grained control over how contacts can be selected.&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/OssoABookContactView.html reference documentation for OssoABookContactView].&lt;br /&gt;
&lt;br /&gt;
=== OssoABookTouchContactStarter ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookTouchContactStarter&amp;lt;/code&amp;gt; is a widget that displays the information for a contact and can be used to initiate communication with a contact (email, IM,&lt;br /&gt;
VoIP, etc).&lt;br /&gt;
&lt;br /&gt;
==== Basic Example ====&lt;br /&gt;
&lt;br /&gt;
The following is a simple example that shows how to use&lt;br /&gt;
&amp;lt;code&amp;gt;OssoABookTouchContactStarter&amp;lt;/code&amp;gt; to display the details of a particular contact.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;libosso-abook/osso-abook.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
        osso_context_t *osso_cxt;&lt;br /&gt;
        //OssoABookTouchContactStarter *starter;&lt;br /&gt;
        GtkWidget *starter, *window, *chooser;&lt;br /&gt;
        GList *contacts = NULL;&lt;br /&gt;
&lt;br /&gt;
        osso_cxt = osso_initialize (argv[0], &amp;quot;1.0&amp;quot;, FALSE, NULL);&lt;br /&gt;
        osso_abook_init (&amp;amp;argc, &amp;amp;argv, osso_cxt);&lt;br /&gt;
&lt;br /&gt;
        chooser = osso_abook_contact_chooser_new (NULL, &amp;quot;Pick a Contact&amp;quot;);&lt;br /&gt;
        gtk_dialog_run (GTK_DIALOG (chooser));&lt;br /&gt;
        gtk_widget_hide (chooser);&lt;br /&gt;
&lt;br /&gt;
        contacts = osso_abook_contact_chooser_get_selection&lt;br /&gt;
                (OSSO_ABOOK_CONTACT_CHOOSER (chooser));&lt;br /&gt;
&lt;br /&gt;
        if (contacts) {&lt;br /&gt;
                starter = osso_abook_touch_contact_starter_new_with_contact&lt;br /&gt;
                        (NULL, contacts-&amp;gt;data);&lt;br /&gt;
                window = gtk_window_new (GTK_WINDOW_TOPLEVEL);&lt;br /&gt;
                gtk_container_add (GTK_CONTAINER (window), starter);&lt;br /&gt;
&lt;br /&gt;
                gtk_widget_show (starter);&lt;br /&gt;
                gtk_widget_show (window);&lt;br /&gt;
                g_signal_connect (window, &amp;quot;destroy&amp;quot;, gtk_main_quit, NULL);&lt;br /&gt;
                gtk_main ();&lt;br /&gt;
&lt;br /&gt;
                g_list_free (contacts);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional API ====&lt;br /&gt;
&lt;br /&gt;
In addition to the basic example shown above, there are several other ways to&lt;br /&gt;
customize the &amp;lt;code&amp;gt;OssoABookTouchContactStarter&amp;lt;/code&amp;gt; widget.  By default the contact starter is created in 'read-only' mode.  But if the starter was created with&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_touch_contact_starter_new_with_editor()&amp;lt;/code&amp;gt;, a contact editor can be launched by clicking the avatar icon. This allows the contact's details to be&lt;br /&gt;
changed directly from the contact starter widget. An editor can also be&lt;br /&gt;
launched programmatically by calling &amp;lt;code&amp;gt;osso_abook_touch_contact_starter_start_editor()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A contact starter is normally interactive in the sense that it can be used to&lt;br /&gt;
initiate contact with the contact (e.g. start a phone call, start a chat, etc),&lt;br /&gt;
though it can be made non-interactive by creating the starter with&lt;br /&gt;
&amp;lt;code&amp;gt;osso_abook_touch_contact_starter_new_not_interactive()&amp;lt;/code&amp;gt;.  In addition, an&lt;br /&gt;
application can override the default actions by connecting to the &amp;lt;code&amp;gt;pre-action-start&amp;lt;/code&amp;gt; signal.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
gboolean&lt;br /&gt;
pre_action_start_cb (OssoABookTouchContactStarter *starter,&lt;br /&gt;
                OssoABookContactFieldAction *action,&lt;br /&gt;
                gpointer user_data)&lt;br /&gt;
{&lt;br /&gt;
        OssoABookContactAction action_type =&lt;br /&gt;
                osso_abook_contact_field_action_get_action (action);&lt;br /&gt;
&lt;br /&gt;
        if (OSSO_ABOOK_CONTACT_ACTION_TEL == action_type) {&lt;br /&gt;
                hildon_banner_show_information (GTK_WIDGET (starter),&lt;br /&gt;
                                NULL, &amp;quot;Telephone call action intercepted&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                /* stop signal emission */&lt;br /&gt;
                return TRUE;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        /* don't stop signal emission -- let the default handler have it */&lt;br /&gt;
        return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
g_signal_connect (starter, &amp;quot;pre-action-start&amp;quot;,&lt;br /&gt;
                                G_CALLBACK (pre_action_start_cb), NULL);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Complete API Documentation ====&lt;br /&gt;
&lt;br /&gt;
Full details can be found in the API [http://maemo.org/api_refs/5.0/beta/libosso-abook/OssoABookTouchContactStarter.html reference documentation for OssoABookTouchContactStarter].&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
;aggregated contact&lt;br /&gt;
: a persistent master contact with one or more attached roster contacts.&lt;br /&gt;
;aggregator&lt;br /&gt;
: an &amp;lt;code&amp;gt;OssoABookAggregator&amp;lt;/code&amp;gt; object which manages connections to the EDS backends and associates master contacts with their roster contacts.&lt;br /&gt;
;master contact&lt;br /&gt;
: an &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; which aggregates the attributes of zero or one persistent master contacts and zero or more roster contacts.&lt;br /&gt;
;persistent master contact&lt;br /&gt;
: an &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; which is stored in the EDS local database and has zero or more roster contacts.&lt;br /&gt;
;roster contact&lt;br /&gt;
: an &amp;lt;code&amp;gt;OssoABookContact&amp;lt;/code&amp;gt; which is stored in the EDS Telepathy backend and represents a (VoIP/IM username, account) pair. Roster contacts are always attached to exactly one temporary master contact or one or more persistent master contacts.&lt;br /&gt;
;temporary master contact&lt;br /&gt;
: a master contact which was created at run-time for a roster contact to attach to, so that all roster contacts have one or more master contacts. Temporary master contacts are not stored in the local database and their UIDs must not be stored beyond the lifetime of the contact aggregator to which they belong.&lt;br /&gt;
;unique identifier (UID)&lt;br /&gt;
: a hashable ID which is unique across all EDS back-ends. See the definition for &amp;quot;temporary master contact&amp;quot; for relevant usage warnings.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Fremantle]]&lt;/div&gt;</description>
			<pubDate>Sat, 10 Dec 2011 17:35:57 GMT</pubDate>			<dc:creator>107.22.227.93</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Using_Address_Book_API</comments>		</item>
	</channel>
</rss>