## EDataBookView

EDataBookView — A server side object for issuing view notifications

## Synopsis

    #include <libedata-book/libedata-book.h>

    struct              EDataBookView;
    struct              EDataBookViewClass;
    EDataBookView *     e_data_book_view_new                (struct _EBookBackend *backend,
                                                             EBookBackendSExp *sexp,
                                                             GDBusConnection *connection,
                                                             const gchar *object_path,
                                                             GError **error);
    struct _EBookBackend * e_data_book_view_get_backend     (EDataBookView *view);
    GDBusConnection *   e_data_book_view_get_connection     (EDataBookView *view);
    const gchar *       e_data_book_view_get_object_path    (EDataBookView *view);
    EBookBackendSExp *  e_data_book_view_get_sexp           (EDataBookView *view);
    EBookClientViewFlags e_data_book_view_get_flags         (EDataBookView *view);
    void                e_data_book_view_notify_update      (EDataBookView *view,
                                                             const EContact *contact);
    void                e_data_book_view_notify_update_vcard
                                                            (EDataBookView *view,
                                                             const gchar *id,
                                                             const gchar *vcard);
    void                e_data_book_view_notify_update_prefiltered_vcard
                                                            (EDataBookView *view,
                                                             const gchar *id,
                                                             const gchar *vcard);
    void                e_data_book_view_notify_remove      (EDataBookView *view,
                                                             const gchar *id);
    void                e_data_book_view_notify_complete    (EDataBookView *view,
                                                             const GError *error);
    void                e_data_book_view_notify_progress    (EDataBookView *view,
                                                             guint percent,
                                                             const gchar *message);
    GHashTable *        e_data_book_view_get_fields_of_interest
                                                            (EDataBookView *view);

## Description

This class communicates with EBookClientViews over the bus.

Addressbook backends can automatically own a number of views requested by the client, this API can be used by the backend to issue notifications which will be delivered to the EBookClientView

## Details

### struct EDataBookView

    struct EDataBookView {
    	GObject parent;
    	EDataBookViewPrivate *priv;
    };

### struct EDataBookViewClass

    struct EDataBookViewClass {
    	GObjectClass parent;
    };

### e_data_book_view_new ()

    EDataBookView *     e_data_book_view_new                (struct _EBookBackend *backend,
                                                             EBookBackendSExp *sexp,
                                                             GDBusConnection *connection,
                                                             const gchar *object_path,
                                                             GError **error);

Creates a new EDataBookView and exports its D-Bus interface on `connection` at `object_path`. If an error occurs while exporting, the function sets `error` and returns `NULL`.

`backend` : | an EBookBackend
`sexp` : | an EBookBackendSExp
`connection` : | a GDBusConnection
`object_path` : | an object path for the view
`error` : | return location for a GError, or `NULL`
Returns : | an EDataBookView

### e_data_book_view_get_backend ()

    struct _EBookBackend * e_data_book_view_get_backend     (EDataBookView *view);

Gets the backend that `view` is querying.

`view` : | an EDataBookView
Returns : | The associated EBookBackend.

### e_data_book_view_get_connection ()

    GDBusConnection *   e_data_book_view_get_connection     (EDataBookView *view);

Returns the GDBusConnection on which the AddressBookView D-Bus interface is exported.

`view` : | an EDataBookView
Returns : | the GDBusConnection

Since 3.8

### e_data_book_view_get_object_path ()

    const gchar *       e_data_book_view_get_object_path    (EDataBookView *view);

Returns the object path at which the AddressBookView D-Bus interface is exported.

`view` : | an EDataBookView
Returns : | the object path

Since 3.8

### e_data_book_view_get_sexp ()

    EBookBackendSExp *  e_data_book_view_get_sexp           (EDataBookView *view);

Gets the s-expression used for matching contacts to `view`.

`view` : | an EDataBookView
Returns : | The EBookBackendSExp used.

Since 3.8

### e_data_book_view_get_flags ()

    EBookClientViewFlags e_data_book_view_get_flags         (EDataBookView *view);

Gets the EBookClientViewFlags that control the behaviour of `view`.

`view` : | an EDataBookView
Returns : | the flags for `view`.

Since 3.4

### e_data_book_view_notify_update ()

    void                e_data_book_view_notify_update      (EDataBookView *view,
                                                             const EContact *contact);

Notify listeners that `contact` has changed. This can trigger an add, change or removal event depending on whether the change causes the contact to start matching, no longer match, or stay matching the query specified by `view`.

`view` : | an EDataBookView
`contact` : | an EContact

### e_data_book_view_notify_update_vcard ()

    void                e_data_book_view_notify_update_vcard
                                                            (EDataBookView *view,
                                                             const gchar *id,
                                                             const gchar *vcard);

Notify listeners that `vcard` has changed. This can trigger an add, change or removal event depending on whether the change causes the contact to start matching, no longer match, or stay matching the query specified by `view`. This method should be preferred over `e_data_book_view_notify_update()` when the native representation of a contact is a vCard.

`view` : | an EDataBookView
`vcard` : | a plain vCard

### e_data_book_view_notify_update_prefiltered_vcard ()

    void                e_data_book_view_notify_update_prefiltered_vcard
                                                            (EDataBookView *view,
                                                             const gchar *id,
                                                             const gchar *vcard);

Notify listeners that `vcard` has changed. This can trigger an add, change or removal event depending on whether the change causes the contact to start matching, no longer match, or stay matching the query specified by `view`. This method should be preferred over `e_data_book_view_notify_update()` when the native representation of a contact is a vCard.

The important difference between this method and `e_data_book_view_notify_update()` and `e_data_book_view_notify_update_vcard()` is that it doesn't match the contact against the book view query to see if it should be included, it assumes that this has been done and the contact is known to exist in the view.

`view` : | an EDataBookView
`id` : | the UID of this contact
`vcard` : | a plain vCard

### e_data_book_view_notify_remove ()

    void                e_data_book_view_notify_remove      (EDataBookView *view,
                                                             const gchar *id);

Notify listeners that a contact specified by `id` was removed from `view`.

`view` : | an EDataBookView
`id` : | a unique contact ID

### e_data_book_view_notify_complete ()

    void                e_data_book_view_notify_complete    (EDataBookView *view,
                                                             const GError *error);

Notifies listeners that all pending updates on `view` have been sent. The listener's information should now be in sync with the backend's.

`view` : | an EDataBookView
`error` : | the error of the query, if any

### e_data_book_view_notify_progress ()

    void                e_data_book_view_notify_progress    (EDataBookView *view,
                                                             guint percent,
                                                             const gchar *message);

Provides listeners with a human-readable text describing the current backend operation. This can be used for progress reporting.

`view` : | an EDataBookView
`percent` : | percent done; use -1 when not available
`message` : | a text message

Since 3.2

### e_data_book_view_get_fields_of_interest ()

    GHashTable *        e_data_book_view_get_fields_of_interest
                                                            (EDataBookView *view);

`view` : | an EDataBookView
Returns : | Hash table of field names which the listener is interested in. Backends can return fully populated objects, but the listener advertised that it will use only these. Returns `NULL` for all available fields. Note: The data pointer in the hash table has no special meaning, it's only GINT_TO_POINTER(1) for easier checking. Also, field names are compared case insensitively.