OssoABookContactModel

OssoABookContactModel — A GtkTreeModel listing EContact objects.

Synopsis




            OssoABookContactModel;
enum        OssoABookContactModelColumn;
OssoABookContactModel* osso_abook_contact_model_new
                                            (void);
gboolean    osso_abook_contact_model_get_iter
                                            (OssoABookContactModel *model,
                                             const char *contact_uid,
                                             GtkTreeIter *iter);


Object Hierarchy


  GObject
   +----GtkListStore
         +----OssoABookTreeModel
               +----OssoABookContactModel

Implemented Interfaces

OssoABookContactModel implements GtkTreeModel, GtkTreeDragSource, GtkTreeDragDest and GtkTreeSortable.

Description

The OssoABookContactModel is a model that lists the EContact objects exposed by an EBookView, and their associated OssoABookContactPresence objects.

The idiomatic way of using OssoABookContactModel is to create an asynchronous EBookView with e_book_async_get_book_view, then in the callback create a new model instance with osso_abook_contact_model_new and set the book-view property with osso_abook_tree_model_set_book_view before calling e_book_view_start.

static void
get_book_view_cb (EBook *book, EBookStatus status, EBookView *book_view, gpointer user_data)
{
	OssoABookContactModel *contact_model;
	contact_model = osso_abook_contact_model_new();
	osso_abook_tree_model_set_book_view (OSSO_ABOOK_TREE_MODEL (contact_model), book_view);
	e_book_view_start (book_view);
}

...
EBookQuery *query = e_book_query_any_field_contains ("");
e_book_async_get_book_view (book, query, NULL, -1, get_book_view_cb, NULL);
e_book_query_unref (query);

This model can then be used with OssoABookContactView, OssoABookContactSelector, or custom GtkTreeView widgets.

Details

OssoABookContactModel

typedef struct _OssoABookContactModel OssoABookContactModel;

There are no public fields in OssoABookContactModel.


enum OssoABookContactModelColumn

typedef enum {
        OSSO_ABOOK_CONTACT_MODEL_COL_CONTACT  = 0,
                                /* EContact *                  */ 
        OSSO_ABOOK_CONTACT_MODEL_COL_PRESENCE = 1 
                                /* OssoABookContactPresence *  */
} OssoABookContactModelColumn;

The data columns of the model. Data cell data can be retreived using gtk_tree_model_get().

OSSO_ABOOK_CONTACT_MODEL_COL_CONTACT The column containing EContact objects
OSSO_ABOOK_CONTACT_MODEL_COL_PRESENCE The column containing OssoABookContactPresence objects

osso_abook_contact_model_new ()

OssoABookContactModel* osso_abook_contact_model_new
                                            (void);

Creates a new OssoABookContactModel object. Note that for any contacts to show up, the newly created model should be bound to an EBookView using osso_abook_tree_model_set_book_view().

Returns : A new OssoABookContactModel object.

osso_abook_contact_model_get_iter ()

gboolean    osso_abook_contact_model_get_iter
                                            (OssoABookContactModel *model,
                                             const char *contact_uid,
                                             GtkTreeIter *iter);

Retreives the GtkTreeIter associated with the EContact with UID contact_id, and stores it in iter.

model : An OssoABookContactModel
contact_uid : An EContact UID
iter : A GtkTreeIter. Can be NULL.
Returns : TRUE if an EContact with UID contact_id was included in model, FALSE otherwise.

See Also

OssoABookContactView, OssoABookContactSelector, OssoABookContactPresence